Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Presentation: Intro to Perl and LWP

by hossman (Prior)
on Mar 02, 2005 at 00:10 UTC ( #435663=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    Perl & LWP
    HTTP Connections In Perl
    
  2. or download this
    What is HTTP?
    
    ...
    Expires: Fri, 04 Feb 2005 00:43:02 GMT
    ...
    <html>
    
  3. or download this
    LWP is easy to use
    
    ...
    } else {
        print $response->status_line, " <URL:$url>\n";
    }
    
  4. or download this
    LWP::Simple is even easier
    
    ...
    use LWP::Simple;
    
    getprint('http://www.cnet.com/bogus/');
    
  5. or download this
    First, a Perl refresher
    
    ...
    if ($bar->[1]) {                 # "if" and "print" work the way you t
    +hink
      print "$first is true\n";      # Double quotes evaluate variables
    }                                #   ... prints: Hoss is true
    
  6. or download this
    More fun with LWP::Simple
    
    ...
    
    my ($type, $length, $mod, $exp, $server) = head('http://news.com');
    print "Content Type is $type, and the Server is $server\n";
    
  7. or download this
    LWP::UserAgent is more "full featured"
    
    ...
                              {'descr'     => 'your bug description',
                               'component' => 'your bug component',
                               'priority'  => 'P1' });
    
  8. or download this
    HTTP::Request & HTTP::Response
    
    ...
    while ($res = $res->previous()) {
        print "Redirected from: ", $res->request()->uri(), "\n";
    }
    
  9. or download this
    Previous script's output
    
    ...
    The URL was: http://builder.com.com/
    Redirected from: http://builder.cnet.com/webbuilding/pages/foo
    Redirected from: http://builder.com/foo
    
  10. or download this
    Other cool features worth looking at
    
    ...
     * Read/write cookies from disk (in Mozilla or Microsoft formats)
     * Parse/Submit forms auto-magically
     * LWP:RobotUA, LWP::Parallel::UserAgent, LWP::UserAgent::FramesReady
    
  11. or download this
    One caveat to LWP::Simple
    
    ...
    my $data = get('http://cnet.com/bogus/');
    
    # http://www.perlmonks.org/?node=412544
    
  12. or download this
    More Info
    
    ...
    http://search.cpan.org/search?query=LWP
    
    http://search.cpan.org/dist/WWW-Mechanize/
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://435663]
Approved by davidj
Front-paged by ybiC
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2014-09-21 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (165 votes), past polls