[16262] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3674 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 14 21:05:27 2000

Date: Fri, 14 Jul 2000 18:05:14 -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: <963623114-v9-i3674@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 14 Jul 2000     Volume: 9 Number: 3674

Today's topics:
    Re: "Perl Bowling" revisited with an array question <lr@hpl.hp.com>
    Re: [Perl] get email content from unix a/c <nospam@nospam.com>
        ANNOUNCE: Bit::Vector 5.8 release candidate <sb@muccpu1.muc.sdm.de>
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nospam@nospam.com>
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! (NP)
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! p3rlc0dr@my-deja.com
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nospam@nospam.com.invalid>
    Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! p3rlc0dr@my-deja.com
    Re: Bizarre BEGIN block problem <nospam@nospam.com>
    Re: Bizarre BEGIN block problem <nospam@nospam.com>
    Re: CGI problem, newbie, code follows.... (Mads Orbesen Troest)
    Re: CGI problem, newbie, code follows.... <taboo@doofa.net>
    Re: file endings with regexps... (jason)
    Re: file endings with regexps... (jason)
        filling out www froms using LWP <gorbeast@SPAMSUCKS.subduction.org>
    Re: generating exe file from perl program <nospam@nospam.com.invalid>
    Re: HOW TO FTP A FILE IN PERL SCRIPT <nospam@nospam.com>
    Re: I want to use ? in CGI! <taboo@doofa.net>
        multiline & single line reqexp question <vibrato@my-deja.com>
    Re: Net/Config.pm problem <gerard@NOSPAMlanois.com>
    Re: Net::FTP error:Bad arg length for Socket::unpack_so (David Efflandt)
    Re: New book on web dev with Perl (Tad McClellan)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 14 Jul 2000 17:41:19 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: "Perl Bowling" revisited with an array question
Message-Id: <MPG.13d9530a66160ae298abcc@nntp.hpl.hp.com>

