[19471] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1666 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 31 06:05:25 2001

Date: Fri, 31 Aug 2001 03:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <999252308-v10-i1666@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 31 Aug 2001     Volume: 10 Number: 1666

Today's topics:
    Re: Accessing $a and $b in conjunction with goto &NAME <goldbb2@earthlink.net>
    Re: can this perl script be more elegant/shorter ? <krahnj@acm.org>
    Re: Dangerous Perl Script? (Tim Hammerquist)
    Re: Difference between .pl, .cgi, and .pm File Extensio (Ian Boreham)
    Re: File::Find not recursing on Win32 Perl 5.001 (Phil Hibbs)
    Re: ftp unix to pc file transfer , script needed <projectobjects@earthlink.net>
    Re: Godzilla Stomps Code Red <bcaligari@fireforged.com>
        Mix 2 wave files (Nancy Chan)
    Re: Net::SNMP and unsigned/big integers <goldbb2@earthlink.net>
    Re: Partial matching of a regular expression <goldbb2@earthlink.net>
        pattern for types of files ? <radiotito@yahoo.com>
    Re: pattern for types of files ? <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Perl 5.6.1 and PerlCC (B module) bombs using tie. <ilya@martynov.org>
        perl and oracle <manuel.koerner@rexroth.de>
    Re: perl and oracle <philippe.perrin@sxb.bsf.alcatel.fr>
    Re: perl cgi (unplug)
        Programming sockets <Crazydj@web.de>
    Re: Programming sockets <ilya@martynov.org>
    Re: Q: ftp unix to pc file transfer , script needed <Thomas@Baetzler.de>
    Re: re HELP ME: I want to know if with Perl i can use t (Anno Siegel)
    Re: Sex or Perl?  Which is better? <qvyht@removejippii.fi>
    Re: unable to install AdminMisc Module <kalinabears@hdc.com.au>
    Re: unable to install AdminMisc Module (John Stumbles)
    Re: Using Thread.pm <ilya@martynov.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 31 Aug 2001 05:03:11 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Accessing $a and $b in conjunction with goto &NAME
Message-Id: <3B8F52CF.65928480@earthlink.net>

W. James Showalter, Jr. wrote:
> 
> Hello,
> 
> I am using perl 5.6.0 on Solaris 8.
> Here is a fragment of a subroutine I use for sorting dotted values
> (e.g. OIDs and IP addresses).  It resides in a library package.
> 
> sub ipsort {
>    my $pkg = (caller)[0];
>    my @a = split(/\./, ${"$pkg\::a"});
>    my @b = split(/\./, ${"$pkg\::b"});
>    # remainder of code
> }

Considering that you always plan on using it for sorting, why not simply
have ipsort take as it's arguments the list of ips to be sorted, sort
them, and return the sorted list.

sub ipsort {
   sort {
      pack("C*", $a =~ /\d+/g ) cmp
      pack("C*", $b =~ /\d+/g )
   } @_;
}
# note that this requires each number component be in the range 0..255

sub oidsort {
   sort {
      pack("U*", $a =~ /\d+/g ) cmp
      pack("U*", $b =~ /\d+/g )
   } @_;
}
# only works when each number component is < 2**31
# use "N*" if you either don't have "U" [not all perls do] or
# if you know you've got 32 bit numbers.

The advantage of putting putting the sort in the sub, not just the
comparison function, is that you can change it to GRT or ST later
without major changes elsewhere.

sub oidsort {
   map { join ".", unpack "U*", $_ }
   sort
   map { pack("U*", $_ =~ /\d+/g ) }
   @_;
}

Or:

sub oidsort {
   map { $_->[1] }
   sort { $a->[0] cmp $b->[0] }
   map { [ pack("U*", $_ =~ /\d+/g ), $_ ] }
   @_;
}

Again, keep in mind that U works fine for numbers less than 2**31, and
if any will be larger than that, use N.

The reason I don't just use N is that for small numbers, U will give a
shorter string, [and thus faster sorting for similar strings] but which
still can be compared as normal.

