[31149] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2394 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 6 00:09:46 2009

Date: Tue, 5 May 2009 21:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 5 May 2009     Volume: 11 Number: 2394

Today's topics:
    Re: FAQ 5.17 Is there a leak/bug in glob()? <ben@morrow.me.uk>
        hash ref to plain hash <sun_tong_001@users.sourceforge.net>
    Re: hash ref to plain hash <jurgenex@hotmail.com>
    Re: HELP - Spreadsheet::ParseExce - Can't call method " <smallpond@juno.com>
    Re: HELP - Spreadsheet::ParseExce - Can't call method " <Ansher.M@gmail.com>
    Re: HELP - Spreadsheet::ParseExce - Can't call method " <smallpond@juno.com>
    Re: Help with Net::ftp not downloading <ben@morrow.me.uk>
    Re: Help with Net::ftp not downloading <rvtol+usenet@xs4all.nl>
    Re: Help with Net::ftp not downloading <edMbj@aes-intl.com>
    Re: Help with Net::ftp not downloading <ben@morrow.me.uk>
    Re: Help with Net::ftp not downloading <edMbj@aes-intl.com>
    Re: Help with Net::ftp not downloading <uri@stemsystems.com>
    Re: Help with Net::ftp not downloading <edMbj@aes-intl.com>
    Re: Help with Net::ftp not downloading <edMbj@aes-intl.com>
    Re: Help with Net::ftp not downloading <uri@stemsystems.com>
    Re: Help with Net::ftp not downloading <nat.k@gm.ml>
        Perl firewall test script - detect whether host not res <inetquestion@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 5 May 2009 21:42:45 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 5.17 Is there a leak/bug in glob()?
Message-Id: <5vk6d6-iv2.ln1@osiris.mauzo.dyndns.org>


Quoth PerlFAQ Server <brian@stonehenge.com>:
>
> 5.17: Is there a leak/bug in glob()?
> 
>     Due to the current implementation on some operating systems, when you
>     use the glob() function or its angle-bracket alias in a scalar context,
>     you may cause a memory leak and/or unpredictable behavior. It's best
>     therefore to use glob() only in list context.

Am I correct in thinking this only applied to the csh implementation of
glob, which has been obsolete (except in miniperl) since 5.6?

Ben



------------------------------

Date: Tue, 05 May 2009 21:26:49 -0500
From: * Tong * <sun_tong_001@users.sourceforge.net>
Subject: hash ref to plain hash
Message-Id: <nNydnS8tQ8v0aJ3XnZ2dnUVZ_sednZ2d@golden.net>

Hi, 

I don't know how the problem is called, so let me describe with an 
example:

Suppose the function myfunc takes the following type of parameters:

 myfunc( this => 10, that => 20 );

I,e., it takes a hash. Now I have a hash ref:

 $hr = { this => 10, that => 20 } ; 

how can I pass $hr to myfunc?
Also, how to properly call this problem/handling?

thanks

-- 


------------------------------

Date: Tue, 05 May 2009 19:57:58 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: hash ref to plain hash
Message-Id: <lru105h599h59susd57jetpnf9rjpbj0id@4ax.com>

* Tong * <sun_tong_001@users.sourceforge.net> wrote:
>I don't know how the problem is called, so let me describe with an 
>example:
>
>Suppose the function myfunc takes the following type of parameters:
>
> myfunc( this => 10, that => 20 );
>
>I,e., it takes a hash.

No, it doesn't. The argument in sub calls in Perl is always a single
flat list of scalars, please see 'perldoc perlsub'.
That call above is the same as 
	myfunc('this', 10, 'that', 20);

> Now I have a hash ref:
>
> $hr = { this => 10, that => 20 } ; 
>
>how can I pass $hr to myfunc?

Just de-reference that hash ref, see 'perldoc perlref' or maybe first
'perldoc perlreftut'.

>Also, how to properly call this problem/handling?

De-referencing.

jue


