Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
What is happening with the subs here?

They are used by the code in the sub http_online as $check, where first $_ is set to the content fetched from the URL, and then the sub is called, and its return value used as a boolean. Although the subs you see here could be done by precompiled regexes (qr//), a sub allows for much more flexibility, a simple example being the sub { /Amazon/ and /Cart/ } case.

LWP::Simple. Is this a core module?

No, as you can find out with the corelist command:

$ corelist LWP::Simple ... LWP::Simple was not in CORE (or so I think)

However, the module's distribution, libwww-perl, is quite often used by scripts, so that e.g. Strawberry Perl includes it, and it's fairly common to find it already installed alongside Perl on many *NIX systems.

In this snippet from LWP::Online, how does it import a lexical variable?

Just to nitpick, it's not a lexical variable, it's a package variable. They can be exported/imported just like subs, e.g. Exporter supports this.


In reply to Re^3: writing a utility to determine whether I have a working wifi connection by haukex
in thread writing a utility to determine whether I have a working wifi connection by Aldebaran

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 having a coffee break in the Monastery: (8)
As of 2024-04-19 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found