[Israel.pm] Downloading using LWP

Avishalom Shalit avishalom at gmail.com
Wed Feb 18 04:42:52 PST 2009


btw,
not directly related to this thread,
and not implying anything,
but
http://www.catb.org/~esr/faqs/smart-questions.html
is a good read,
"In the world of hackers, the kind of answers you get to your
technical questions depends as much on the way you ask the questions
as on the difficulty of developing the answer. This guide will teach
you how to ask questions in a way more likely to get you a
satisfactory answer."

--vish

2009/2/18 Gaal Yahas <gaal at forum2.org>:
> What Avishalom and Mikhael said.
>
> Note that it's worthwhile checking close as well: in some cases, e.g.
> disk full errors, you might only get the error then.
>
> While we're at it, consider the following two tips as well. They're
> unlikely to be related to your current issue but may help you in the
> future:
>
> 1. Use lexical filehandles.
>
> "FILE" is a global. You can "open my $fh, ..." instead, and $fh
> becomes lexically scoped.
>
> 2. Use 3-arg open.
>
> open my $fh, ">", $filename or die "open: $filename: $!";
>
> is better than open my $fh, ">$filename". This is even more
> significant in opens intended for reads. If your $filename
> unexpectedly starts with a ">" or starts/ends with a "|", for example,
> bad things can happen. The 3-arg form avoids those bad things.
>
> On Wed, Feb 18, 2009 at 12:42 PM, Mikhael Goikhman <migo at homemail.com> wrote:
>> On 18 Feb 2009 11:06:17 +0200, Berler Chanan wrote:
>>>
>>> This is a small LWP utility I wrote:
>>> It works fine using Windows, but it doesn't work when I try to download
>>> a file into unix, does anyone knows what I did wrong?
>>
>> Does not work meaning what exactly? File not created or something else?
>>
>>>     open FILE, ">$lv_plugin";
>>
>> Always check the system calls for failure:
>>
>>  my $filename = "/tmp/" . $lv_plugin;
>>  open FILE, ">$filename" or die "Can't save $filename: $!\n";
>>
>> Regards,
>> Mikhael.
>>
>> --
>> perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'
>> _______________________________________________
>> Perl mailing list
>> Perl at perl.org.il
>> http://perl.org.il/mailman/listinfo/perl
>>
>
>
>
> --
> Gaal Yahas <gaal at forum2.org>
> http://gaal.livejournal.com/
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>



-- 
-- vish



More information about the Perl mailing list