why this instead of use LWP; ?

You could actually use LWP; as the LWP module goes ahead and require()s the LWP::UserAgent module for you. But, the functionality you want is provided by the LWP::UserAgent module so you might as well use it directly.

what's happening here?, in particular, who are the functions, who are the arguments and who are the results?

The function being called is the new() funtion in the LWP::UserAgent class. It returns an LWP::UserAgent object which is then stored in $ua.

what is agent("...") and why is it needed?

That sets the user-agent header that the server gets when you make a request. The server can be configured to do behave differently based on the content of this header. You should probably use it to identify your program, but other uses would include emulating another browser like Mozilla or IE.

The docs, which should be accessible via man LWP::UserAgent or perldoc LWP::UsesrAgent will come in handy. You'll probably also want to read perldoc HTTP::Request and perldoc HTTP::Response as soon as possible. Good luck.

-sauoq
"My two cents aren't worth a dime.";

In reply to Re: Re: Re: PERL HTTP posts. by sauoq
in thread PERL HTTP posts. by xode

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.