Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > wget Question

Reply
Thread Tools

wget Question

 
 
Eric Schwartz
Guest
Posts: n/a
 
      01-18-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:
> Real Perl programmers use real Perl functions and modules, and they
> resort to shell commands only when absolutely necessary (which is
> generally rare - I haven't used a raw shell command from Perl in three
> years).


Abigail will likely be around shortly, but in case I beat him to the
punch: Real Perl programmers use whatever bits of Perl are appropriate
to the task. Perl is a very nice glue language, and in many cases
it's clearer and simpler to perform a task using the OS's native tools
than Perl's. Perl also has a number of modules that are not always
the easiest way to do things, though they trend towards more
portability.

Case in point, and this is what convinced me Abigail was right,
File::Find. I personally find it infinitely more expressive to use
find(1) rather than File::Find, and since I work for a group whose
charter is to promote Linux and Open Source tools throughout the
company, I don't have to care about portability. There are other
examples; that's just the most obvious.

If your personal taste leans towards using only Perl, that's fine,
there's nothing wrong with that. But it is blatantly incorrect to
assert that "real Perl programmers" only use shell commands as a last
resort.

-=Eric
 
Reply With Quote
 
 
 
 
xhoster@gmail.com
Guest
Posts: n/a
 
      01-18-2006
(E-Mail Removed) wrote:
> Reinhard Glauber wrote:
> > $answer = system("wget http://www.bla.de/bla/blaDetail.aspx?ID=$i");

>
> That's not Perl - that's a shell command with a little bit of Perl
> wrapped around it (and it's not even the right sort of Perl).
>
> Real Perl programmers use real Perl functions and modules, and they
> resort to shell commands only when absolutely necessary


So lets say it takes several minutes to uncompress a file through perl
applying many regexes (or index calls) to each line (Not to mention the
time it takes to find, convince someone to install on many machines, and
then learn how to use the decompression module), but only a few seconds to
open and then read from:

open my $fh, qq{zcat /foo/bar/gene2accession.gz|fgrep "$grepper"|} or die
$!;

Is a savings of ~100x in run time absolutely necessary or just a needless
convenience?

Real programmers use the right tools for the job, whatever those may be.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
 
Reply With Quote
 
 
 
 
DJ Stunks
Guest
Posts: n/a
 
      01-18-2006
(E-Mail Removed) wrote:
> IT DON'T GET NO MORE EASIER THAN THAT RIGHT THERE!


bwah-ha-ha-ha-ha

 
Reply With Quote
 
axel@white-eagle.invalid.uk
Guest
Posts: n/a
 
      01-21-2006
(E-Mail Removed) wrote:
> Reinhard Glauber wrote:
>> $answer = system("wget http://www.bla.de/bla/blaDetail.aspx?ID=$i");


> That's not Perl - that's a shell command with a little bit of Perl
> wrapped around it (and it's not even the right sort of Perl).


> Real Perl programmers use real Perl functions and modules, and they
> resort to shell commands only when absolutely necessary (which is
> generally rare - I haven't used a raw shell command from Perl in three
> years). The most common module for this purpose is LWP. But I always
> recommend the use of the super-duper-module IO::All
> (http://tinyurl.com/982wo), especially to novice programmers, because
> it provides a nice, EASY proxy to LWP (and a bunch of other functions
> and modules). How easy, you ask? Well, I'm REALLY GLAD you asked:


> #!/usr/bin/perl
> use warnings; use strict;
> use IO::All;


I think that should be:

use IO::All::LWP;

> my $content < io('http://example.org');
> print $content;
> __END__


Axel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wget question Miguel NZ Computing 12 03-26-2007 09:55 PM
wget , how do I download when links are to a php .. ? jameshanley39@yahoo.co.uk Computer Information 0 01-04-2007 02:51 PM
Web get command (wget) to download all icons/pics on a web page (too large or too small) barb Digital Photography 5 08-04-2006 07:06 PM
looking for wget-like module for getching software Robert P. J. Day Python 2 12-16-2004 04:43 PM
WGET Henry Computer Security 1 08-11-2004 06:15 AM



Advertisments