In article <7abt00kcgy.fsf@merlin.hyperchip.com> on Fri, 14 Jul 2000 
14:34:03 GMT, Ala Qumsieh <aqumsieh@hyperchip.com> says...
> 
> "Jim Kauzlarich" <o1technospam@skyenet.nospam.net> writes:
> 
> > So, I guess my question is:  Is there any function that will shrink (at this
> > point I don't care which end it comes off of) an array, and return the newly
> > shrunken array.
> 
> Hmmm .. what's wrong with:
> 
> 	my @all_except_last  = @array[0 .. $#array - 1];
> 	my @all_except_first = @array[1 .. $#array];
> 
> ??

Performance (unnecessary copying compared with splice()).

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 15 Jul 2000 00:45:26 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: [Perl] get email content from unix a/c
Message-Id: <8koc76$6h6$4@216.155.32.162>

In article <slrn8mt6sd.cr4.tadmc@magna.metronet.com>, 
tadmc@metronet.com (Tad McClellan) wrote:

 | >I want to run a perl script if somebody send email to my email a/c:
 | 
 | 
 | Wow!
 | 
 | Your email has air conditioning?
 | 
 | Mine has to make do with fans.  :-(

soda | nose > keyboard

ahhhh Schweppervescence! *cough choke* :D

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 14 Jul 2000 22:45:13 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: ANNOUNCE: Bit::Vector 5.8 release candidate
Message-Id: <8ko55p$st8$1@solti3.sdm.de>

                    =====================================
                      Package "Bit::Vector" Version 5.8
                    =====================================

                            - RELEASE CANDIDATE -

        This package is available for download from my web site at

                  http://www.engelschall.com/u/sb/download/


Prerequisites:
--------------

    Perl version 5.000 or higher, and an ANSI C compiler (!)
                                         ^^^^^^

What's new in version 5.8:
--------------------------

 +  Changed "na" to "PL_na" in Vector.xs in order to make the module
    ready for Perl 5.6.0.
 +  Removed the error messages which appeared at global destruction
    time with Perl 5.6.0.
 +  Changed the corresponding test script (t/02____destroy.t) accordingly.
 +  Optimized the "strEQ" away from the typemap section in Vector.xs.
 +  Fixed the misspelled word "whether" in the documentation.
 +  Added method "Power()".
 +  Added overloaded operator "**" (for exponentiation).
 +  Changed method "Copy()"; the two vectors do not need to have the same
    size anymore. The method will copy as much as will fit or fill up
    with 0's or 1's (depending on the sign of the source) if necessary.
 +  Changed the corresponding test script (t/09_parameters.t) accordingly.


Abstract:
---------

    Bit::Vector is an efficient C library which allows you to handle
    bit vectors, sets (of integers), "big integer arithmetic" and
    boolean matrices, all of arbitrary sizes.
    
    The library is efficient (in terms of algorithmical complexity)
    and therefore fast (in terms of execution speed) for instance
    through the widespread use of divide-and-conquer algorithms.
    
    The package also includes an object-oriented Perl module for
    accessing the C library from Perl, and features overloaded
    operators for maximum ease of use.
    
    The C library can nevertheless be used stand-alone, without Perl.


Legal issues:
-------------

    This package with all its parts is
    
    Copyright (c) 1995 - 2000 by Steffen Beyer.
    All rights reserved.
    
    This package is free software; you can use, modify and redistribute
    it under the same terms as Perl itself, i.e., under the terms of
    the "Artistic License" or the "GNU General Public License".
    
    The C library at the core of this Perl module can additionally
    be used, modified and redistributed under the terms of the
    "GNU Library General Public License".
    
    Please refer to the files "Artistic.txt", "GNU_GPL.txt" and
    "GNU_LGPL.txt" in this distribution, respectively, for details!


Author's note:
--------------

    This is a release candidate.

    Please report any bugs or ugly things you find!
    Suggestions are welcome!

    I hope you will find this new version beneficial!


Yours sincerely,
--
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/ (Who am I)
    http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
    http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)


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

Date: 14 Jul 2000 22:14:29 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8ko3c5$l7d$0@216.155.32.162>

In article <8ko0q4$1n6$1@nnrp1.deja.com>, p3rlc0dr@my-deja.com wrote:

 | In article <8kntta$8ab$0@216.155.32.162>,
 |   The WebDragon <mactech@webdragon.net> wrote:
 | > In article <8knrks$tlt$1@nnrp1.deja.com>, p3rlc0dr@my-deja.com wrote:
 | >
 | > *plonk*
 | 
 | THE WebDragon admits that I was right all along.  Ahh, the killfile.
 | The last remaining white flag on USENET.

AH! Ganesha finally admits I was right all along. Ahh, the sweet smell 
of sour grapes. The last remaining bastion of the troll. 

Say goodnight, Gracie.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Fri, 14 Jul 2000 22:38:22 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <yDMb5.315233$MB.5260246@news6.giganews.com>

On 14 Jul 2000 22:04:18 GMT, David H. Adler <dha@panix.com> wrote:
: 
: JARF: The sigfile of a new generation?  :-)

I've got no beef with Randal, but: please, no.  :-)  Without ruining
anyone's fun with JARF and such pursuits, let's keep things in
perspective... Randal and other folks who write Perl books are
*technical professionals*, not members of The Backstreet Boys or Blue
Oyster Cult.  We do not point our fingers at women so that our roadies
can corral them into our hotel rooms.  We do not limit ourselves to one
string on the bass guitar while we chug Jack Daniel's.  And, with the
exception of Randal, perhaps, we wear pants to work.

Let's not go too overboard, okay?  We're people just like everybody
here (except "Ganesha", of course).  We appreciate it!

-- 
Nate II



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

Date: Fri, 14 Jul 2000 22:49:36 GMT
From: p3rlc0dr@my-deja.com
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8ko5ds$4tr$1@nnrp1.deja.com>

In article <8ko3c5$l7d$0@216.155.32.162>,
  The WebDragon <mactech@webdragon.net> wrote:
>
> AH! Ganesha finally admits I was right all along. Ahh, the sweet smell
> of sour grapes. The last remaining bastion of the troll.
>
> Say goodnight, Gracie.

You're a stalker and a liar.  LEAVE ME ALONE.  The fact that you haven't
killfiled me yet confirms that you're obsessed with me, that you're a
liar for not killfiling me and that you're stalking me because you won't
quit.

-- Ganesha


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 15 Jul 2000 00:06:09 GMT
From: The WebDragon <nospam@nospam.com.invalid>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8ko9th$6h6$0@216.155.32.162>

In article <8ko5ds$4tr$1@nnrp1.deja.com>, p3rlc0dr@my-deja.com wrote:

 | In article <8ko3c5$l7d$0@216.155.32.162>,
 |   The WebDragon <mactech@webdragon.net> wrote:
 | >
 | > AH! Ganesha finally admits I was right all along. Ahh, the sweet smell
 | > of sour grapes. The last remaining bastion of the troll.
 | >
 | > Say goodnight, Gracie.
 | 
 | You're a stalker and a liar.  LEAVE ME ALONE.  The fact that you haven't
 | killfiled me yet confirms that you're obsessed with me, that you're a
 | liar for not killfiling me and that you're stalking me because you won't
 | quit.

Liar liar pants on fire! 

I'm a stalker because I respond on Usenet to posts specifically directed 
to me? 

I NEVER said I killfiled you personally. Neither explicitly or implied. 
I suggest that you re-read what I said. 

You won't quit either.. does that mean you're stalking me?? AIEEEEEEEE! 
RUN AWAY ! RUN AWAY ! SHE'S STALKING ME AND BEING HATEFUL AND WON'T STOP 
LYING ABOUT ME! I THINK YOU'RE MEAN! GO AWAY! 

*Cough**strangled attempt not to laugh out loud**Cough*

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Sat, 15 Jul 2000 00:31:33 GMT
From: p3rlc0dr@my-deja.com
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8kobd5$99v$1@nnrp1.deja.com>

In article <8ko9th$6h6$0@216.155.32.162>,
  The WebDragon <mactech@webdragon.net> wrote:
> In article <8ko5ds$4tr$1@nnrp1.deja.com>, p3rlc0dr@my-deja.com wrote:
>
> I NEVER said I killfiled you personally. Neither explicitly or
implied.
> I suggest that you re-read what I said.

You, mactech@webdragon.net, wrote the following in
<8kntta$8ab$0@216.155.32.162>.  You can explain your interpretation of
the following later:
"
I'm done with this thread, as it has nothing to contribute to the group.

*plonk*
"

Now, stalker, are you *REALLY* done with this thread?  You're still
responding to me AND this thread.  Or newbie, don't you know what
*plonk* and *done with this thread* REALLY means?

-- Ganesha



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 14 Jul 2000 23:19:12 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Bizarre BEGIN block problem
Message-Id: <8ko75g$orv$2@216.155.32.162>

In article <5mnb5.62962$_b3.1834587@newsread1.prod.itd.earthlink.net>, 
"Ed Foy" <ed@nospam.com> wrote:

 | I also have a hard and fast rule: never put private email addresses in
 | newsgroups. This policy keeps the SPAM to a low roar so I spend much
 | less time wading through junk mail and updating TWIT filters. It's
 | called an ounce of prevention.

Ed: do what I do: use a spamblock but still manage to provide an e-mail 
address for any clueful entity.. which is what he was referring to. 

 | >What I was going to say in email:
 | >
 | >
 | >I (and probably everybody else) have no interest in potential bugs
 | >in two year old software.
 | >
 | >Sticking with 5.004 is volunteering for support problems.
 | 
 | That is what my ISP provides. That is what I must use until they
 | upgrade. For better or worse, the real world doesn't upgrade just

I'm stuck with 5.004 myself as the current version of MacPerl (until OsX 
starts shipping in quantity, or until MacPerl gets it's much needed and 
long awaited upgrade, as the current 520r4 release of MacPerl is indeed 
5.004. 

 | because there is something newer available. "Newer" doesn't mean better,
 | just a different set of bugs to contend with. Witness: everything
 | Microsoft has produced from day one.

indeed.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 14 Jul 2000 23:21:50 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Bizarre BEGIN block problem
Message-Id: <8ko7ae$orv$3@216.155.32.162>

In article <8kmmqp$1k5$1@news.news-service.com>, "Brendon Caligari" 
<bcaligari@shipreg.com> wrote:

 | > Just gotta love these NGs!
 | >
 | > Ed
 | >
 | >
 | 
 | what's an NG?
 | 
 | 

isn't that the short form of "NFG" ? :D

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Fri, 14 Jul 2000 22:28:00 GMT
From: mads@troest.NEVERMORE.dk (Mads Orbesen Troest)
Subject: Re: CGI problem, newbie, code follows....
Message-Id: <k6fk2tedC4v7-pn2-ioul0TSZDd1z@mads.lokal.net>

On Fri, 14 Jul 2000 22:53:21, rsmallwood@mindspring.com (Russell 
Smallwood) wrote:

> If this is a dumb question, please point me in the right direction, 
> perhaps some recommended reading. I've read the official guide to 

You shoud either do a: print $wp->header(); in order to return a 
correct HTTP response, or, if you absolutely have to, return it 
manually (Content-type: text/html (+additional headers if any) 
\r\n\r\n).

      ... /\/\\ads Orbesen Troest <mads@troest.NEVERMORE.dk>
            [http://www.sprog.auc.dk/~motr96]

(Please remove NEVERMORE from address when replying via email...)


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

Date: 14 Jul 2000 22:52:20 +1000
From: "Kiel Stirling" <taboo@doofa.net>
Subject: Re: CGI problem, newbie, code follows....
Message-Id: <396f0d04_1@nexus.comcen.com.au>


rsmallwood@mindspring.com (Russell Smallwood) wrote:
>My question is very simple, when I run this:
>
>
>use CGI;
>
>$wp=new CGI;
>
>$name=$wp->param ('name');
>$organization=$wp->param ('organization');
>$workphone=$wp->param ('workphone');
>$fax=$wp->param ('fax');
>$URL=$wp->param ('URL');
>$email=$wp->param ('email');
>$title=$wp->param ('titile');
>
>	print >>EOF;
>
><html>
>
><head>
>
><title>Whoops</title>
></head>
>
><body topmargin='0' leftmargin='0'>
>
><p><img border='0' src='images/smallheader.JPG' width='527' height='61'>
></p>
><p><b><font face='Arial' size='5'>  Whoops..</font></b></p>
><p><font face='Arial'>     Please fill out the form 
>entirely
>before hitting the submit button.<br>
>            You 
>may use
>your browser\'s <b>"back"</b> button to continue without 
>loosing your
>work.</font></p>
><p> </p>
>
></body>
>
></html>
>
>EOF
>
>I get this
>
>CGI Error
>The specified CGI application misbehaved by not returning a complete set 
>of HTTP headers. The headers it did return are:
>
>
>Bareword found where operator expected at D:\Maple\wwwroot\scripts
>\webimportdemo.pl line 22, near "
>
>
>Line 22 is 
>
><title>Whoops</title>
>
>If this is a dumb question, please point me in the right direction, 
>perhaps some recommended reading. I've read the official guide to 
>Programming with CGI.pm but as I am not an HTML programmer I was hoping 
>to create some mockups in Front Page, and cut and paste them into my 
>scripts using print >>.  Perhaps this is a bad idea?  Weird thing is 
>that I did this on a couple of other pages and they work fine.  I've 
>compared them to this and they seem to be identical.
>
>Russell


I think you need to print the Content type to the browser
try above your html printing the following

print "Content-Type: text/html\n\n";

This must end in two newlines (\n\n)

Kiel Stirling





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

Date: Sat, 15 Jul 2000 00:52:50 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: file endings with regexps...
Message-Id: <MPG.13da532d16e9c25d9896b4@news>

Drew Simonis wrote ..
>"Michael D. Hofer" wrote:
>> 
>> Drew Simonis wrote:
>> >
>> > "Michael D. Hofer" wrote:
>> > >
>> > > Okay, but why not
>> > >
>> > > my $path = "/mitglied/sd.fjn.sdf.html";
>> > > my $ending = (split '\.',$path)[-1];
>> > >
>> > > ??
>> >
>> > my $path = '.hidden_file';
>> 
>> returns 'hidden_file', the last part of the filename, since _ isn't a
>> path-or-file-name-part-delimiter in any of the common systems we see.
>> 
>
>My point exactly.  The OP will get the file name instead of the 
>file extension.  I think the OP is stuck in a Windows world where
>extensions mean something.

or they're testing a known set of files .. or have already culled /^./ 
files in their readdir (fairly commonplace) .. assumptions get us no 
where - just work to the spec

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Sat, 15 Jul 2000 00:57:01 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: file endings with regexps...
Message-Id: <MPG.13da542b4cc8ae549896b5@news>

Michael D. Hofer wrote ..
>jason wrote:
>> 
>> sept00@my-deja.com wrote ..
>> >I'm trying to get a file ending out of a variable. Now I've been trying
>> >to solve it with a regexp for about an hour (online documentation and
>> >books as well) and I really can't get it to work, so this is what I've
>> >got:
>> >
>> >  $path = "/mitglied/sdfjnsdf.html";
>> >  $ending = $path;
>> >
>> >  @temp = split ('\.', $ending);
>> >  $length = scalar @temp;
>> >
>> >  $ending = @temp[$length - 1];
>> >
>> >How can this be done in a simple regexp?!?
>> 
>> no need to use a regex .. you know the character you're looking for ..
>> and you want everything after the right-most one of them
>> 
>> this seems to be what you're trying to get (excuse me if I adjusted your
>> input slightly)
>> 
>>   my $path = "/mitglied/sd.fjn.sdf.html";
>> 
>>   my $ending = substr $path, rindex( $path, '.') - length($path) +1;
>
>Okay, but why not
>
>my $path = "/mitglied/sd.fjn.sdf.html";
>my $ending = (split '\.',$path)[-1];
>
>??

  [ please post your reply beneath or interleaved with the original ]

the reason is a purist one .. speed .. get out Benchmark and you'll see 
how far pedantry can go ;)

but in seriousness - something that could possibly be operating on a 
whole bunch of input strings (like traversing a directory tree) this is 
a situation where I would always go with the quickest solution

the substr/rindex/length solution is over 2.5 times quicker than a split 
solution .. and almost ten times quicker than a regex based solution

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Sat, 15 Jul 2000 00:29:54 GMT
From: Gorby <gorbeast@SPAMSUCKS.subduction.org>
Subject: filling out www froms using LWP
Message-Id: <396FB07D.A39BC576@SPAMSUCKS.subduction.org>

Hi,

I am trying to fill out forms with a virtual browser using LWP module.
As a taking off point I am using the example in the perl cookbook on p.
710.  I have a couple of questions, though.

1)  here is the code snippet:

