wget Question

Discussion in 'Perl Misc' started by Reinhard Glauber, Jan 17, 2006.

  1. $answer = system("wget http://www.bla.de/bla/blaDetail.aspx?ID=$i");

    How can i push the content of a single html site into $answer ?

    This line doesn't work


    Thanks
    Reinhard Glauber, Jan 17, 2006
    #1
    1. Advertising

  2. Reinhard Glauber wrote:
    > $answer = system("wget http://www.bla.de/bla/blaDetail.aspx?ID=$i");
    >
    > How can i push the content of a single html site into $answer ?
    >
    > This line doesn't work


    What did you do to find out before posting here? Did you possibly read
    the docs for the functioh you are using?

    perldoc -f system

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Jan 17, 2006
    #2
    1. Advertising

  3. "Gunnar Hjalmarsson" <> schrieb im Newsbeitrag news:...

    > Reinhard Glauber wrote:


    > What did you do to find out before posting here? Did you possibly read
    > the docs for the functioh you are using?
    >
    > perldoc -f system



    Not installed on my system .. I'm lucky .. no one can blame me ;-))
    You need to install the perl-doc package to use this program.
    Reinhard Glauber, Jan 17, 2006
    #3
  4. Reinhard Glauber wrote:
    > Gunnar Hjalmarsson schrieb:
    >>What did you do to find out before posting here? Did you possibly read
    >>the docs for the functioh you are using?
    >>
    >> perldoc -f system

    >
    > Not installed on my system .. I'm lucky .. no one can blame me ;-))
    > You need to install the perl-doc package to use this program.


    No, you are not lucky, and anybody can blame you for not reading the
    docs of the programming language you are using.

    A few options:

    - Install perldoc

    - Install Perl on your PC. Since you seem to be on a Windows box, I'd
    recommend the bundle at http://www.indigostar.com/indigoperl.htm, which
    would give you the docs conveniently available as HTML documents.
    http://www.activestate.com/ offers a similar bundle.

    - Download the docs from http://www.activestate.com/

    - Browse the docs on the web; in this case:
    http://perldoc.perl.org/functions/system.html

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Jan 17, 2006
    #4
  5. Gunnar Hjalmarsson, Jan 17, 2006
    #5
  6. Reinhard Glauber, Jan 17, 2006
    #6
  7. Reinhard Glauber wrote:
    > "Gunnar Hjalmarsson" <> schrieb im Newsbeitrag
    > news:...
    >> Reinhard Glauber wrote:

    >
    >> What did you do to find out before posting here? Did you possibly
    >> read the docs for the functioh you are using?
    >>
    >> perldoc -f system

    >
    >
    > Not installed on my system .. I'm lucky .. no one can blame me ;-))
    > You need to install the perl-doc package to use this program.


    Well, then why don't you fix your broken Perl installation? Then you can
    read the documentation yourself and don't have to ask someone else to read
    them for you.

    Oh, and to answer your original question: See perldoc -f system, third
    paragraph, fourth sentence.
    Not to mention that this Question is Asked very Frequently, too.

    jue
    Jürgen Exner, Jan 17, 2006
    #7
  8. "Reinhard Glauber" <> wrote in news:43ccbf22$0$21021$9b4e6d93
    @newsread2.arcor-online.net:

    > $answer = system("wget http://www.bla.de/bla/blaDetail.aspx?ID=$i");
    >
    > How can i push the content of a single html site into $answer ?
    >
    > This line doesn't work


    Have you read the posting guidelines for this group?

    In addition to Gunnar and Jurgen's comments, I suggest you take a look at

    <URL:http://search.cpan.org/~gaas/libwww-perl-5.805/lib/LWP/Simple.pm>

    Sinan
    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
    A. Sinan Unur, Jan 17, 2006
    #8
  9. Reinhard Glauber <> wrote:

    > $answer = system("wget http://www.bla.de/bla/blaDetail.aspx?ID=$i");


    perldoc -q HTML

    How do I fetch an HTML file?

    How do I automate an HTML form submission?


    > How can i push the content of a single html site into $answer ?



    The way it says to in the documentation for the function that
    you are using, or the way that it says to in the Perl FAQ.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jan 18, 2006
    #9
  10. Reinhard Glauber

    Guest

    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;
    my $content < io('http://example.org');
    print $content;
    __END__

    IT DON'T GET NO MORE EASIER THAN THAT RIGHT THERE!

    --
    http://DavidFilmer.com
    , Jan 18, 2006
    #10
  11. 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
    Eric Schwartz, Jan 18, 2006
    #11
  12. Reinhard Glauber

    Guest

    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
    , Jan 18, 2006
    #12
  13. Reinhard Glauber

    DJ Stunks Guest

    wrote:
    > IT DON'T GET NO MORE EASIER THAN THAT RIGHT THERE!


    bwah-ha-ha-ha-ha
    DJ Stunks, Jan 18, 2006
    #13
  14. Reinhard Glauber

    Guest

    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
    , Jan 21, 2006
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert P. J. Day
    Replies:
    2
    Views:
    388
    Robert P. J. Day
    Dec 16, 2004
  2. olivier HARO

    a simple wget in C language?

    olivier HARO, Oct 14, 2004, in forum: C Programming
    Replies:
    10
    Views:
    1,595
    Ilja Booij
    Nov 3, 2004
  3. Yang
    Replies:
    6
    Views:
    3,680
  4. Jesse

    Popen and wget, problems

    Jesse, May 12, 2007, in forum: Python
    Replies:
    3
    Views:
    528
  5. Mathieu Prevot
    Replies:
    3
    Views:
    558
    Mathieu Prevot
    Jul 7, 2008
Loading...

Share This Page