blib/lib/App/mojopaste.pm untested

filter: Statementstmt 0.0% 0 / 1 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 1 SCAR -
1 package App::mojopaste;
2  
3 our $VERSION = '1.05';
4  
5 1;
6  
7 =encoding utf8
8  
9 =head1 NAME
10  
11 App::mojopaste - Pastebin application
12  
13 =head1 VERSION
14  
15 1.05
16  
17 =head1 DESCRIPTION
18  
19 Mojopaste is a pastebin application. There's about one million of these out
20 there, but if you have the need to run something internally at work or you
21 just fancy having your own pastebin, this is your application.
22  
23 =head2 Text and code
24  
25 The standard version of L<App::mojopaste> can take normal text as input,
26 store it as a text file on the server and render the content as either
27 plain text or prettified using L<Google prettify|https://code.google.com/p/google-code-prettify/>.
28 (Note: Maybe another prettifier will be used in future versions)
29  
30 =head2 Charts
31  
32 In addition to just supporting text, this application can also make charts
33 from the input data. To turn this feature on, you need to specify
34 "enable_charts" in the config or set the C<PASTE_ENABLE_CHARTS>
35 environment variable:
36  
37 $ PASTE_ENABLE_CHARTS=1 script/mojopaste daemon;
38  
39 The input chart data must be valid CSV:
40  
41 CSV data is similar to L</Just data> above, except the first line is used as
42 "xkey,ykey1,ykey2,...". Example:
43  
44 # Can have comments in CSV input as well
45 x,a,b
46 2015-02-04 15:03,120,90
47 2015-03-14,75,65
48 2015-04,100,40
49  
50 CSV input data require L<Text::CSV> to be installed.
51  
52 =head2 Embedding
53  
54 A paste can be embedded in other pages using the query param "embed". Examples:
55  
56 =over 2
57  
58 =item * L<http://p.thorsen.pm/mojopastedemo.txt>
59  
60 Get the raw data.
61  
62 =item * L<http://p.thorsen.pm/mojopastedemo?embed=text>
63  
64 Show the paste without any margin/padding and no menu.
65  
66 =item * L<http://p.thorsen.pm/mojopastedemo/chart?embed=graph>
67  
68 Show only the graph data.
69  
70 =item * L<http://p.thorsen.pm/mojopastedemo/chart?embed=graph,heading,description>
71  
72 Show the graph data, heading and description, but no menus.
73  
74 =back
75  
76 =head1 DEMO
77  
78 You can try mojopaste here: L<http://p.thorsen.pm>.
79  
80 =head1 INSTALLATION
81  
82 Install system wide with cpanm:
83  
84 $ cpanm --sudo App::mojopaste
85  
86 Don't have cpanm installed?
87  
88 $ curl -L http://cpanmin.us | perl - --sudo App::mojopaste
89 $ wget http://cpanmin.us -O - | perl - --sudo App::mojopaste
90  
91 It is also possible to install L<App::mojopaste> using Docker. Check out
92 L<https://hub.docker.com/r/jhthorsen/mojopaste> for more information.
93  
94 =head1 SYNOPSIS
95  
96 =over 2
97  
98 =item * Simple single process daemon
99  
100 $ mojopaste daemon --listen http://*:8080
101  
102 =item * Save paste to custom dir
103  
104 $ PASTE_DIR=/path/to/paste/dir mojopaste daemon --listen http://*:8080
105  
106 =item * Using the UNIX optimized, preforking hypnotoad web server
107  
108 $ MOJO_CONFIG=/path/to/mojopaste.conf hypnotoad $(which mojopaste)
109  
110 Example mojopaste.conf:
111  
112 {
113 brand_link => "index",
114 brand_logo => "/images/logo.png",
115 brand_text => "Mojopaste",
116 paste_dir => "/path/to/paste/dir",
117 enable_charts => 1, # default is 0
118 hypnotoad => {
119 listen => ["http://*:8080"],
120 },
121 }
122  
123 "enable_charts" is for adding a button which can make a chart of the input
124 data using L<morris.js|http://morrisjs.github.io/morris.js>
125  
126 Check out L<Mojo::Server::Hypnotoad> for more hypnotoad options.
127  
128 =back
129  
130 =head1 OTHER PASTEBINS
131  
132 =over 2
133  
134 =item * L<http://paste.scsys.co.uk>
135  
136 =item * L<http://paste.ubuntu.com>
137  
138 =item * L<http://pastebin.com>
139  
140 =back
141  
142 =head1 AUTHOR
143  
144 Jan Henning Thorsen - C<jhthorsen@cpan.org>
145  
146 =cut