Loading ...
Sorry, an error occurred while loading the content.

Re: LWP :content_file problems

Expand Messages
  • daymobrew@yahoo.com
    ... webserver. No problem, I set up the LWP::UserAgent as required and am able to retrieve the pages and the file. However, the file is over 40 meg, so I
    Message 1 of 2 , Jan 28, 2004
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, "Jeff Eggen" <jeggen@s...> wrote:
      > Hi all,
      >
      > I have a script written up to download a file over the 'net from a
      webserver. No problem, I set up the LWP::UserAgent as required and am
      able to retrieve the pages and the file. However, the file is over 40
      meg, so I don't want to store it in the response object's content, but
      rather directly to a file. The "Perl & LWP" book mentions the
      ':content_file' option you can pass to the get method to have the
      contents go directly to a file, so I gave that a try. To start, I had
      the file going to a spot on the /tmp filesystem:
      >
      > my $response = $ua->get('https://website/blah/blah/blah',
      ':content_file' => '/tmp/w302.payroll' );
      >
      > As the file downloads, then, I can see swap space on my server get
      slowly eaten up, but the file is never actually created. So, I tried
      putting it to the cwd:
      >
      > my $response = $ua->get('https://website/blah/blah/blah',
      ':content_file' => 'w302.payroll' );
      >
      > And then run the script from my home directory, which is on another
      file system. Again, I can see swap space disappearing, but the file
      never gets created.
      >
      > If I don't do this, and instead just save everything to the response
      object and then open a file & print out the $response->content() to
      the file, everything works as expected.
      >
      > Has anyone else run into this before? I followed the example in the
      book, and I think I'm doing things right, but I'm probably just
      missing something silly. Any help on this would be appreciated.
      >
      > Thanks,
      > Jeff

      http://www.perldoc.com/perl5.8.0/lib/LWP/UserAgent.html
      give an example:

      $request = HTTP::Request->new('GET', 'https://website/blah/');
      $response = $ua->request($request, 'w302.payroll');

      Will that work for you?
    Your message has been successfully submitted and would be delivered to recipients shortly.