[Israel.pm] Downloading using LWP

Gabor Szabo szabgab at gmail.com
Wed Feb 18 05:50:52 PST 2009


Chanan,

I am sorry you felt offended by the answers.

BUT

I think people here were quite patient and gave you plenty of good advice.
Maybe they were not as friendly as you would be but they certainly deserve
a real "thank you" more than shutting the door on their face.

Oh and BTW as much as we try to help newbies this is not designated as
a "newbie" list.

Gabor


On Wed, Feb 18, 2009 at 3:10 PM, bc.other <bc.other at gmail.com> wrote:
> Thanks all wise and smart people who lecture me on how to write my
> questions.
> Although the idea was to download binary files (if anyone noticed the
> binmode(FILE))
> Anyhow the issue was relayed to something else - the script does work
> The problem was I compiled the plugin using CentOS5.1 while trying to
> download&run it on CentOS4.1
> which was tricky....anyhow I tested the HelloWorld script, and it works like
> wonder.
>
> PS: as far as I remember I registered Newbie mailing list, or am I
> mistaken...so I wonder why ppl tend
> to correct me "too much", tell you what...i decide to leave the mailing
> list....
> Thanks for your "help"
> Chanan
>
> -----Original Message-----
> From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
> Of Avishalom Shalit
> Sent: Wednesday, February 18, 2009 2:43 PM
> To: Perl in Israel
> Subject: Re: [Israel.pm] Downloading using LWP
>
> 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.
>>>
>>> --



More information about the Perl mailing list