------------------------------

Date: Tue, 5 May 2009 13:21:29 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: HELP - Spreadsheet::ParseExce - Can't call method "value" on an  undefined value
Message-Id: <5c6d6bf3-45b5-4e93-b56d-219d2a951b1b@s20g2000vbp.googlegroups.com>

On May 5, 2:45=A0pm, perl Newbie <Anshe...@gmail.com> wrote:
> Hi,
>
> I am getting an error message Can't call method "value" on an
> undefined value at ....
>

Is this a troll?  You call value 5 times in your program.
Are we supposed to guess which call is the failing one?
Do you not know that the error includes the line number?


------------------------------

Date: Tue, 5 May 2009 14:04:05 -0700 (PDT)
From: perl Newbie <Ansher.M@gmail.com>
Subject: Re: HELP - Spreadsheet::ParseExce - Can't call method "value" on an  undefined value
Message-Id: <792c9180-059e-4f25-923b-757753793647@g31g2000pra.googlegroups.com>

On May 6, 1:21=A0am, smallpond <smallp...@juno.com> wrote:
> On May 5, 2:45=A0pm, perl Newbie <Anshe...@gmail.com> wrote:
>
> > Hi,
>
> > I am getting an error message Can't call method "value" on an
> > undefined value at ....
>
> Is this a troll? =A0You call value 5 times in your program.
> Are we supposed to guess which call is the failing one?
> Do you not know that the error includes the line number?

Sorry about that ...

Can't call method "value" on an undefined value at F:\Perl\excel
\test.pl line 25.



------------------------------

Date: Tue, 5 May 2009 14:35:51 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: HELP - Spreadsheet::ParseExce - Can't call method "value" on an  undefined value
Message-Id: <c318abba-9340-4959-a81e-c7f8d015f563@p4g2000vba.googlegroups.com>

On May 5, 5:04=A0pm, perl Newbie <Anshe...@gmail.com> wrote:
> On May 6, 1:21=A0am, smallpond <smallp...@juno.com> wrote:
>
> > On May 5, 2:45=A0pm, perl Newbie <Anshe...@gmail.com> wrote:
>
> > > Hi,
>
> > > I am getting an error message Can't call method "value" on an
> > > undefined value at ....
>
> > Is this a troll? =A0You call value 5 times in your program.
> > Are we supposed to guess which call is the failing one?
> > Do you not know that the error includes the line number?
>
> Sorry about that ...
>
> Can't call method "value" on an undefined value at F:\Perl\excel
> \test.pl line 25.

 ... and which call to value is that?  Do I have to count the lines in
your file for you?


------------------------------

Date: Tue, 5 May 2009 22:40:15 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <vao6d6-9q6.ln1@osiris.mauzo.dyndns.org>


