]>
jfr.im git - z_archive/shellstuff.git/blob - paste2
4 # (sh) paste2 perl Paste2 CLI script <paste2.pl
5 # (vim) :w !paste2 perl Paste2 CLI script
12 $lang = (shift or 'text');
14 $desc = join ' ', @ARGV;
25 'lang='.uri_escape
($lang),
26 'description='.uri_escape
($desc),
27 'code='.uri_escape
($code),
30 my $cont = join('&', @fields)."\r\n";
31 my $len = length($cont);
33 my $s = IO
::Socket
::INET-
>new('paste2.org:80');
35 $out .= "POST /new-paste HTTP/1.1\r\n";
36 $out .= "Host: paste2.org\r\n";
37 $out .= "User-Agent: Paster/1.0\r\n";
38 $out .= "Content-Type: application/x-www-form-urlencoded\r\n";
39 $out .= "Content-Length: $len\r\n";
40 $out .= "Connection: Close\r\n";
47 if (s/^Location: //) {
48 print "http://paste2.org".$_;