Re: From bash to perl
by BUU (Prior) on Nov 08, 2006 at 01:57 UTC
|
You probably want LWP::Simple from the LWP distribution. LWP::Simple will export a function named "get" that takes a URI as an argument and returns the contents of that URI.
As for modules in general, you should always be searching cpan at http://search.cpan.org. | [reply] |
|
|
Thanks I'll check into that. I've actually used that function once before but it was for sending data to a URI. I didn't know that it could be used the other way around, nifty.
| [reply] |
Re: From bash to perl
by GrandFather (Saint) on Nov 08, 2006 at 02:05 UTC
|
You probably want to start with LWP to solve your ultimate problem, but take a trawl through the Tutorials section here first to get some of the background info. In particular yuou may find the Installing Modules section helpful.
Perl has pretty good documentation available using perldoc docname. perl (perldoc perl) provides a list of the documents available.
DWIM is Perl's answer to Gödel
| [reply] [d/l] [select] |
|
|
I was poking around the tutorials a little earlier today. I think I was there with the wrong mind set though, as I was looking for an answer, more then information. I should probably take another look, just looking for more general stuff.
I'll check into perldoc as well. Thank you.
| [reply] |
Re: From bash to perl
by jwkrahn (Abbot) on Nov 08, 2006 at 02:06 UTC
|
| [reply] |
|
|
Thank you for the cookbook link.
| [reply] |
|
|
You can also run it on the command line on any computer that has a working perl installation:
[~]$ perldoc lwpcook
or
C:\>perldoc lwpcook
--
Regards,
Helgi Briem
hbriem AT f-prot DOT com
| [reply] [d/l] [select] |
Re: From bash to perl
by graff (Chancellor) on Nov 08, 2006 at 03:00 UTC
|
I use wget to download the file at the end of the URL (a web page) and write it to a file, then I open the file and read through it with a while loop one line at a time.
Next time, show us some of your code -- it's just better that way.
So you'll start using LWP or LWP::Simple (and I'm not surprised you didn't find them... I still have trouble remembering how these module names relate to their function, let alone what "LWP" actually stands for).
After that, the next thing you'll want to get acquainted with is the more appropriately named HTML::Parser. This will help tremendously in doing a proper job of whatever it is you are trying to do with the web pages that you are downloading -- and you won't even need to store the html data to a file first (though you probably want to do that anyway), because HTML::Parser can work directly on the scalar variable that holds the full content of the page (after LWP assigns the fetched web-page content to that variable). Good luck. | [reply] |
|
|
I still have trouble remembering how these module names relate to their function, let alone what "LWP" actually stands for
LWP stands for libwww-perl, the second word mentioned in the DESCRIPTION section of the LWP manual page.
| [reply] |
Re: From bash to perl
by fenLisesi (Priest) on Nov 08, 2006 at 07:47 UTC
|
| [reply] |
Re: From bash to perl
by Khen1950fx (Canon) on Nov 08, 2006 at 06:00 UTC
|
I think that WWW-PkgFind might help you.
To quote the docs: "package_retriever scans a web or ftp site for newly posted files and downloads them to a local filesystem. It then prints out the file names of the files it downloads to stdout, suitable for passing to other tools in a pipe". Also, it'll create subdirectories; it uses regular expressions to find "wanted" or "unwanted" files; it can rename packages after download, etc. | [reply] |