Quoth Ed Jay <edMbj@aes-intl.com>:
> I'm still a novice at Perl. I'm trying to develop a simple script to
> download a set of files from my server to my local drive. Although I'm not
> getting any error messages, the script isn't performing. Help, please!
> 
> (BTW, using this script I have been able to change and delete file names
> on the server, so I know I'm properly logged in.)
> 
> My script:
> 

Where are

    use warnings;
    use strict;

> use CGI ':standard';
> use CGI::Carp qw(fatalsToBrowser);
> my $query = new CGI;
> use Net::FTP;
> 
> my $home = 'myDomain';
> my $directory="public_html/uploads";
> my $fileTest = "Test.IRI";
> my $localDir = 'F:/_Downloads';

OK, you seem to be trying to do FTP from within a CGI script, so you
need to be very clear about exactly what you are doing.

    Which machine is the script running on?
    Which machine are you trying to get the file from?
    Which machine are you trying to send the file to?

> print "Content-type: text/html\n\n";
> 
> $ftp=Net::FTP->new($host,Timeout=>240,Debug =>1,Passive=>1) or $error=1;

What is $host? You don't set it above.

> push @ERRORS, "Can't ftp to $host: $!\n" if $error;
> if ($error) {push @ERRORS, "Can't connect to $host: $!\n";myerrors();}
>   print "Connected<br>\n";

This is clumsy, to say the least, and you're pushing two error messages.
What's wrong with

    unless ($ftp) {
        push @ERRORS, "Can't ftp to $host: $!\n";
        myerrors();
    };

You have arranged things so that @ERRORS never has more than one message
in it (except for this mistake here). Why not just pass the message to
myerrors as a parameter instead of using a global array?

> sub myerrorsors {$ftp->quit;print "Error: \n";print @ERRORS;exit 0;}	

You have mistyped the name of this sub.

Ben



------------------------------

Date: Wed, 06 May 2009 01:32:54 +0200
From: "Dr.Ruud" <rvtol+usenet@xs4all.nl>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <4a00cca6$0$182$e4fe514c@news.xs4all.nl>

Ed Jay wrote:

> cd to C:/:

With 2 colons?

-- 
Ruud


------------------------------

Date: Tue, 05 May 2009 17:32:48 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <thm10515kvffqn18nrc2rudlhh69eoh2pd@4ax.com>

Dr.Ruud wrote:

>Ed Jay wrote:
>
>> cd to C:/:
>
>With 2 colons?

No. The second colon  is part of the error reporting string, i.e.,
chdir( $localDir ) or die "Can't cd to $localDir: $!";

Also tried "Can't cd to $localDir $!"; and get the same result.

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


------------------------------

Date: Wed, 6 May 2009 02:21:52 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <ga57d6-t48.ln1@osiris.mauzo.dyndns.org>


Quoth Ed Jay <edMbj@aes-intl.com>:
> J. Gleixner wrote:
> 
> >use CGI qw(:standard);
> ># without the next line, die output will be found in your
> ># server's error log. Use this only when debugging.
> >use CGI::Carp qw(fatalsToBrowser);
> >use strict;
> >
> >my $localDir = 'C:/somedir';  #change that to the appropriate location
> >
> >print header,
> >	"Changing directory to $localDir.<br>";
> >
> >chdir( $localDir ) or die "Can't cd to $localDir: $!";
> >
> >print "Change to $localDir successful.<br>";
> 
> The above represents the entire script I used. Got the same message (Can't
> cd to C:/: No such file or directory at brca_download.pl), and there is
> nothing showing in the server's error log.

Let me make a wild guess. You are executing this script as a CGI on your
webhost, which is a Unix machine and doesn't have a C: drive.

Ben



------------------------------

Date: Tue, 05 May 2009 18:51:34 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <e6r105hbrss580b08qbqusjigtdciu55vq@4ax.com>

Ben Morrow wrote:

>
>Quoth Ed Jay <edMbj@aes-intl.com>:
>> J. Gleixner wrote:
>> 
>> >use CGI qw(:standard);
>> ># without the next line, die output will be found in your
>> ># server's error log. Use this only when debugging.
>> >use CGI::Carp qw(fatalsToBrowser);
>> >use strict;
>> >
>> >my $localDir = 'C:/somedir';  #change that to the appropriate location
>> >
>> >print header,
>> >	"Changing directory to $localDir.<br>";
>> >
>> >chdir( $localDir ) or die "Can't cd to $localDir: $!";
>> >
>> >print "Change to $localDir successful.<br>";
>> 
>> The above represents the entire script I used. Got the same message (Can't
>> cd to C:/: No such file or directory at brca_download.pl), and there is
>> nothing showing in the server's error log.
>
>Let me make a wild guess. You are executing this script as a CGI on your
>webhost, which is a Unix machine and doesn't have a C: drive.
>
Correct, except that I created a 'C' folder both above and below the
folder (cgi-bin), so there would be a C folder.

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


------------------------------

Date: Tue, 05 May 2009 22:08:40 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <87ocu7c79z.fsf@quad.sysarch.com>

>>>>> "EJ" == Ed Jay <edMbj@aes-intl.com> writes:

  EJ> Ben Morrow wrote:
  >> 
  >> Quoth Ed Jay <edMbj@aes-intl.com>:

  >>> >my $localDir = 'C:/somedir';  #change that to the appropriate location

  >>> The above represents the entire script I used. Got the same message (Can't
  >>> cd to C:/: No such file or directory at brca_download.pl), and there is
  >>> nothing showing in the server's error log.
  >> 
  >> Let me make a wild guess. You are executing this script as a CGI on your
  >> webhost, which is a Unix machine and doesn't have a C: drive.
  >> 
  EJ> Correct, except that I created a 'C' folder both above and below the
  EJ> folder (cgi-bin), so there would be a C folder.

wow. and what do you think unix does with the : char in a filename? i
can't even start to answer this or i will smack my forehead too many
times.

wow.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Tue, 05 May 2009 19:16:37 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <4as1059r9rtala8skecq1k8igohl9r8esj@4ax.com>

Ed Jay wrote:

>Ben Morrow wrote:
>
>>
>>Quoth Ed Jay <edMbj@aes-intl.com>:
>>> J. Gleixner wrote:
>>> 
>>> >use CGI qw(:standard);
>>> ># without the next line, die output will be found in your
>>> ># server's error log. Use this only when debugging.
>>> >use CGI::Carp qw(fatalsToBrowser);
>>> >use strict;
>>> >
>>> >my $localDir = 'C:/somedir';  #change that to the appropriate location
>>> >
>>> >print header,
>>> >	"Changing directory to $localDir.<br>";
>>> >
>>> >chdir( $localDir ) or die "Can't cd to $localDir: $!";
>>> >
>>> >print "Change to $localDir successful.<br>";
>>> 
>>> The above represents the entire script I used. Got the same message (Can't
>>> cd to C:/: No such file or directory at brca_download.pl), and there is
>>> nothing showing in the server's error log.
>>
>>Let me make a wild guess. You are executing this script as a CGI on your
>>webhost, which is a Unix machine and doesn't have a C: drive.
>>
>Correct, except that I created a 'C' folder both above and below the
>folder (cgi-bin), so there would be a C folder.

Accidentally hit Return.

Yes, you are correct, and that also crossed my mind, so I created two
directories named C, one above cgi-bin and one a subdirectory of cgi-bin.
No go...same error. 

Perhaps you'd care to make another wild guess at the answer to my dilemma.
I cannot find the answer elsewhere, and I have done my due diligence.

Should this be done under the scenario of transferring files from one
remote to another remote with no local client?

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


------------------------------

Date: Tue, 05 May 2009 20:03:11 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <0bv10556eapn1c0kctcnbk62pvimnlbueg@4ax.com>

Uri Guttman wrote:

>>>>>> "EJ" == Ed Jay <edMbj@aes-intl.com> writes:
>
>  EJ> Ben Morrow wrote:
>  >> 
>  >> Quoth Ed Jay <edMbj@aes-intl.com>:
>
>  >>> >my $localDir = 'C:/somedir';  #change that to the appropriate location
>
>  >>> The above represents the entire script I used. Got the same message (Can't
>  >>> cd to C:/: No such file or directory at brca_download.pl), and there is
>  >>> nothing showing in the server's error log.
>  >> 
>  >> Let me make a wild guess. You are executing this script as a CGI on your
>  >> webhost, which is a Unix machine and doesn't have a C: drive.
>  >> 
>  EJ> Correct, except that I created a 'C' folder both above and below the
>  EJ> folder (cgi-bin), so there would be a C folder.
>
>wow. and what do you think unix does with the : char in a filename? i
>can't even start to answer this or i will smack my forehead too many
>times.
>
>wow.
>
:-)  Don't smack yourself. I've been doing that all day, and it's only
given me a bigger headache. That said, the answer to how do I target a
directory my desktop machine is probably trivial and obvious, and I'll
smack my head even more when the light finally goes on.