-- 
"I think not," said Descartes, and promptly disappeared.


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

Date: Fri, 31 Aug 2001 07:50:11 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: can this perl script be more elegant/shorter ?
Message-Id: <3B8F4227.BB73F149@acm.org>

"John W. Krahn" wrote:
> 
> Tim wrote:
> >
> > Hi,
> >
> > Could some one help me to make this script more elegant and shorter ?
> >
> > Here is my PERL script:
> >
> > [snip]
> 
> This should get you started.
> 
> [snip]

Even shorter.


#!/usr/local/bin/perl5 -w
use strict;

$/ = ';';
my $input1  = 'chaintest.scan';
my $output2 = 'OUT.out';
my $ct_scanout;
my @chain;

open INFILE,  "< $input1"  or die "cannot open $input1: $!";
open OUTFILE, "> $output2" or die "cannot open $output2: $!";

while ( <INFILE> ) {
    next unless /CHAIN_TEST/ .. /^SCAN_CELLS/;
    $ct_scanout = 0 if /apply\s*"grp[0-9]_load"/;
    $ct_scanout = 1 if /apply\s*"grp[0-9]_unload"/;

    if ( /chain\s+"chain([0-9])"\s*=\s*"([^"]*)"/ ) {
        my $chain_number = $1;
        $_ = $2;

        tr/\\\n\t //d;
        if ( $ct_scanout ) {
            tr/01/LH/;
            }
        else {
            tr/X/0/;
            }

        @{ $chain[ $chain_number ] } = split //;
        if ( $chain_number == 7 ) {
            for ( my $i = 0; $i < @{ $chain[ $chain_number ] }; $i++ ) {
                print OUTFILE "\n(", $ct_scanout ? 'ct_so ' : 'ct_si ';
                print OUTFILE $chain[$_][$i] for 1 .. 7;
                print OUTFILE ' )';
                }
            }
        }
    }

__END__



John
-- 
use Perl;
program
fulfillment


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

Date: Fri, 31 Aug 2001 07:35:05 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Dangerous Perl Script?
Message-Id: <slrn9oug7r.174.tim@vegeta.ath.cx>

Me parece que Godzilla! <godzilla@stomp.stomp.tokyo> dijo:
> Wyzelli wrote:
> 
> > Martien Verbruggen wrote:
> > > What A Man ! wrote:
> 
> (snipped)
> 
> > > > I'm told the below script is dangerous. It just looks like a bunch of
> > > > regexs to me. Can someone explain what it does?
> 
> > In addition, if you submit a 200Mb POST, then your server will continue to
> > read data, allocating more and more RAM to your process, and then possibly
> > swap, until maybe it eventually grinds to a halt.  This is a form of DOS
> > attack, to which this script is vulnerable.
>  
> > CGI.pm on the other hand has built in limits (configurable) of how large a
> > POST to accept, after which it errors and dumps the connection.
> 
> 
> Yours is Perl 5 Cargo Cultism Dogma. Either method can be easily
> configured to limit Content Length. You are inferring a custom
> read and parse cannot be configured to limit input length.
> 
>     if ($ENV{'CONTENT_LENGTH'} > 131072)
>      { &Aiyaka; }
> 
> My subroutine Aiyaka is rather creative in what it does.

Does it attempt to nullify all variables of the name $Ryoko, and kill
the pids of all processes who attempt to access the variable $Tenchi?

-- 
It is a fool's prerogative to utter
truths that no one else will speak.
    -- Morpheus, The Sandman


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

Date: 31 Aug 2001 00:49:23 -0700
From: ianb@ot.com.au (Ian Boreham)
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <f02c4576.0108302349.757af962@posting.google.com>

"Rob - Rock13.com" <rob_13@excite.com> wrote in message news:<Xns910CE1C80456Drock13com@64.8.1.227>...
> Villy Kruse
> > It also depends on the web server if
> > it uses the file name suffix to determine the type of
> > executable file or if it gets that information from the '#!"
> > line in the file. 
> 
> Or both. Apache can be set to use .cgi to designate CGI programs 
> and uses the #! to find out what to use to run the program.

