in reply to Re^2: LWP::Simple Empty File
in thread LWP::Simple Empty File
The HTTP return code is not available for get() without using the LWP::UserAgent OO interface, but this 3 lines of code should ensure that your Windows box is actually getting something (runs on my XP Perl 5.10.1). If this prints something, then it comes down to probable file naming or permission errors in your getstore() statement.
It is hard for me to understand how a new file could be created with no content if the RC is 'OK'. That would imply that you do have the permission to create the file in the first place and therefore have permission to write to it!
Testing Note: delete your "blank" output file between runs to make sure that it is actually being created and not an artifact of some previous run.
Anyway run this simple test and report back.
#!/usr/bin/perl -w use strict; use LWP::Simple; my $content = get("http://perlmonks.org/?node_id=957704"); die "blank content" unless defined $content; print $content;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: LWP::Simple Empty File
by idlemind (Initiate) on Mar 04, 2012 at 17:06 UTC | |
by Marshall (Canon) on Mar 04, 2012 at 17:43 UTC | |
by idlemind (Initiate) on Mar 04, 2012 at 19:26 UTC | |
by Marshall (Canon) on Mar 04, 2012 at 19:38 UTC | |
by idlemind (Initiate) on Mar 04, 2012 at 21:50 UTC |