-- 
Ed Jay (remove 'M' to reply by email)

Win the War Against Breast Cancer.
Knowing the facts could save your life. 
http://www.breastthermography.info


------------------------------

Date: Tue, 05 May 2009 23:30:15 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <878wladi2g.fsf@quad.sysarch.com>

>>>>> "EJ" == Ed Jay <edMbj@aes-intl.com> writes:

  >>>> >my $localDir = 'C:/somedir';  #change that to the appropriate location

  EJ> Yes, you are correct, and that also crossed my mind, so I created
  EJ> two directories named C, one above cgi-bin and one a subdirectory
  EJ> of cgi-bin.  No go...same error.

wow again.

  EJ> Perhaps you'd care to make another wild guess at the answer to my dilemma.
  EJ> I cannot find the answer elsewhere, and I have done my due diligence.

he pointed out the very problem you are having. and i smacked my head in
a wow already. do you want another forehead smack?

  EJ> Should this be done under the scenario of transferring files from one
  EJ> remote to another remote with no local client?

huh??? you don't seem to get it. UNIX DOESN'T HAVE : as SPECIAL IN FILE
NAMES!!!!!  it is a regular character. you can't have absolute paths
that work on both unix and winfuckingblows. simple. now you can smack
yourself a dozen times and learn something about writing portable
code. and the File::Path module on cpan will ease your pains.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Mon, 04 May 2009 19:46:30 -0700
From: Nathan Keel <nat.k@gm.ml>
Subject: Re: Help with Net::ftp not downloading
Message-Id: <QI7Ml.3022$CN5.2449@newsfe23.iad>

