File: test.pl

package info (click to toggle)
flexml 1-5
  • links: PTS
  • area: main
  • in suites: potato, woody
  • size: 884 kB
  • ctags: 203
  • sloc: perl: 2,016; makefile: 160; ansic: 56; xml: 28
file content (20 lines) | stat: -rwxr-xr-x 566 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl -w

         # Create a user agent object
         use LWP::UserAgent;
         $ua = new LWP::UserAgent;
         $ua->agent("Test/0.1 " . $ua->agent);

         # Create a request
         my $req = new HTTP::Request GET => 'file:test.pl';

         # Pass request to the user agent and get a response back
         my $res = $ua->request($req);

         # Check the outcome of the response
         if ($res->is_success) {
             print "Contents:\n" . $res->content;
         } else {
             print "Bad luck this time\n";
         }