I did a few scripts to run on an Apache web server several months ago,
and it was configured to run scripts with the extension .pl using
modperl, but those with the extension .cgi were run according to the
#! line (since .cgi could be any executable file type), thereby being
compiled and run by real perl.

Developing with modperl was a pain, since it compiles and then hangs
onto your script. It was easier to develop using .cgi (forcing
recompilation with each CGI request), and then convert to .pl when it
had stabilised, to get the efficiency benefit.

I understood it to be the default configuration, but I couldn't swear
to it. There may well be better ways to develop under modperl, but I
didn't have time to find out.


Ian


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

Date: 31 Aug 2001 02:01:16 -0700
From: phil@snark.freeserve.co.uk (Phil Hibbs)
Subject: Re: File::Find not recursing on Win32 Perl 5.001
Message-Id: <979ae699.0108310101.52c53753@posting.google.com>

> Phil Hibbs wrote:
> >It's 5.001 as per the subject line. And no, I can't upgrade it,
> >much though I'd like to.

Bart Lateur <bart.lateur@skynet.be> wrote:
> You still using Win3.1, or NT3.51? If no, why not?
> Funny how people find it natural to upgrade their soft 
> if it's from Microsoft, but not from anything else.

I can't upgrade it because there are over 4000 copies installed all
over Europe, and they're all working perfectly as part of an end user
application suite. The logistics of upgrading them all, let alone the
integration testing involved in testing the existing perl scripts for
compatability with 5.6, are prohibitive if the only apparent problem
is that little old me can't get a directory scan working. The PHB is
more likely to say "don't use perl, then". Like I said, I'd like to
upgrade it, but I can't.

Phil.


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

Date: Fri, 31 Aug 2001 07:43:17 GMT
From: "Dale Henderson" <projectobjects@earthlink.net>
Subject: Re: ftp unix to pc file transfer , script needed
Message-Id: <peHj7.9373$Fv3.732702@newsread2.prod.itd.earthlink.net>

Does Net::FTP module not install for DJGPP?


#! perl

($host,$id,$pw,$filename) = @ARGV;
$directory = "."; # fill in the blank

use Net::FTP;
    $ftp = Net::FTP->new($host, Debug => 0);
    $ftp->login($id,$pw);
    $ftp->cwd($directory);
    $ftp->get($filename);
    $ftp->quit;

<u410400390@spawnkill.ip-mobilphone.net> wrote in message
news:l.999223728.1606384277@[63.127.215.130]...
> Hi,
>
> I need a ftp perl script file that can run on a pc\dos environment
> to get a file from a unix solaris 2.8 such systems after cd to a certain
directory. The command to transfer the file should look like this:
>
> scriptcommand <nameofthehost> <userid> <password> filename
>
> does anyone has such script?.
> Jim
>
>
>
>
> --
> Sent  by  msg124 from hotmail part from  com
> This is a spam protected message. Please answer with reference header.
> Posted via http://www.usenet-replayer.com/cgi/content/new
>




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

Date: Fri, 31 Aug 2001 11:13:28 +0200
From: "B. Caligari" <bcaligari@fireforged.com>
Subject: Re: Godzilla Stomps Code Red
Message-Id: <9mnk7b02kcj@enews1.newsguy.com>


"Richard A. Evans" <EvR@compuserve.com> wrote in message
news:9mmojq$f2b$1@suaar1aa.prod.compuserve.com...
> From previous email:
> > so abhorrent and morally repugnant, it is unsurpassed by any
> > other racist events here on the internet. This first incident,
> > is, of course, your posting of near two pages of vile, vulgar
> > and vehement racial slurs, under your fake name, Joe Kline.
> >
>
> I know I will be flamed for making this observation, but I find it
> interesting that you attack people for racial slurs, but seem to think
> gender-based slurs are acceptable, as you so frequently attack men.

She desperately needs a man.

B.




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

