File Coverage

blib/lib/App/Nopaste/Service/Ubuntu.pm
Criterion Covered Total %
statement 10 22 45.4
branch 0 6 0.0
condition n/a
subroutine 4 6 66.6
pod 3 3 100.0
total 17 37 45.9


line stmt bran cond sub pod time code
1 1     1   66164 use strict;
  1         14  
  1         29  
2 1     1   6 use warnings;
  1         6  
  1         53  
3             package App::Nopaste::Service::Ubuntu;
4             # ABSTRACT: Service provider for Ubuntu - https://paste.ubuntu.com/
5              
6             our $VERSION = '1.013';
7              
8 1     1   462 use parent 'App::Nopaste::Service';
  1         294  
  1         5  
9              
10             my $languages = {
11             "Plain Text" => "text",
12             "Gherkin" => "Cucumber",
13             "ABAP" => "abap",
14             "Ada" => "ada",
15             "autohotkey" => "ahk",
16             "ANTLR" => "antlr",
17             "ANTLR With ActionScript Target" => "antlr-as",
18             "ANTLR With CPP Target" => "antlr-cpp",
19             "ANTLR With C# Target" => "antlr-csharp",
20             "ANTLR With Java Target" => "antlr-java",
21             "ANTLR With ObjectiveC Target" => "antlr-objc",
22             "ANTLR With Perl Target" => "antlr-perl",
23             "ANTLR With Python Target" => "antlr-python",
24             "ANTLR With Ruby Target" => "antlr-ruby",
25             "ApacheConf" => "apacheconf",
26             "AppleScript" => "applescript",
27             "ActionScript" => "as",
28             "ActionScript 3" => "as3",
29             "aspx-cs" => "aspx-cs",
30             "aspx-vb" => "aspx-vb",
31             "Asymptote" => "asy",
32             "Makefile" => "basemake",
33             "Bash" => "bash",
34             "Batchfile" => "bat",
35             "BBCode" => "bbcode",
36             "Befunge" => "befunge",
37             "BlitzMax" => "blitzmax",
38             "Boo" => "boo",
39             "C" => "c",
40             "c-objdump" => "c-objdump",
41             "Coldfusion HTML" => "cfm",
42             "cfstatement" => "cfs",
43             "Cheetah" => "cheetah",
44             "Clojure" => "clojure",
45             "CMake" => "cmake",
46             "CoffeeScript" => "coffee-script",
47             "Common Lisp" => "common-lisp",
48             "Bash Session" => "console",
49             "Debian Control file" => "control",
50             "C++" => "cpp",
51             "cpp-objdump" => "cpp-objdump",
52             "C#" => "csharp",
53             "CSS" => "css",
54             "CSS+Django/Jinja" => "css+django",
55             "CSS+Ruby" => "css+erb",
56             "CSS+Genshi Text" => "css+genshitext",
57             "CSS+Mako" => "css+mako",
58             "CSS+Myghty" => "css+myghty",
59             "CSS+PHP" => "css+php",
60             "CSS+Smarty" => "css+smarty",
61             "Cython" => "cython",
62             "D" => "d",
63             "d-objdump" => "d-objdump",
64             "Delphi" => "delphi",
65             "Diff" => "diff",
66             "Django/Jinja" => "django",
67             "Darcs Patch" => "dpatch",
68             "Duel" => "duel",
69             "Dylan" => "dylan",
70             "ERB" => "erb",
71             "Erlang erl session" => "erl",
72             "Erlang" => "erlang",
73             "Evoque" => "evoque",
74             "Factor" => "factor",
75             "Felix" => "felix",
76             "Fortran" => "fortran",
77             "GAS" => "gas",
78             "Genshi" => "genshi",
79             "Genshi Text" => "genshitext",
80             "GLSL" => "glsl",
81             "Gnuplot" => "gnuplot",
82             "Go" => "go",
83             "GoodData-CL" => "gooddata-cl",
84             "Groff" => "groff",
85             "Haml" => "haml",
86             "Haskell" => "haskell",
87             "HTML" => "html",
88             "HTML+Cheetah" => "html+cheetah",
89             "HTML+Django/Jinja" => "html+django",
90             "HTML+Evoque" => "html+evoque",
91             "HTML+Genshi" => "html+genshi",
92             "HTML+Mako" => "html+mako",
93             "HTML+Myghty" => "html+myghty",
94             "HTML+PHP" => "html+php",
95             "HTML+Smarty" => "html+smarty",
96             "HTML+Velocity" => "html+velocity",
97             "haXe" => "hx",
98             "Hybris" => "hybris",
99             "INI" => "ini",
100             "Io" => "io",
101             "Ioke" => "ioke",
102             "IRC logs" => "irc",
103             "Jade" => "jade",
104             "Java" => "java",
105             "JavaScript" => "js",
106             "JavaScript+Cheetah" => "js+cheetah",
107             "JavaScript+Django/Jinja" => "js+django",
108             "JavaScript+Ruby" => "js+erb",
109             "JavaScript+Genshi Text" => "js+genshitext",
110             "JavaScript+Mako" => "js+mako",
111             "JavaScript+Myghty" => "js+myghty",
112             "JavaScript+PHP" => "js+php",
113             "JavaScript+Smarty" => "js+smarty",
114             "Java Server Page" => "jsp",
115             "Literate Haskell" => "lhs",
116             "Lighttpd configuration file" => "lighty",
117             "LLVM" => "llvm",
118             "Logtalk" => "logtalk",
119             "Lua" => "lua",
120             "Makefile" => "make",
121             "Mako" => "mako",
122             "MAQL" => "maql",
123             "Mason" => "mason",
124             "Matlab" => "matlab",
125             "Matlab session" => "matlabsession",
126             "MiniD" => "minid",
127             "Modelica" => "modelica",
128             "Modula-2" => "modula2",
129             "MOOCode" => "moocode",
130             "MuPAD" => "mupad",
131             "MXML" => "mxml",
132             "Myghty" => "myghty",
133             "MySQL" => "mysql",
134             "NASM" => "nasm",
135             "Newspeak" => "newspeak",
136             "Nginx configuration file" => "nginx",
137             "NumPy" => "numpy",
138             "objdump" => "objdump",
139             "Objective-C" => "objective-c",
140             "Objective-J" => "objective-j",
141             "OCaml" => "ocaml",
142             "Ooc" => "ooc",
143             "Perl" => "perl",
144             "PHP" => "php",
145             "PostScript" => "postscript",
146             "Gettext Catalog" => "pot",
147             "POVRay" => "pov",
148             "Prolog" => "prolog",
149             "Properties" => "properties",
150             "Protocol Buffer" => "protobuf",
151             "Python 3.0 Traceback" => "py3tb",
152             "Python console session" => "pycon",
153             "Python Traceback" => "pytb",
154             "Python" => "python",
155             "Python 3" => "python3",
156             "Ragel" => "ragel",
157             "Ragel in C Host" => "ragel-c",
158             "Ragel in CPP Host" => "ragel-cpp",
159             "Ragel in D Host" => "ragel-d",
160             "Embedded Ragel" => "ragel-em",
161             "Ragel in Java Host" => "ragel-java",
162             "Ragel in Objective C Host" => "ragel-objc",
163             "Ragel in Ruby Host" => "ragel-ruby",
164             "Raw token data" => "raw",
165             "Ruby" => "rb",
166             "Ruby irb session" => "rbcon",
167             "RConsole" => "rconsole",
168             "REBOL" => "rebol",
169             "Redcode" => "redcode",
170             "RHTML" => "rhtml",
171             "reStructuredText" => "rst",
172             "Sass" => "sass",
173             "Scala" => "scala",
174             "Scaml" => "scaml",
175             "Scheme" => "scheme",
176             "SCSS" => "scss",
177             "Smalltalk" => "smalltalk",
178             "Smarty" => "smarty",
179             "Debian Sourcelist" => "sourceslist",
180             "S" => "splus",
181             "SQL" => "sql",
182             "sqlite3con" => "sqlite3",
183             "SquidConf" => "squidconf",
184             "Scalate Server Page" => "ssp",
185             "Tcl" => "tcl",
186             "Tcsh" => "tcsh",
187             "TeX" => "tex",
188             "Text only" => "text",
189             "MoinMoin/Trac Wiki markup" => "trac-wiki",
190             "verilog" => "v",
191             "Vala" => "vala",
192             "VB.net" => "vb.net",
193             "Velocity" => "velocity",
194             "VimL" => "vim",
195             "XML" => "xml",
196             "XML+Cheetah" => "xml+cheetah",
197             "XML+Django/Jinja" => "xml+django",
198             "XML+Ruby" => "xml+erb",
199             "XML+Evoque" => "xml+evoque",
200             "XML+Mako" => "xml+mako",
201             "XML+Myghty" => "xml+myghty",
202             "XML+PHP" => "xml+php",
203             "XML+Smarty" => "xml+smarty",
204             "XML+Velocity" => "xml+velocity",
205             "XQuery" => "xquery",
206             "XSLT" => "xslt",
207             "YAML" => "yaml",
208             };
209              
210 1     1 1 122 sub uri { "https://paste.ubuntu.com/" }
211              
212             sub fill_form {
213 0     0 1   my $self = shift;
214 0           my $mech = shift;
215 0           my %args = @_;
216 0 0         my $lang = $languages->{$args{lang}} if $args{lang};
217              
218 0           $mech->form_number(1);
219             $mech->submit_form(
220             fields => {
221             content => $args{text},
222 0 0         do { $args{nick} ? (poster => $args{nick}) : () },
223 0 0         do { $lang ? (syntax => $lang) : () },
  0            
224             },
225             );
226             }
227              
228             sub return {
229 0     0 1   my $self = shift;
230 0           my $mech = shift;
231              
232 0           my $link = $mech->uri();
233              
234 0           return (1, $link);
235             }
236              
237             1;
238              
239             __END__