tommyelse has asked for the wisdom of the Perl Monks concerning the following question:

I know how to download image files to my hard drive using the Image::Grab module. However, is there a module that downloads text files off a web server and then converts them into html?

Replies are listed 'Best First'.
Re: Downloading text files
by kutsu (Priest) on Apr 15, 2005 at 19:52 UTC

    You could use several modules to "download" the text WWW::Mechanize, LWP, or LWP::Simple. If it's only grabbing the text file something as simple as perl -MLWP::Simple -e "getprint 'http://www.perlmonks.com?node_id=448323'" > somefile.txt should work on the commandline (or similar using WWW::Mechanize though I can't think of it off the top of my head). Then search CPAN for converting text to html (text2html or HTML::FromText come to mind).

    "Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

Re: Downloading text files
by dragonchild (Archbishop) on Apr 15, 2005 at 19:48 UTC
Re: Downloading text files
by davidrw (Prior) on Apr 15, 2005 at 19:51 UTC
    LWP::Simple will provide an easy way to grab them (and images as well, if you want to use a single mechanism). As for converting to html, do you have a sample of the text and desired output?
      Thanks for getting back to me. Here is a sample of what I want to download: http://www.srh.noaa.gov/data/PHI/CFWPHI What I want to do is save the file to my computer and then retrieve it later on using Internet Explorer. Is there a way I can take the file and save it as an html file?
        Ah, weather data.. IE can read .txt files just fine, so if you want it as-is, can just save as .txt locally somewhere. You might also look at something like (or search for others) Geo::WeatherNOAA to do the work of getting and parsing the data for you -- then you can create whatever formatted output you like.