in reply to Re^2: writing a utility to determine whether I have a working wifi connection
in thread writing a utility to determine whether I have a working wifi connection
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.
|
---|