line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Command::nopaste::Service::ubuntu; |
2
|
1
|
|
|
1
|
|
700
|
use Mojo::Base 'Mojolicious::Command::nopaste::Service'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has description => "Post to paste.ubuntu.com\n"; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has name => 'anonymous'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %languages = ( |
9
|
|
|
|
|
|
|
"text" => 1, |
10
|
|
|
|
|
|
|
"Cucumber" => 1, |
11
|
|
|
|
|
|
|
"abap" => 1, |
12
|
|
|
|
|
|
|
"ada" => 1, |
13
|
|
|
|
|
|
|
"ahk" => 1, |
14
|
|
|
|
|
|
|
"antlr" => 1, |
15
|
|
|
|
|
|
|
"antlr-as" => 1, |
16
|
|
|
|
|
|
|
"antlr-cpp" => 1, |
17
|
|
|
|
|
|
|
"antlr-csharp" => 1, |
18
|
|
|
|
|
|
|
"antlr-java" => 1, |
19
|
|
|
|
|
|
|
"antlr-objc" => 1, |
20
|
|
|
|
|
|
|
"antlr-perl" => 1, |
21
|
|
|
|
|
|
|
"antlr-python" => 1, |
22
|
|
|
|
|
|
|
"antlr-ruby" => 1, |
23
|
|
|
|
|
|
|
"apacheconf" => 1, |
24
|
|
|
|
|
|
|
"applescript" => 1, |
25
|
|
|
|
|
|
|
"as" => 1, |
26
|
|
|
|
|
|
|
"as3" => 1, |
27
|
|
|
|
|
|
|
"aspx-cs" => 1, |
28
|
|
|
|
|
|
|
"aspx-vb" => 1, |
29
|
|
|
|
|
|
|
"asy" => 1, |
30
|
|
|
|
|
|
|
"basemake" => 1, |
31
|
|
|
|
|
|
|
"bash" => 1, |
32
|
|
|
|
|
|
|
"bat" => 1, |
33
|
|
|
|
|
|
|
"bbcode" => 1, |
34
|
|
|
|
|
|
|
"befunge" => 1, |
35
|
|
|
|
|
|
|
"blitzmax" => 1, |
36
|
|
|
|
|
|
|
"boo" => 1, |
37
|
|
|
|
|
|
|
"c" => 1, |
38
|
|
|
|
|
|
|
"c-objdump" => 1, |
39
|
|
|
|
|
|
|
"cfm" => 1, |
40
|
|
|
|
|
|
|
"cfs" => 1, |
41
|
|
|
|
|
|
|
"cheetah" => 1, |
42
|
|
|
|
|
|
|
"clojure" => 1, |
43
|
|
|
|
|
|
|
"cmake" => 1, |
44
|
|
|
|
|
|
|
"coffee-script" => 1, |
45
|
|
|
|
|
|
|
"common-lisp" => 1, |
46
|
|
|
|
|
|
|
"console" => 1, |
47
|
|
|
|
|
|
|
"control" => 1, |
48
|
|
|
|
|
|
|
"cpp" => 1, |
49
|
|
|
|
|
|
|
"cpp-objdump" => 1, |
50
|
|
|
|
|
|
|
"csharp" => 1, |
51
|
|
|
|
|
|
|
"css" => 1, |
52
|
|
|
|
|
|
|
"css+django" => 1, |
53
|
|
|
|
|
|
|
"css+erb" => 1, |
54
|
|
|
|
|
|
|
"css+genshitext" => 1, |
55
|
|
|
|
|
|
|
"css+mako" => 1, |
56
|
|
|
|
|
|
|
"css+myghty" => 1, |
57
|
|
|
|
|
|
|
"css+php" => 1, |
58
|
|
|
|
|
|
|
"css+smarty" => 1, |
59
|
|
|
|
|
|
|
"cython" => 1, |
60
|
|
|
|
|
|
|
"d" => 1, |
61
|
|
|
|
|
|
|
"d-objdump" => 1, |
62
|
|
|
|
|
|
|
"delphi" => 1, |
63
|
|
|
|
|
|
|
"diff" => 1, |
64
|
|
|
|
|
|
|
"django" => 1, |
65
|
|
|
|
|
|
|
"dpatch" => 1, |
66
|
|
|
|
|
|
|
"duel" => 1, |
67
|
|
|
|
|
|
|
"dylan" => 1, |
68
|
|
|
|
|
|
|
"erb" => 1, |
69
|
|
|
|
|
|
|
"erl" => 1, |
70
|
|
|
|
|
|
|
"erlang" => 1, |
71
|
|
|
|
|
|
|
"evoque" => 1, |
72
|
|
|
|
|
|
|
"factor" => 1, |
73
|
|
|
|
|
|
|
"felix" => 1, |
74
|
|
|
|
|
|
|
"fortran" => 1, |
75
|
|
|
|
|
|
|
"gas" => 1, |
76
|
|
|
|
|
|
|
"genshi" => 1, |
77
|
|
|
|
|
|
|
"genshitext" => 1, |
78
|
|
|
|
|
|
|
"glsl" => 1, |
79
|
|
|
|
|
|
|
"gnuplot" => 1, |
80
|
|
|
|
|
|
|
"go" => 1, |
81
|
|
|
|
|
|
|
"gooddata-cl" => 1, |
82
|
|
|
|
|
|
|
"groff" => 1, |
83
|
|
|
|
|
|
|
"haml" => 1, |
84
|
|
|
|
|
|
|
"haskell" => 1, |
85
|
|
|
|
|
|
|
"html" => 1, |
86
|
|
|
|
|
|
|
"html+cheetah" => 1, |
87
|
|
|
|
|
|
|
"html+django" => 1, |
88
|
|
|
|
|
|
|
"html+evoque" => 1, |
89
|
|
|
|
|
|
|
"html+genshi" => 1, |
90
|
|
|
|
|
|
|
"html+mako" => 1, |
91
|
|
|
|
|
|
|
"html+myghty" => 1, |
92
|
|
|
|
|
|
|
"html+php" => 1, |
93
|
|
|
|
|
|
|
"html+smarty" => 1, |
94
|
|
|
|
|
|
|
"html+velocity" => 1, |
95
|
|
|
|
|
|
|
"hx" => 1, |
96
|
|
|
|
|
|
|
"hybris" => 1, |
97
|
|
|
|
|
|
|
"ini" => 1, |
98
|
|
|
|
|
|
|
"io" => 1, |
99
|
|
|
|
|
|
|
"ioke" => 1, |
100
|
|
|
|
|
|
|
"irc" => 1, |
101
|
|
|
|
|
|
|
"jade" => 1, |
102
|
|
|
|
|
|
|
"java" => 1, |
103
|
|
|
|
|
|
|
"js" => 1, |
104
|
|
|
|
|
|
|
"js+cheetah" => 1, |
105
|
|
|
|
|
|
|
"js+django" => 1, |
106
|
|
|
|
|
|
|
"js+erb" => 1, |
107
|
|
|
|
|
|
|
"js+genshitext" => 1, |
108
|
|
|
|
|
|
|
"js+mako" => 1, |
109
|
|
|
|
|
|
|
"js+myghty" => 1, |
110
|
|
|
|
|
|
|
"js+php" => 1, |
111
|
|
|
|
|
|
|
"js+smarty" => 1, |
112
|
|
|
|
|
|
|
"jsp" => 1, |
113
|
|
|
|
|
|
|
"lhs" => 1, |
114
|
|
|
|
|
|
|
"lighty" => 1, |
115
|
|
|
|
|
|
|
"llvm" => 1, |
116
|
|
|
|
|
|
|
"logtalk" => 1, |
117
|
|
|
|
|
|
|
"lua" => 1, |
118
|
|
|
|
|
|
|
"make" => 1, |
119
|
|
|
|
|
|
|
"mako" => 1, |
120
|
|
|
|
|
|
|
"maql" => 1, |
121
|
|
|
|
|
|
|
"mason" => 1, |
122
|
|
|
|
|
|
|
"matlab" => 1, |
123
|
|
|
|
|
|
|
"matlabsession" => 1, |
124
|
|
|
|
|
|
|
"minid" => 1, |
125
|
|
|
|
|
|
|
"modelica" => 1, |
126
|
|
|
|
|
|
|
"modula2" => 1, |
127
|
|
|
|
|
|
|
"moocode" => 1, |
128
|
|
|
|
|
|
|
"mupad" => 1, |
129
|
|
|
|
|
|
|
"mxml" => 1, |
130
|
|
|
|
|
|
|
"myghty" => 1, |
131
|
|
|
|
|
|
|
"mysql" => 1, |
132
|
|
|
|
|
|
|
"nasm" => 1, |
133
|
|
|
|
|
|
|
"newspeak" => 1, |
134
|
|
|
|
|
|
|
"nginx" => 1, |
135
|
|
|
|
|
|
|
"numpy" => 1, |
136
|
|
|
|
|
|
|
"objdump" => 1, |
137
|
|
|
|
|
|
|
"objective-c" => 1, |
138
|
|
|
|
|
|
|
"objective-j" => 1, |
139
|
|
|
|
|
|
|
"ocaml" => 1, |
140
|
|
|
|
|
|
|
"ooc" => 1, |
141
|
|
|
|
|
|
|
"perl" => 1, |
142
|
|
|
|
|
|
|
"php" => 1, |
143
|
|
|
|
|
|
|
"postscript" => 1, |
144
|
|
|
|
|
|
|
"pot" => 1, |
145
|
|
|
|
|
|
|
"pov" => 1, |
146
|
|
|
|
|
|
|
"prolog" => 1, |
147
|
|
|
|
|
|
|
"properties" => 1, |
148
|
|
|
|
|
|
|
"protobuf" => 1, |
149
|
|
|
|
|
|
|
"py3tb" => 1, |
150
|
|
|
|
|
|
|
"pycon" => 1, |
151
|
|
|
|
|
|
|
"pytb" => 1, |
152
|
|
|
|
|
|
|
"python" => 1, |
153
|
|
|
|
|
|
|
"python3" => 1, |
154
|
|
|
|
|
|
|
"ragel" => 1, |
155
|
|
|
|
|
|
|
"ragel-c" => 1, |
156
|
|
|
|
|
|
|
"ragel-cpp" => 1, |
157
|
|
|
|
|
|
|
"ragel-d" => 1, |
158
|
|
|
|
|
|
|
"ragel-em" => 1, |
159
|
|
|
|
|
|
|
"ragel-java" => 1, |
160
|
|
|
|
|
|
|
"ragel-objc" => 1, |
161
|
|
|
|
|
|
|
"ragel-ruby" => 1, |
162
|
|
|
|
|
|
|
"raw" => 1, |
163
|
|
|
|
|
|
|
"rb" => 1, |
164
|
|
|
|
|
|
|
"rbcon" => 1, |
165
|
|
|
|
|
|
|
"rconsole" => 1, |
166
|
|
|
|
|
|
|
"rebol" => 1, |
167
|
|
|
|
|
|
|
"redcode" => 1, |
168
|
|
|
|
|
|
|
"rhtml" => 1, |
169
|
|
|
|
|
|
|
"rst" => 1, |
170
|
|
|
|
|
|
|
"sass" => 1, |
171
|
|
|
|
|
|
|
"scala" => 1, |
172
|
|
|
|
|
|
|
"scaml" => 1, |
173
|
|
|
|
|
|
|
"scheme" => 1, |
174
|
|
|
|
|
|
|
"scss" => 1, |
175
|
|
|
|
|
|
|
"smalltalk" => 1, |
176
|
|
|
|
|
|
|
"smarty" => 1, |
177
|
|
|
|
|
|
|
"sourceslist" => 1, |
178
|
|
|
|
|
|
|
"splus" => 1, |
179
|
|
|
|
|
|
|
"sql" => 1, |
180
|
|
|
|
|
|
|
"sqlite3" => 1, |
181
|
|
|
|
|
|
|
"squidconf" => 1, |
182
|
|
|
|
|
|
|
"ssp" => 1, |
183
|
|
|
|
|
|
|
"tcl" => 1, |
184
|
|
|
|
|
|
|
"tcsh" => 1, |
185
|
|
|
|
|
|
|
"tex" => 1, |
186
|
|
|
|
|
|
|
"text" => 1, |
187
|
|
|
|
|
|
|
"trac-wiki" => 1, |
188
|
|
|
|
|
|
|
"v" => 1, |
189
|
|
|
|
|
|
|
"vala" => 1, |
190
|
|
|
|
|
|
|
"vb.net" => 1, |
191
|
|
|
|
|
|
|
"velocity" => 1, |
192
|
|
|
|
|
|
|
"vim" => 1, |
193
|
|
|
|
|
|
|
"xml" => 1, |
194
|
|
|
|
|
|
|
"xml+cheetah" => 1, |
195
|
|
|
|
|
|
|
"xml+django" => 1, |
196
|
|
|
|
|
|
|
"xml+erb" => 1, |
197
|
|
|
|
|
|
|
"xml+evoque" => 1, |
198
|
|
|
|
|
|
|
"xml+mako" => 1, |
199
|
|
|
|
|
|
|
"xml+myghty" => 1, |
200
|
|
|
|
|
|
|
"xml+php" => 1, |
201
|
|
|
|
|
|
|
"xml+smarty" => 1, |
202
|
|
|
|
|
|
|
"xml+velocity" => 1, |
203
|
|
|
|
|
|
|
"xquery" => 1, |
204
|
|
|
|
|
|
|
"xslt" => 1, |
205
|
|
|
|
|
|
|
"yaml" => 1, |
206
|
|
|
|
|
|
|
); |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub paste { |
209
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
210
|
0
|
0
|
|
|
|
|
my $lang = exists $languages{$self->language} ? $self->language : 'text'; |
211
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
my $tx = $self->ua->post( 'http://paste.ubuntu.com', form => { |
213
|
|
|
|
|
|
|
content => $self->text, |
214
|
|
|
|
|
|
|
poster => $self->name, |
215
|
|
|
|
|
|
|
syntax => $lang, |
216
|
|
|
|
|
|
|
}); |
217
|
|
|
|
|
|
|
|
218
|
0
|
0
|
|
|
|
|
unless ($tx->res->is_success) { |
219
|
0
|
|
|
|
|
|
say $tx->res->message; |
220
|
0
|
|
|
|
|
|
say $tx->res->body; |
221
|
0
|
|
|
|
|
|
exit 1; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
return $tx->req->url; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
1; |
228
|
|
|
|
|
|
|
|