[22725] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4946 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 6 14:56:24 2003

Date: Tue, 6 May 2003 11:10: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, 6 May 2003     Volume: 10 Number: 4946

Today's topics:
        Net::FTP Script <rrunner@san.rr.com>
    Re: Net::FTP Script <mbudash@sonic.net>
    Re: Net::FTP Script <tony_curtis32@yahoo.com>
    Re: Passing hash and string to subroutine <richp1234@hotmail.com>
    Re: perl compiler for win32 platform? <simon.andrews@bbsrc.ac.uk>
        removing last char of string <chris_12003@yahoo.com>
    Re: removing last char of string <sdfsdf@sfasd.dsf>
    Re: removing last char of string <john.thetenant-s@moving-picture.com>
    Re: removing last char of string <chris_12003@yahoo.com>
    Re: shipping perl <abigail@abigail.nl>
    Re: Sort array of numbers <nobody@dev.null>
        What is good to learn <mail@annuna.com>
    Re: What is good to learn <goedicke@goedsole.com>
    Re: What is good to learn <richard@zync.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 06 May 2003 15:22:33 GMT
From: "Danny" <rrunner@san.rr.com>
Subject: Net::FTP Script
Message-Id: <ZqQta.79580$Eu1.2370410@twister.socal.rr.com>

This is a multi-part message in MIME format.

------=_NextPart_000_0010_01C313A8.B7769020
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Here is a Net::FTP script I am trying to run and I keep getting this =
same error time after time. Can anyone help me. I have tried everything. =
I made sure the login and password was correct still does not work.=20

#!/usr/bin/perl

use Net::FTP;

my $infile=3D"/Downloads/Documents/ftplocations";

open (IN,$infile)||die "cannot open $infile\n";

while (<IN>) {

chomp;

$ftp =3D Net::FTP->new("$_", Passive=3D> 0);

$ftp->login("login","password");

$ftp->type("binary");

$ftp->put('/Downloads/router/file.bin', 'ras');

$ftp->close(); #????

}

exit;



The error is : "Can't call method "login" on an undefined value at =
ftplocations line 15, <IN> line 1

------=_NextPart_000_0010_01C313A8.B7769020
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Here is a Net::FTP script I am trying =
to run and I=20
keep getting this same error time after time. Can anyone help me. I have =
tried=20
everything. I made sure the login and password was correct still does =
not work.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV>
<P><FONT face=3DArial size=3D2>#!/usr/bin/perl</FONT></P>
<P><FONT face=3DArial size=3D2>use Net::FTP;</FONT></P>
<P><FONT face=3DArial size=3D2>my=20
$infile=3D"/Downloads/Documents/ftplocations";</FONT></P>
<P><FONT face=3DArial size=3D2>open (IN,$infile)||die "cannot open=20
$infile\n";</FONT></P>
<P><FONT face=3DArial size=3D2>while (&lt;IN&gt;) {</FONT></P>
<P><FONT face=3DArial size=3D2>chomp;</FONT></P>
<P><FONT face=3DArial size=3D2>$ftp =3D Net::FTP-&gt;new("$_", =
Passive=3D&gt;=20
0);</FONT></P>
<P><FONT face=3DArial =
size=3D2>$ftp-&gt;login("login","password");</FONT></P>
<P><FONT face=3DArial size=3D2>$ftp-&gt;type("binary");</FONT></P>
<P><FONT face=3DArial =
size=3D2>$ftp-&gt;put('/Downloads/router/file.bin',=20
'ras');</FONT></P>
<P><FONT face=3DArial size=3D2>$ftp-&gt;close(); #????</FONT></P>
<P><FONT face=3DArial size=3D2>}</FONT></P>
<P><FONT face=3DArial size=3D2>exit;</FONT></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DFixedsys size=3D4>The error is : "Can't call method =
"login" on an=20
undefined value at ftplocations line 15, &lt;IN&gt; line=20
1</FONT></P></DIV></BODY></HTML>

------=_NextPart_000_0010_01C313A8.B7769020--



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

Date: Tue, 06 May 2003 15:34:39 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Net::FTP Script
Message-Id: <mbudash-D75AD2.08343906052003@typhoon.sonic.net>