Ed Jay wrote:

> Nathan Keel wrote:
> 
>>Ed Jay wrote:
>>
>>> I'm running a script on the server using my browser.
>>
>>Okay, so did you verify that the web server runs as your own user so
>>it
>>has write permissions?  Did you verify that the web service isn't
>>somehow interfering?  Did you try running it from the command line to
>>help rule out some things?
> 
> I can't run it from the command line.
> 
> If the web server was the cause, I wouldn't expect any other ftp
> client to succeed. That's not the case.
> 
> Thanks for the advice.
> 

I don't want to waste your time by asking irrelevant questions to your
issue, but why can't you run it on the command line?  Is this a remote
server that you don't have terminal/cli access to?  As for the cause, I
was just saying it's always good to rule out as many things as
possible.  I.e., see if you can connect out from that system over FTP
logging in manually, connecting to the FTP site, and get a file that
way.  If so, then go to CLI and with verbose output and error checking,
see if it runs on the command line.  If it does, then automate it or go
the route of the CGI script.

Of course, you can run it and figure it out without going that route,
but those methods allow for a better test bed and can save time, if you
have that as an option.  The web server comment was also to suggest
that the CGI scripts might be running as a different user and maybe the
data is downloading but unable to write due to the permissions.  For
that matter, it could be a quota issue on the account or similar
things.  You can maybe try running the script from your local system
and see if it works, just anything to rule out other potentials is all
I mean. Good luck.


------------------------------

Date: Tue, 5 May 2009 19:15:31 -0700 (PDT)
From: inetquestion <inetquestion@hotmail.com>
Subject: Perl firewall test script - detect whether host not responding or  firewall rule not implemented
Message-Id: <35bcace6-4306-40c2-81ba-35812166c62a@t11g2000vbc.googlegroups.com>

I submitted some firewall rules today which will be implemented before
all the destination hosts are live on the network.  In the past I put
a perl script on each source server and controlled them from a central
location to initiate a connection to each of the destinations to check
the connectivity.  In this case that will not work.

Is there any scriptable way to know why a connection failed from the
source?  For example when a failure occurs...to know whether the
connection was blocked by the firewall or it made it through but the
remote host was not listening.

-Inet


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 2394
***************************************


home help back first fref pref prev next nref lref last post