Date: 31 Aug 2001 02:30:38 -0700
From: nancy.chan@plink.cityu.edu.hk (Nancy Chan)
Subject: Mix 2 wave files
Message-Id: <146d6ed4.0108310130.2910bcd0@posting.google.com>

Hi all,
   I want to mix 2 sound files with Perl, I have tried Audio:Wav and
Audio::Mix, I don't know how to do this with these 2 modules. Do
anyone know how to do this?
    Please Help !! 
 

   Do anyone can point me to some reference of mixing sound files? or
Tell me the idea behind?
Regards,
Nancy


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

Date: Fri, 31 Aug 2001 04:13:48 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Net::SNMP and unsigned/big integers
Message-Id: <3B8F473C.173AF52C@earthlink.net>

Andreas Lidberg wrote:
> 
> I have a little problem... when using Net::SNMP to fetch inoctets from
> routers the response is a negative (2´s complement) when value is over
> 2^31. Is there a way to get Perl to handle this as an unsigned
> integer? How? The result from get_request is a hash reference and no
> matter how I do I still just get the negative result.

Have you tried
	my $unsigned_version = $signed_version & 0xFFFFFFFF;


-- 
"I think not," said Descartes, and promptly disappeared.


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

Date: Fri, 31 Aug 2001 03:56:49 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Partial matching of a regular expression
Message-Id: <3B8F4341.ED6AB7D0@earthlink.net>

JP Belanger wrote:
> 
> Is there a way in perl to "partially match" on input ?
> 
> For example, with expression /hello/ and input "hel", I'd like to know
> that the regular expression is currently matching, but not done yet.

use re 'eval'; # this is lexically scoped.  Be careful with it!
my $regex = join '', map { $_ . qq/(?{ print "letter $_\n" })/ },
	split //, "hello";
"hel" =~ /^$regex/;

-- 
"I think not," said Descartes, and promptly disappeared.


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

Date: Fri, 31 Aug 2001 10:03:13 +0200
From: Valentin 30IR976 <radiotito@yahoo.com>
Subject: pattern for types of files ?
Message-Id: <3B8F44C1.5E0E7F3A@yahoo.com>

Hello. I am trying to recognize some kind of files by extensions on my
Perl program. I try to do:

if ($namefile eq "*.mp3") ....
or if ($namefile eq <*.mp3>)...

but id doesnt work

Any idea for this newbie...

Thanks in advance


Tito



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

Date: Fri, 31 Aug 2001 10:12:39 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: pattern for types of files ?
Message-Id: <3B8F46F7.7040308@post.rwth-aachen.de>

Valentin 30IR976 wrote:

> Hello. I am trying to recognize some kind of files by extensions on my
> Perl program. I try to do:
> 
> if ($namefile eq "*.mp3") ....
> or if ($namefile eq <*.mp3>)...
> 
> but id doesnt work

Indeed. Better use a regex:

if ($namefile =~ /\.mp3$/i) # case-insensitive to detect .MP3 and the
                               lot

Tassilo

PS: Don't let yourself be fooled by a possible comment of Godzilla! 
involving weird usage of substr or whatsoever and suppliying a benchmark 
that clearly shows that it'd be 3% quicker on a record of 100000 files.
-- 
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};



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

Date: 31 Aug 2001 12:38:50 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Perl 5.6.1 and PerlCC (B module) bombs using tie.
Message-Id: <87pu9c4o9x.fsf@abra.ru>

>>>>> On 30 Aug 2001 18:14:20 -0700, callisia@my-deja.com (Jonan) said:

J> Hello,
J>  I am using perl5.6.1 and perlcc to compile some code using the B
J> module. Everything works well except when using tie. I am using tie
J> with the GDBM_File and DB_File modules to tie a hash.
J>    When ever any code with tie is run the executable ends up in a CPU
J> and memory eating loop never to return.

J>     Is this a known problem ? Any work arounds ?

AFAIK PerlCC is not stable enough yet. I never seen it work with any
Perl application I've wrote which is more complex than 'Hello, world'.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Fri, 31 Aug 2001 09:48:25 +0200
From: "Manuel Körner" <manuel.koerner@rexroth.de>
Subject: perl and oracle
Message-Id: <9mnfg2$d9r3@sunny.mannesmann.de>