---
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

$ua = LWP::UserAgent ->new();
my $req = POST 'http://www.perl.com/cgi-bin/cpan_mod',
                            [module => 'DB_File', readme=1];
$content = $ua->request($req)->as_string;

----

How does this code actually transform line 6 into a string that the
website understands?  It doesn't seem to work when I adapt this for my
own purposes, i.e. replace the url with a different one and insert other

info into line 6

2) Suppose I want to fill out a form with my name and email address on
the web automatically.  Do I send the post request to the page with the
actual form, or do I send it to the "confirmation" page, as a URL of the

first page, along with the url-encoded data (my name and email)

3)is there a better method?


Thanks in advance, GJS





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

Date: 14 Jul 2000 23:39:39 GMT
From: The WebDragon <nospam@nospam.com.invalid>
Subject: Re: generating exe file from perl program
Message-Id: <8ko8br$orv$4@216.155.32.162>

In article <075c87b0.49c5539d@usw-ex0105-035.remarq.com>, Beta Version 
<playa786NOplSPAM@excite.com.invalid> wrote:

 | How can I generate a stand-alone program or exe file
 | from the Perl program I have written.
 | 
 | Basically, I want people who do not have Perl on their
 | system to be able to run my program.
 | 
 | Any info or leads would be appreciated.