In article <ZqQta.79580$Eu1.2370410@twister.socal.rr.com>,
 "Danny" <rrunner@san.rr.com> wrote:

> Here is a Net::FTP script I am trying to run and I keep getting this same 
> error time after time. Can anyone help me. I have tried everything. I made 
> sure the login and password was correct still does not work. 
> 
> #!/usr/bin/perl
> 
> use Net::FTP;
> 
> my $infile="/Downloads/Documents/ftplocations";
> 
> open (IN,$infile)||die "cannot open $infile\n";
> 
> while (<IN>) {
> 
> chomp;
> 
> $ftp = Net::FTP->new("$ ", Passive=> 0);
> 
> $ftp->login("login","password");
> 
> $ftp->type("binary");
> 
> $ftp->put('/Downloads/router/file.bin', 'ras');
> 
> $ftp->close(); #????
> 
> }
> 
> exit;
> 
> 
> 
> The error is : "Can't call method "login" on an undefined value at 
> ftplocations line 15, <IN> line 1

per perldoc Net::FTP, the first arg to the new constructor is HOST. "$ " 
doesn't look like a host to me... anyway, the error is telling you the 
new constructor failed. again, per the docs, use this format:

$ftp = Net::FTP->new("$ ", Passive=> 0) or die ("Can't create Net::FTP 
object. Error is $@");

did you read the docs for this module at all?

-- 
Michael Budash


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

Date: Tue, 06 May 2003 10:57:28 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Net::FTP Script
Message-Id: <87r87c3w5z.fsf@limey.hpcc.uh.edu>

>> On Tue, 06 May 2003 15:22:33 GMT,
>> "Danny" <rrunner@san.rr.com> said:

> Here is a Net::FTP script I am trying to run and I keep
> getting this same error time after time. Can anyone help
> me. I have tried everything. I made sure the login and
> password was correct still does not work.
 
> $ftp = Net::FTP->new("$_", Passive=> 0);
> $ftp->login("login","password");

> The error is : "Can't call method "login" on an
> undefined value at ftplocations line 15, <IN> line 1

The ftp connection is not being set up.  You should check
the definedness of $ftp before trying to use the
connection.

Adding "Debug" to the new() call might provide some clues.

hth
t


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

Date: Tue, 06 May 2003 06:56:14 -0700
From: Rich Pasco <richp1234@hotmail.com>
Subject: Re: Passing hash and string to subroutine
Message-Id: <3EB7BEFE.8020605@hotmail.com>

James E Keenan wrote:

> "Rich Pasco" <richp1234@hotmail.com> wrote in message
> news:3EB5EF30.7090206@hotmail.com...
>> [snip]
>> Then what would the body of my subroutine
>> "sub process_events" look like to retrieve the values in the hash?
>> Here's what I came up with:
>>
>> #pass both a hash and a string
>> my (%criterion, $text);
>> $criterion{'a'} = 'AAA';
>> $criterion{'b'} = 'BBB';
>> $text = 'The Quick Brown Fox';
>> process_events(\%criterion, $text);
>> exit;
>>
>> sub process_events {
>>   my($criteria, $body) = @_;
>>   print "a=$$criteria{'a'}\n";
>>   print "b=$$criteria{'b'}\n";
>>   print "\nbody = $body\n";
>> }
>>
> Perfectly fine, as is Sara's suggestion from this morning.  If you prefer to
> see things really explicit within the subroutine, you could dereference the
> hashref and assign it to a lexically scoped hash.
> 
> sub process_events {
>         my($criteria, $body) = @_;
>         my %crit = %$criteria;
>         print "a=$crit{'a'}\n";
>         print "b=$crit{'b'}\n";
>         print "\nbody = $body\n";
> }

That would not only make it easier to see, it would also incur the
runtime cost of copying all the data over to a local variable.  Of
course, that same cost was paid in my initial implementation which
started this thread.

     - Rich



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

Date: Tue, 06 May 2003 14:50:48 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: perl compiler for win32 platform?
Message-Id: <3EB7BDB8.2000005@bbsrc.ac.uk>


ZZT wrote:
> Hello Simon,
> 
> thanks first for your answer :) and sorry for the long delay.
> 
>> All you should need to do is to download the tar.gz from the address I 
>> gave you above, and unzip it to a temp directory (making sure you keep 
>> the folder organisation in the tar file), then open a command shell, 
>> move to that directory and type
>>
>> perl Makefile.PL
> 
> ran fine as far is I saw:
> *** ExtUtils::AutoInstall version 0.50
> *** Checking for dependencies...
> [Core Features]
> - File::Temp       ...loaded. (0.12)
> - Compress::Zlib   ...loaded. (1.16 >= 1.14)
> - Archive::Zip     ...loaded. (1.05 >= 1)
> - Module::ScanDeps ...loaded. (0.19 >= 0.19)
> *** ExtUtils::AutoInstall configuration finished.

