http://qs321.pair.com?node_id=775298


in reply to Re: LWP help
in thread LWP help

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: LWP help
by mzedeler (Pilgrim) on Jun 27, 2009 at 12:32 UTC

    Short answer: no.

    LWP doesn't return the document you request, but a response object which - in turn - has an attribute with the content. There is an example on the main documentation page of LWP.

    LWP will fetch anything you ask it to fetch for you, and let you access it using the content attribute - regardless of what it fetched for you. With regard to your idea about regular expressions: it doesn't work that way - try playing around with LWP a little first.

    By the way: I think you'll be able to ask much better questions if you try things by yourself first, and ask later.

Re^3: LWP help
by bart (Canon) on Jun 28, 2009 at 09:27 UTC

    Perhaps you should try to use LWP::Simple instead... it will indeed work almost as your made up example. It won't tell you the content-type... but do you really need it? I rarely do.

    Use:

    • get to retrieve the contents of a URL into a variable
    • getprint to print the contents of URL, without having to pull it into memory first (saves memory if it's huge)
    • getstore to save the contents of a URL directly to file, without holding it in memory first.
      thanks bart that thing worked!!!!!!!!