ARGV::URL - Wrap URLs from @ARGV for fetching and content consumption with <>
From one-liners:
perl -MARGV::URL -E "... <> ... " $file_or_url ... perl -MARGV::URL -nE "..." $file_or_uri ... perl -MARGV::URL -pE "..." $file_or_url ...
From a script:
use ARG::URL; ... while (<>) { ...
From a script that takes command-line options that should not be processed by ARGV::URL :
ARGV::URL
# Skipping import use ARGV::URL (); ... extract options from @ARGV ... # Prepare URLs: do import now ARGV::URL->import;
This module adds some power to the diamond (<>) operator (see perlopentut): importing the module will transform URLs in @ARGV so that their content is fetched and fed to <> like what is done for filenames in the standard behavior.
@ARGV
Note: implementation details are specific to this release and may change in a later release.
Have a look at the code: this is a 3-lines module.
Fetching URLs is done using the following command:
lwp-request -m GET "$url"
About the diamond operator (<>): "Filters" in perlopentut, "I/O Operators" in perlop
<
Some other modules that adds magic to @ARGV: ARGV::readonly, Encode::Argv
Olivier Mengué, mailto:dolmen@cpan.org.
Copyright © 2011 Olivier Mengué.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.
To install ARGV::URL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ARGV::URL
CPAN shell
perl -MCPAN -e shell install ARGV::URL
For more information on module installation, please visit the detailed CPAN module installation guide.