That all seems good so far...


> Note (probably harmless): No library found for 'oldnames.lib'
> Note (probably harmless): No library found for 'kernel32.lib'
> Note (probably harmless): No library found for 'user32.lib'
> Note (probably harmless): No library found for 'gdi32.lib'
> Note (probably harmless): No library found for 'winspool.lib'
> Note (probably harmless): No library found for 'comdlg32.lib'
> Note (probably harmless): No library found for 'advapi32.lib'
> Note (probably harmless): No library found for 'shell32.lib'
> Note (probably harmless): No library found for 'ole32.lib'
> Note (probably harmless): No library found for 'oleaut32.lib'
> Note (probably harmless): No library found for 'netapi32.lib'
> Note (probably harmless): No library found for 'uuid.lib'
> Note (probably harmless): No library found for 'wsock32.lib'
> Note (probably harmless): No library found for 'mpr.lib'
> Note (probably harmless): No library found for 'winmm.lib'
> Note (probably harmless): No library found for 'version.lib'
> Note (probably harmless): No library found for 'odbc32.lib'
> Note (probably harmless): No library found for 'odbccp32.lib'
> Note (probably harmless): No library found for 'msvcrt.lib'
> Writing Makefile for the par.exe program

Hmm.  Didn't get anything like that when I've installed it.  It looks 
like something's already gone wrong by this stage.


> main.obj : error LNK2001: unresolved external symbol 
> __imp__DeleteCriticalSectio


Before it goes very wrong here!

I don't have a quick answer to this one.  I'll post your last message to 
the PAR users list and see if they have any suggestions.

Simon.



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

Date: Tue, 6 May 2003 10:52:18 -0700
From: "Chris" <chris_12003@yahoo.com>
Subject: removing last char of string
Message-Id: <vbftue6uvbdj29@corp.supernews.com>

Is there a way in perl to remove the last character of a string?  i.e. if
$var = "New York," I would want just "New York" without the extra comma.

Thanks,
Chris




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

Date: Tue, 06 May 2003 18:11:42 GMT
From: "trt@trt.com" <sdfsdf@sfasd.dsf>
Subject: Re: removing last char of string
Message-Id: <3EB7FA98.4090902@sfasd.dsf>


perl function chop

Chris wrote:
> Is there a way in perl to remove the last character of a string?  i.e. if
> $var = "New York," I would want just "New York" without the extra comma.
> 
> Thanks,
> Chris
> 
> 



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

Date: Tue, 6 May 2003 19:01:01 +0100
From: John Strauss <john.thetenant-s@moving-picture.com>
Subject: Re: removing last char of string
Message-Id: <20030506190101.023b0b3b.john.thetenant-s@moving-picture.com>

On Tue, 6 May 2003 10:52:18 -0700
"Chris" <chris_12003@yahoo.com> wrote:
>
> Is there a way in perl to remove the last character of a string?  i.e. if
> $var = "New York," I would want just "New York" without the extra comma.
> 
> Thanks,
> Chris
> 
> 

$var =~ s/.$//;


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drop the .thetenant to get me via mail


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

Date: Tue, 6 May 2003 11:41:34 -0700
From: "Chris" <chris_12003@yahoo.com>
Subject: Re: removing last char of string
Message-Id: <vbg0qgo84pj241@corp.supernews.com>


"John Strauss" <john.thetenant-s@moving-picture.com> wrote in message
> $var =~ s/.$//;

Thanks for your help,
Chris




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

