Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-19 20:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found