do a quick search for perl2exe :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 14 Jul 2000 22:49:45 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: HOW TO FTP A FILE IN PERL SCRIPT
Message-Id: <8ko5e9$orv$0@216.155.32.162>

In article <8kjdot$gt7$1@violet.singnet.com.sg>, "lova" 
<nurain@singnet.com.sg> wrote:

 | Hi
 | 
 | I am currently trying to write a script to FTP some files over to another
 | machine and capture the output of the FTP command.
 | 
 | How do I do this?
 | 
 | Help needed urgently.

Here's something short I whipped up to download files VIA ftp FROM 
another site.. by reading the docs for the module I used, you should 
easily be able to figure out how to do it the other way.

#!perl -w
use strict;
use Net::FTP;

my $ftp = Net::FTP->new("ftp.cdrom.com");

$ftp->login("anonymous", 'your@email-address.com') or die ("aCk! Could 
not log in! $!");

print $ftp->pwd() ."\n\n";
$ftp->cwd("/pub/planetquake/planetunreal/nalicity/utctf") or die ("DOH! 
Could not change directory $!");
print $ftp->pwd()."\n";

#my @dirlist = $ftp->dir();
#for (@dirlist) {print "$_\n";};

print $ftp->type("I")."\n";
# $ftp->type("binary") or die ("Huh? Could not change type! $!");
print $ftp->type()."\n";
$ftp->get('ctf-gateways.zip') or die ("Argh! Could not download File! 
$!");
print "File download Successful!";
$ftp->quit;

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 14 Jul 2000 22:42:35 +1000
From: "Kiel Stirling" <taboo@doofa.net>
Subject: Re: I want to use ? in CGI!
Message-Id: <396f0abb_3@nexus.comcen.com.au>


"langtind" <arild@langtind.no> wrote:
>I just want to thank you for all the help I got, i really made it (this
>time)!
>
>Thanx!
>Trond Aage

Your welcome :p

Kiel Stirling


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

Date: Fri, 14 Jul 2000 22:14:12 GMT
From: Lance Hoffmeyer <vibrato@my-deja.com>
Subject: multiline & single line reqexp question
Message-Id: <8ko3b5$3j7$1@nnrp1.deja.com>

Yes, Yes that works.  That you very much.  I now have two other
questions.  I am trying to perform some other regexps as well as this
multiline reqexp and wish to insert another multiline regexp into this
program.  Whenever I add a regexp or another multiline regexp to this
program the first multiline regexp quits working.

Also, I am currently opening a new file to save the changes I make.  How
can I save the changes in the existing file?

Thanks in advance.

Lance


use strict;

opendir(PWD,".") || die "Can't open `.'! $!\n"; my @listofdat =
grep(/\.asc$/,»
 closedir(PWD);

 foreach my $file (@listofdat) {
open(FILE,"<$file")|| die "Can't open `$file'! $!\n"; my $printflag = 1;
open(OUT,">test.new");

 while(<FILE>) {
# s/^COL.*//g            #########stops the program from functioning###
   $printflag = 0 if (/^MACRO/);
    print OUT if ($printflag);
   $printflag = 1 if (/^ENDMACRO/);

#  $printflag = 0 if (/^I:/);   ##########stops program from functioning
#    print OUT if ($printflag);
#   $printflag = 1 if (/^\n/);

               }
close(FILE);
 close(OUT);
 }




In article <lr66q8ptow.fsf@yoda.wg.waii.com>,
  Art Haas <arthur.haas@westgeo.com> wrote:
> Lance Hoffmeyer <vibrato@my-deja.com> writes:
>
> > Using 'while' was exactly what I was doing!  I am still having
problems
> > though.  I am trying the /../ approach but I am still doing
something
> > wrong (probably in opening the file).. Here is my entire code this
time:
> >
> > # Get a list of files to process
> > @listofdat = glob("*.asc");
> >
> > # work on each file
> > foreach $listt (@listofdat){
> > print "$listt \n";
> >
> > #open(IN, "<$listt>");
> >
> > while(<$llist>){
> > print unless /^MACRO/../^ENDMACRO/;
> >
> >
> > #close(IN);
> >            }
> >
> > }
> >
>
> The way you're dealing with the files is wrong. I'd also suggest
> reading the the documentation on opendir(), readdir(), and closedir()
> to avoid glob().
>
> Try something like this ...
>
> $ cat foo.pl
> #!/usr/local/bin/perl
>
> use strict;
>
> opendir(PWD,".") || die "Can't open `.'! $!\n";
> my @listofdat = grep(/\.asc$/, readdir(PWD));
> closedir(PWD);
>
> foreach my $file (@listofdat) {
> 	open(FILE,"<$file") || die "Can't open `$file'! $!\n";
> 	my $printflag = 1;
> 	while(<FILE>) {
> 		$printflag = 0 if (/^MACRO/);
> 		print if ($printflag);
> 		$printflag = 1 if (/^ENDMACRO/);
> 	}
> }
> $ cat foo.asc
> 1
> 2
> 3
> 4
> 5
> MACRO
> a
> b
> c
> d
> e
> ENDMACRO
> 6
> 7
> 8
> 9
> $ perl foo.pl
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> $
>
> Other solutions certainly exist.
>
> --
> ###############################
> # Art Haas
> # (713) 689-2417
> ###############################
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 14 Jul 2000 16:17:20 -0700
From: Gerard Lanois <gerard@NOSPAMlanois.com>
Subject: Re: Net/Config.pm problem
Message-Id: <396F9F80.E7199BD0@NOSPAMlanois.com>



Sean Lavelle wrote:
> 
>     Hi,
>         I am trying to use Activestates perl to do somethings.  One of
> the things I needed to do was to use Net::FTP.  So i went out and
> installed libnet.ppd from Activestate.  After entering in the
> information that Net/Config.pm wanted I tried to run my program (the
> only module it uses is Net::FTP).  This is what I got:
> 
> syntax error at D:/Perl/site/lib/Net/Config.pm line 70, near "&gt"
> Compilation failed in require at D:/Perl/site/lib/Net/FTP.pm line 21.
> BEGIN failed--compilation aborted at D:/Perl/site/lib/Net/FTP.pm line
> 21.
> Compilation failed in require at lg_updater.pl line 6.
> BEGIN failed--compilation aborted at lg_updater.pl line 6.
> 
> This is what the auto generated last bit of config.pm look like:
> 
> DATA&gt%NetConfig = (

Change this line in your Config.pm to look like this:

%NetConfig = (

That might fix the problem, but gosh knows what else is broken.

I think the "DATA&gt" is some template substitution crud that 
found its way into the ActiveState distribution and/or .ppd file.

"&gt" is usually considered evidence of cut and paste from HTML.
You are not the first person to experience this specific problem:

        http://x53.deja.com/viewthread.xp?AN=616431672


A better approach would be to install libnet directly from CPAN
and forget about ActiveState.  In my experience, the interactive
questions that the libnet installer asks you get confused with
the ppm shell prompt.  Thus, personally I've always installed 
libnet manually from the CPAN .tar.gz.

All you'll need to do that is a copy of nmake, which you can get
from Microsoft.  My Perl page has a link and instructions on where
to get nmake and how to use it to install a module:

       http://www.lanois.com/perl/

Good luck, and let us know how it works out for you.

-Gerard
http://www.lanois.com/perl/

>  ftp_int_passive => '0',
>  snpp_hosts => [],
>  inet_domain => 'mydomain.com',
>  test_exist => '1',
>  daytime_hosts => [],
>  ph_hosts => [],
>  time_hosts => [],
>  smtp_hosts => [],
>  ftp_ext_passive => '0',
>  ftp_firewall => undef,
>  test_hosts => '0',
>  nntp_hosts => ['news.mydomain.com'],
>  pop3_hosts => ['pop.mydomain.com'],
> );
> 1;
> 
> I have no idea what's going on.  I have even tried to install libnet
> without filling in this info and it crashes.  If anybody could help I
> would really appreciate it.
> 
>     Sean
> 
> slavelle@concentus-tech.com


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

Date: 14 Jul 2000 23:37:57 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Net::FTP error:Bad arg length for Socket::unpack_sockaddr_in
Message-Id: <slrn8mv91v.c2v.efflandt@efflandt.xnet.com>

On Fri, 14 Jul 2000, Alex Rhomberg <rhomberg@ife.ee.ethz.ch> wrote:
>Yu Zhang wrote:
>> 
>> Hi folks,
>> I wrote a simple script using Net::FTP to download bunch of files,
>> each time after processing several hundred of them, the script
>> stops and prints
>> 
>> "Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16
>> at /usr/lib/perl5/5.00503/i386-linux/Socket.pm line
>> 295, <FILE> chunk 1130."
>> 
>> Anyone has an idea what the message means and how to get round of it?
>
>The message means that that the argument to said function is wrong. I'd
>fire up the debugger, put a breakpoint at that line and examine the
>stack trace to find out why that argument is zero. 
>
>- Alex

I haven't gotten that error while using Net::FTP, but I have gotten that
same exact error from Net::Ping if using anything other than 'icmp'.  If I
try to use 'tcp' or 'udp' for Net::Ping, I get the above error in both
RedHat 6.1 and Mandrake 7.0.  This makes Net::Ping useless for anyone
other than root.  Since Net::Ping has not been updated for a long time, it
makes me wonder if something changed in the Socket module more recently
that makes some older modules incompatible.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Fri, 14 Jul 2000 17:09:45 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: New book on web dev with Perl
Message-Id: <slrn8mv0cp.eq3.tadmc@magna.metronet.com>

On Fri, 14 Jul 2000 13:06:20 -0700, Lauren Smith 
   <lauren_smith13@hotmail.com> wrote:
>Ted Kennedy <tedken@optonline.net> wrote in message
>news:1PEb5.15307$t66.38559@news02...
>> We are evaluating a new book on web development with Apache and Perl and
>are
>> looking for a few qualified people to read and comment on the manuscript.

[snip]

>It is unfortunate that a company that is held in esteem by quite a few for
>its exceptional Perl-related books finds it necessary to spam this newsgroup
>with a Help Wanted post.


I am a Consulting Editor for Manning.

I advise them on their Perl related titles.

At my urging it was decided, several weeks ago, that we would
no longer post solicitations here. (they started the practice
before I came onto the scene).


Apparently the word did not get through to Ted.


I have been assured that the word will be gotten to him,
and that you will see no more such posts.

Sorry everybody.



-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3674
**************************************


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