Date: 06 May 2003 16:03:09 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: shipping perl
Message-Id: <slrnbbfn5t.tib.abigail@alexandra.abigail.nl>

Prashanth (npengr@yahoo.com) wrote on MMMDXXXV September MCMXCIII in
<URL:news:fff5a729.0305052213.57a16a1d@posting.google.com>:
::  Hi,
::  
::  I want to ship perl with our software (my employer's; not mine :) ),
::  as our software has a perl script and we don't want to rely on our
::  customer to have a Perl installation; but, I don't want to ship entire
::  Perl installation. Here are my doubts:
::  
::  1. The perl script in our software, does not have any 'use', 'do EXPR'
::  or 'require' constructs. So I don't want to ship any modules. Will
::  this be OK?

The easiest would be to try it out, wouldn't? Just create an environment
where your Perl installation doesn't have any module, and run your 
regression test. If it runs fine, you're safe (or you need to badly fix
your regression tests). If it fails, you need to ship modules.

::  2. The things which we are going to ship are,
::     i) Perl interpreter - perl.
::    ii) Copy of Artistic license.
::   iii) Copy of "Copying".
::   Is this OK? Should I include anything more?

Does it work with shipping just this?

::  3. I would like to ship perl built on Solaris 32 bit platform, for
::  Solaris 64 bit platform also. Will this cause any problem?

Did you try? SUN claims this isn't a problem, but why trust SUN if
you can test yourself?

::  It will be very helpful, if you people can clear my doubts.


I have some doubts. Why would anyone buy from a vendor that doesn't
test its own software, but just asks on Usenet whether what they'll
ship will work?


Abigail
-- 
perl -le 's[$,][join$,,(split$,,($!=85))[(q[0006143730380126152532042307].
          q[41342211132019313505])=~m[..]g]]e and y[yIbp][HJkP] and print'


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

Date: Tue, 06 May 2003 16:39:17 GMT
From: Andras Malatinszky <nobody@dev.null>
Subject: Re: Sort array of numbers
Message-Id: <3EB7E4E8.7040207@dev.null>



Daniel Pfeiffer wrote:

> Ryan McCarthy <remccart@uiuc.edu.spam> skribis:
> 
>>I recall when I started perl programming, I was not entirely aware of 
>>the extent of the perl documentation.
>>
> 
> Well, the natural first reflex should be "man perl".  


[...]

Alas, given the presence of the

X-Newsreader: Microsoft Outlook Express 5.50.4522.1200

header in the original post, that first reflex is likely to result in a 
big fat

Bad command or file name





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

Date: Tue, 06 May 2003 12:09:55 -0500
From: Joe Creaney <mail@annuna.com>
Subject: What is good to learn
Message-Id: <3EB7EC63.1020003@annuna.com>

I would like to be able to get an entry level job programming.  I am 
teaching myself C++ and Perl.  I am getting pretty good.  I am planning 
to learn to make GUIs with TK.  I am looking for some advice on how much 
I need to know and what is good for someone to pay me to show up and 
write code.



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

Date: Tue, 06 May 2003 17:26:40 GMT
From: William Goedicke <goedicke@goedsole.com>
Subject: Re: What is good to learn
Message-Id: <m37k94yojd.fsf@mail.goedsole.com>

Dear Joe -

Joe Creaney <mail@annuna.com> writes:

> I would like to be able to get an entry level job programming.  I am
> teaching myself C++ and Perl.

Perl and C++ are good languages for creating useful programs if what
you're looking for is an entry-level programming job you're probably
better served by learning java.  It takes more programmers to get
things done, so there are more jobs.

     Yours -      Billy

============================================================
     William Goedicke     goedicke@goedsole.com            
                          http://www.goedsole.com:8080      
============================================================

          Lest we forget:

There may be no stupid questions, but there's no 
shortage of morons asking them.

		- William Goedicke


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

Date: Tue, 06 May 2003 18:35:54 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: What is good to learn
Message-Id: <20030506.183554.2103318776.29392@richg.zync>

What is good to learn?

To crush your enemies, to see dem driven before you, to hear de
lamentation of deir vimmin.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

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.  

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 V10 Issue 4946
***************************************


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