Hi to all!

I use perl and orcle and i have a problem if i want to insert a row in use
with "sysdate" and a sequence.
I don't know the syntax for parameters like this.
The perlcode looks like:
my $sth=$dbh->prepare("insert into table values(?,?,?));
$sth->execute("sequence.nextval", "test", "sysdate");
I know the quotes for "sequence.nextval" and "sysdate" are wrong.
How can i solve this problem?

Thanks for any help
Manuel Körner





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

Date: Fri, 31 Aug 2001 10:45:08 +0200
From: Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr>
Subject: Re: perl and oracle
Message-Id: <3B8F4E94.55317394@sxb.bsf.alcatel.fr>

"Manuel Körner" wrote:
> The perlcode looks like:
> my $sth=$dbh->prepare("insert into table values(?,?,?));
> $sth->execute("sequence.nextval", "test", "sysdate");
> I know the quotes for "sequence.nextval" and "sysdate" are wrong.

I use a command string like :
"insert into table values(seq_commande.nextval,$num_cl,SYSDATE,$type)"

So I use Oracle's SYSDATE function, instead of Perl.
And it works fine (with me :-)

-- 
PhP

($r1,$r2,$r3,$r4)=("19|20","0|1","28|29","5|24");($r5,$r6)=("9|10|15|16|$r1|$r2","9|10|$r3");%h=("1|",$r6,"1=","[1-5]|2[0-4]","1/","0|19","1\\","6|25","2|","0|6|19|25|$r6","2/","1|20","2\\",$r4,"3|","$r2|6|$r1|25|$r6","3/",$r4,"4|","$r2|$r1|$r6","4=","2|3|4|11|12|13|14|21|22|23","4/",$r4,"4\\",15,"5|","$r2|9|15|$r1|20|$r3","5/",10,"6|",$r5,"7|",$r5,"7/",$r3);for($l=1;$l<8;$l++){b:for($i=0;$i<30;$i++){c:foreach(keys
%h){next c if(!(/^$l(.*)$/));$a=$1;if($i=~/^($h{$_})$/){print $a;next
b;}}print " ";}print "\n";}


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

Date: 31 Aug 2001 02:30:41 -0700
From: unplug@poboxes.com (unplug)
Subject: Re: perl cgi
Message-Id: <90f52794.0108310130.53a0e986@posting.google.com>

mbower@ibuk.bankgesellschaft.de (mbower) wrote in message news:<3b8e30a3.1811009671@news>...
> check out the apache/logs/error_log file as well for more specific
> messages,  but you should also have
> <body> </body>    in the html.
> 
> 
> On Thu, 30 Aug 2001 11:59:56 GMT, "s.petersson"
> <stefan@wirelessopinion.com> wrote:
> 
> >S: This could be an Apache thingy. How is the "ScriptAlias" set, and how
> >does the <Directory> directive look for the cgi-bin in Your Apache config
> >file?

Below is the error message from error log.
Premature end of script headers: /home/user/public_html/patha/test.cgi

I have set the following in the apache.
<Directory /home/*/public_html>
    #AllowOverride None
    Options +ExecCGI
    #SetHandler cgi-script
    Order allow,deny
    Allow from all
</Directory>
AddHandler cgi-script .cgi

I haven't change ScriptAlias and leave it as default.
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

I have tried to change the configuration file but it always failed to
access cgi program under the path of public_html.

Anyone has such experience.  Please Help.

Rgds,
unplug


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

Date: Fri, 31 Aug 2001 11:41:38 +0200
From: Crazydj <Crazydj@web.de>
Subject: Programming sockets
Message-Id: <3B8F5BD2.7A45D8D6@web.de>

Hi @ll!!! =)
I have got a question on how to program sending sockets.
To send an email through an SMTP server I would it do this way:

use IO::Socket;
$socket = new IO::Socket::INET(PeerAddr => 'test.server.net',
                                                         PeerPort =>
'25',
                                                           Proto =>
'tcp') || die "Cannot create socket: $!";

print $socket "HELO mailserver.net";
print $socket "MAIL FROM: perllover@crazydj.de";
print $socket "RCPT TO: nice@tester.net";
print $socket "DATA";
print $socket "bla test and so on";
print $socket ".";
print $socket "QUIT";
close($socket);

This program can be run without any problems, but I will never receive
this email! Is this a fault of my perlscript or maybe a fault of my
mailserver?
Where can I get a detailed Tutorial about Socket Programming with Perl?
Thanx and best greets

Crazdj





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

Date: 31 Aug 2001 13:52:52 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Programming sockets
Message-Id: <87y9o036a3.fsf@abra.ru>

>>>>> On Fri, 31 Aug 2001 11:41:38 +0200, Crazydj <Crazydj@web.de> said:

C> Hi @ll!!! =)
C> I have got a question on how to program sending sockets.
C> To send an email through an SMTP server I would it do this way:

C> use IO::Socket;
C> [..skip..]

It is much more easier just use Net::SMTP.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Fri, 31 Aug 2001 10:15:02 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Q: ftp unix to pc file transfer , script needed
Message-Id: <pphuotsla0pddoccc5r8698s0qc4dgjg0d@4ax.com>

On Fri, 31 Aug 2001, u410400390@spawnkill.ip-mobilphone.net wrote:
>I need a ftp perl script file that can run on a pc\dos environment
>to get a file from a unix solaris 2.8 such systems after cd to a certain directory. The command to transfer the file should look like this:
>
>scriptcommand <nameofthehost> <userid> <password> filename
>
>does anyone has such script?.

You could've tried ncftp or ncftpget. Or someting like the code below.
This should work, although there sure is room for improvement. 

#!/usr/bin/perl -w

use strict;
use warnings;
use Net::FTP(2.40); # Net::FTP 2.33 is buggy!

my $rc = 0;

# check parameters
if (@ARGV < 5) {
  print <<END;
Usage: ftpget [server] [user] [password] [dir] [file]
END
  $rc = 5;
} else {

  my( $server, $user, $pass, $dir, $file ) = @ARGV;

  if( my $ftp = Net::FTP->new($server) ){

    # add your file extensions that require binary transfer
    # here - or just default to binary transfers.
    if( $file =~ m/.*?\.(zip|pdf)$/i ){
      $ftp->binary();
      print "Selected BINARY transfer mode for file $1\n";
    }

    if ($ftp->login($user, $pass)) {
      # switch to passive mode
      $ftp->pasv();
      print "$server: Logged in succesfully\n";
      if( $ftp->cwd($dir) ){

        if ($ftp->gut($file)) {
          print "Got $file from $server\n";
        } else {
          print "Could not download $file from $server\n";
          $rc = 15
        }

      } else {
        print "$server: could not cd to $dir: $@\n";
        $rc = 10
      }

    } else {
      print "$server: could not log in: $@\n";
      $rc = 5
    }

    $ftp->quit;
    $ftp->close();

  } else {
    print "$0: FTP connect to $server failed: $@\n";
  }
}

exit ($rc);
-- 
Thomas Baetzler - http://baetzler.de/ - Clan LoL - http://lavabackflips.de/
I am the "ILOVEGNU" signature virus. Just copy me to your signature.
This post was infected under the terms of the GNU General Public License.


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

Date: 31 Aug 2001 08:52:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: re HELP ME: I want to know if with Perl i can use the most popular scientific functions
Message-Id: <9mnj8e$evs$1@mamenchi.zrz.TU-Berlin.DE>

According to Mike Solomon <mike_solomon@lineone.net>:
> >I´m very interested in know is Perl let me use the scientific
> >funciton like sin, cos, sqrt, Statisticals functions.
> 
> lookat
> 
> perldoc -f sin
> perldoc -f cos
> perldoc -f sqrt

For others, see perldoc -f POSIX

Anno


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

Date: Fri, 31 Aug 2001 09:40:33 GMT
From: Hessu <qvyht@removejippii.fi>
Subject: Re: Sex or Perl?  Which is better?
Message-Id: <3B8F5A56.3E8F5104@removejippii.fi>



Mr Sunblade wrote:
> 
> Hessu wrote:
> 
> > None wrote:
> > >"none"
> >
> > I'm doing perl all night long to my Girl!
> > So did I miss something here?
> >
> > YAPF
> 
> Would that be a  "Perl necklace" reference? ;)

No

> Ok, time to grow up now...

Sorry, but I'll never grow up(8D
 
> --
> "Evil will always triumph because Good is *dumb*."
> -- Dark Helmet, 'Spaceballs: The Movie'


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

Date: Fri, 31 Aug 2001 16:55:14 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: unable to install AdminMisc Module
Message-Id: <999278992.251454@clover.origin.net.au>


"Klaus Peter Weirich" <weirich@netzpartner.de> wrote in message
news:3b8e8bf3$1@netnews.web.de...

>     3) Rename AdminMisc310.pll to AdminMisc.pll and

Make it AdminMisc.dll and I think your problem will be solved.

Cheers,
Rob




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

Date: 31 Aug 2001 02:59:29 -0700
From: john.stumbles@ntlworld.com (John Stumbles)
Subject: Re: unable to install AdminMisc Module
Message-Id: <7f40850b.0108310159.1294c613@posting.google.com>

Klaus Peter Weirich <weirich@netzpartner.de> wrote in message news:<3b8e8bf3$1@netnews.web.de>...
> Hi Newsgroup,
> I'm an absolute Beginner an forced to use the win32::adminmisc module. I've 
> installed ActiveState WIN32 Perl Version 509 and downloaded the module from CPAN 
> (I think Version 971022). I've followed the instructions from readme-file: 
> 
> 
> I N S T A L L A T I O N:
> ------------------------
> If you are using the ActiveState Win32 Perl...
>     1) Copy AdminMisc.pm to the <perldir>\lib\win32 directory.
>     2) Create a <perldir>\lib\auto\win32\adminmisc directory.
>     3) Rename AdminMisc310.pll to AdminMisc.pll and copy it to
>        the <perldir>\lib\auto\win32\adminmisc directory.
>        *IF you are using a build of Perl that is not compliant with the
>         build of adminmisc that comes with this archive then you need to
>         download a compatible version. See "Parse Exception Error" below.
>     4) You are all ready to use the module. Look at the test.pl script
>        for an examples.
> 
> 
> But all I receive is the following message:
> 
> 
> Can't locate loadable object for module Win32::AdminMisc in @INC (@INC 
> contains:
>  E:\Perl\lib E:\Perl\site\lib .) at netadmin.pl line 1
> BEGIN failed--compilation aborted at netadmin.pl line 1.
> 
> 
> Why?
Dunno, sounds like it can't find the DLL.
On my installation my @INC is
  D:\lib
  D:\site\lib
  .
and I have 
  D:\lib\auto\win32\adminmisc\AdminMisc.DLL

so you should have yours in 
  E:\Perl\lib\auto\win32\adminmisc\AdminMisc.DLL
- have you?

--
John Stumbles                                 http://www.stumbles.org/John
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


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

Date: 31 Aug 2001 12:35:32 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Using Thread.pm
Message-Id: <87u1yo4off.fsf@abra.ru>

>>>>> On Thu, 30 Aug 2001 18:05:49 -0700, The Small Kahuna <person@company.com> said:

TSK> I have access to perl versions 5.005_03 and 5.6.1.  I'm trying to 'use
TSK> Thread;' and I keep getting: Can't locate Thread.pm in @INC.  I did a
TSK> find $DIR -follow -name Thread.pm on the entire directory tree (which
TSK> took a while) and it ain't there.

TSK> [..skip..]

I'm not sure (I never used threads in Perl) but AFAIK you should
rebuild your Perl with support of threads. If Perl is build without
threads support it should not have Thread.pm.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

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 1666
***************************************


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