[12210] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5810 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 28 02:07:25 1999

Date: Thu, 27 May 99 23:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 27 May 1999     Volume: 8 Number: 5810

Today's topics:
    Re: [Fwd: Checking case of a variable]-Found Answer (Larry Rosler)
        cgi counter a nightmare jdwstevens@hotmail.com
    Re: cgi counter a nightmare (Sam Holden)
        CGI.pm and Select() (Peter Bismuti)
    Re: Checking case of a variable <cassell@mail.cor.epa.gov>
        Database manipulation <guapo@postnet.com>
    Re: display status of sevices under NT (Alexander F. Gutfeldt)
    Re: FAQ 3.20: How can I make my CGI script more efficie <cassell@mail.cor.epa.gov>
    Re: FAQ 3.20: How can I make my CGI script more efficie (Michael Stillwell)
    Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe <webmaster@chatbase.com>
    Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (Chris Torek)
    Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe <webmaster@chatbase.com>
    Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe <ebohlman@netcom.com>
    Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (I R A Aggie)
        ftp passive mode... (GEMINI)
        Help explain @_ (John Lathrop)
        help <wilbur@hknet.com>
    Re: Ineed major help creating a CGI script with PERL <cassell@mail.cor.epa.gov>
        killing exec()ed process - how? <otis@my-deja.com>
    Re: m/\d.*?^\d/s; (Ronald J Kimball)
    Re: My first working script; comments, hints? (Ronald J Kimball)
        parsing a file <oakie@cis.tamu.edu>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 27 May 1999 21:08:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: [Fwd: Checking case of a variable]-Found Answer
Message-Id: <MPG.11b7b68fc720d9eb989b1a@nntp.hpl.hp.com>

In article <374DF5B7.12B1969@animenet.com> on Thu, 27 May 1999 21:47:35 
-0400, The Anime Network <info-spamstopper@animenet.com> says...
> Sorry for bothering the group, no sooner than I posted the message I
> found the answer...
> 
> Thanks!

It might be courteous to post the answer that you found.

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


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

Date: Fri, 28 May 1999 05:39:37 GMT
From: jdwstevens@hotmail.com
Subject: cgi counter a nightmare
Message-Id: <7ila6q$udm$1@nnrp1.deja.com>

Does anyone else experience what a nightmare it is to get cgi working?

I moved a week ago to a new webhost that is very fast (www.icom.com) and
happy to have access to cgi, but after having tried 7 different
counters, a guestbook and a form, I have given up.

I will just use the old free counter and let them put an ad on  my page
at


http://genealogylinks.net

I just can't beleive cgi shopuld be that big a mess to use. It's like
some programmer from hell set it up as a joke on us.

Does anyone have a positive solution to having an access counter or
forms handling...that runs on Unix/sunos 2.6

Ian


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 28 May 1999 05:56:32 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: cgi counter a nightmare
Message-Id: <slrn7ksc0g.dlo.sholden@pgrad.cs.usyd.edu.au>

On Fri, 28 May 1999 05:39:37 GMT, jdwstevens@hotmail.com wrote:
>Does anyone else experience what a nightmare it is to get cgi working?
>
>I moved a week ago to a new webhost that is very fast (www.icom.com) and
>happy to have access to cgi, but after having tried 7 different
>counters, a guestbook and a form, I have given up.
>
>I will just use the old free counter and let them put an ad on  my page
>at
>
>
>http://genealogylinks.net
>
>I just can't beleive cgi shopuld be that big a mess to use. It's like
>some programmer from hell set it up as a joke on us.

use CGI; is very simple in fact. Much simpler than say Tk.

>
>Does anyone have a positive solution to having an access counter or
>forms handling...that runs on Unix/sunos 2.6

You could try reading the FAQ.

Answers to the questions :

Where can I learn about CGI or Web programming in Perl?
How do I decode a CGI form?
I still don't get locking.  I just want to increment the number
    in the file.  How can I do this?

Might be useful. Otherwise hiring a programmer might be a good solution.

-- 
Sam

You can blame it all on the internet. I do...
	--Larry Wall


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

Date: 28 May 1999 04:17:27 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: CGI.pm and Select()
Message-Id: <7il5cn$be9$1@news.fsu.edu>


The Select() function does not seem to have the "stick" property
that is provided with CGI.pm, if I specify a value, if I resubmit
then the value is lost.  

    print strong("Application for Term Beginning: "),
         Select( -name=>'app_semester' ,
                   option(['Spring','Summer','Fall'])),
         Select( -name=>'app_year'    ,option(['1999','2000','2001'])),br;

After choosing a value of Fall 2001 and resubmitting the form, the
chosen values are lost.  How can I fix this?  Thanks !!

PS the form can be found at http://www.cs.fsu.edu/~bismuti/WEBMASTER/app2.cgi


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

Date: Thu, 27 May 1999 21:11:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Checking case of a variable
Message-Id: <374E178B.1B56F05D@mail.cor.epa.gov>

The Anime Network wrote:
> 
> I have the unfortunate task of moving some code over to NT from Unix,
> where I have single letter (A.gif etc) graphics which must now be kept
> in a separate directory.

You have our deepest sympathies.
 
> Can anyone tell me a way to check the case (upper/lower) of a single
> character and give a return of that case in some fashion?

Look into perlfunc and check out uc() and lc().  You may also
want to look at ucfirst() and lcfirst() for kicks.
 
> I was thinking of something like:
> 
> if ($code eq [A-Z]) {$sky = "/uppercase/$code.gif";}

  if ($code eq uc $code) {$sky = "/uppercase/$code.gif";}
      else               {$sky = "/lowercase/$code.gif";} 

> Any thoughts?

Yes.  That has some duplication, so you could re-write
it as:

my $sky = '/' . ($code eq uc $code ? 'upper' : 'lower')               .
"case/$code.gif";

Note that I used:
my()     # you should be using 'use strict;'
and
'/'      # don't double-quote when you don't need to

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Thu, 27 May 1999 23:31:26 -0500
From: "Gary Yerby" <guapo@postnet.com>
Subject: Database manipulation
Message-Id: <B3p33.69$M4.1709614@typhoon.stlnet.com>

I am  constructing a series of functions that help me add/remove/read from a
fixed length Random Access Database.

#I am using code similar to this:
#for writing i open the file like so

open(HANDLE, "+>>filename); #this is okay

#I then seek the position I will place the data through a series of other
functions
#that is not a problem either
#It's when I want to read the data entered that I can't figure out.

close HANDLE;

#first I open the file again with the same call

open(HANDLE, "+>>filename);

#then I tell it to seek the record I want to read by this method,

seek(HANDLE, $recordcount*$recordlength,0); #where $recordcount is the

# position to read from and $recordlength is the amount of bytes from the
#beginning to the end of the record.
#Then I  read by doing this function;
$count=read(HANDLE, $buf, $recordlength);
#I then unpack it into a list like so
($variable1,$variable2 ,$variable3)=unpack("A3 A13 A", $buf);


problem is that when i try to get it to print the list of $variables after
unpacking them, they read from the same record no matter what i try. I
obviously don't understand how the read function works in random access
databases. how do i tell it to read from a particular record????? and put
that data into variables for printing to stdout???  would like an example of
how this works or anything HELP!!




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

Date: Fri, 28 May 1999 05:06:38 GMT
From: lexuNOSPAM@compuserve.com (Alexander F. Gutfeldt)
Subject: Re: display status of sevices under NT
Message-Id: <374e7878.22380557@news.compuserve.com>

csaa4635@dm.uibk.ac.at (Carsten Dieter Wolf) wrote:

>greetings ...
>
>i am looking for a tool or library (in perl language) to display and watch
>the actual status of any running service under win-NT. 

This I don't know how to do. I'd suggest looking Dave Roth's "Win32
Perl Programming: The Standard Extensions" for inspiration.. a look at
the index would suggest Win32::Service (Start, Stop, Status, Pause,
Resume etc.)

>in the particular reason i want to stop a service wait till its process
>is finished and the restart it again

this I would do with a batch-file ... e.g. for IIS4

 net stop "Web Publishing Service"
 net start "Web Publishing Service"

The Service's name is different :-( so this sample won't work.

Good look
'lexu



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

Date: Thu, 27 May 1999 21:24:57 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Tom and Gnat <perlfaq-suggestions@perl.com>
Subject: Re: FAQ 3.20: How can I make my CGI script more efficient?
Message-Id: <374E1A99.82CDA1E7@mail.cor.epa.gov>

Tom Christiansen wrote:
> 
> [snip of header]
>   How can I make my CGI script more efficient?
> 
> [snip of first para]
> 
>     There are two popular ways to avoid this overhead. One solution

s/two/several/

>     involves running the Apache HTTP server (available from
>     http://www.apache.org/) with either of the mod_perl or mod_fastcgi
>     plugin modules.
> 
>     With mod_perl and the Apache::Registry module (distributed with
>     mod_perl), httpd will run with an embedded Perl interpreter which
>     pre-compiles your script and then executes it within the same
>     address space without forking. The Apache extension also gives Perl
>     access to the internal server API, so modules written in Perl can
>     do just about anything a module written in C can. For more on
>     mod_perl, see http://perl.apache.org/

      Similarly, ActiveState makes the not-for-free product PerlEx,
      which is a plug-in for NT Webservers.  For more on PerlEx,
      see http://www.activestate.com/
 
>     With the FCGI module (from CPAN) and the mod_fastcgi module
>     (available from http://www.fastcgi.com/) each of your perl scripts
>     becomes a permanent CGI daemon process.
> 
>     Both of these solutions can have far-reaching effects on your

s/Both/All/

>     system and on the way you write your CGI scripts, so investigate
>     them with care.
> 
>     See http://www.perl.com/CPAN/modules/by-
>     category/15_World_Wide_Web_HTML_HTTP_CGI/ .
> 
>     A non-free, commercial product, ``The Velocity Engine for Perl'',

s/A/Another/

>     (http://www.binevolve.com/ or http://www.binevolve.com/bine/vep)
>     might also be worth looking at. It will allow you to increase the
>     performance of your perl scripts, upto 25 times faster than normal
>     CGI perl by running in persistent perl mode, or 4 to 5 times faster
>     without any modification to your existing CGI scripts. Fully
>     functional evaluation copies are available from the web site.
> 
> --
> You want it in one line?  Does it have to fit in 80 columns?   :-)
>                 --Larry Wall in <7349@jpl-devvax.JPL.NASA.GOV>

-- 
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 28 May 1999 05:12:59 GMT
From: mist@yoyo.cc.monash.edu.au (Michael Stillwell)
Subject: Re: FAQ 3.20: How can I make my CGI script more efficient?
Message-Id: <slrn7ks9eq.g2r.mist@fangorn.cs.monash.edu.au>

On 27 May 1999 15:13:09 -0700, Tom Christiansen <perlfaq-suggestions@perl.com> wrote:

:   How can I make my CGI script more efficient?

    I sent this to you before, but another alternative is SpeedyCGI:

    http://www.daemoninc.com/speedycgi/

    "After the script is initially run, instead of exiting,
    SpeedyCGI keeps the perl interpreter running in memory.
    During subsequent runs, this interpreter is used to handle new
    requests, instead of starting a new perl interpreter for each
    execution."

    Michael

-- 
 .. ABSOLUT .SIG. ..
 .. Michael Stillwell ..
 .. mist@yoyo.cc.monash.edu.au ..
 .. http://yoyo.cc.monash.edu.au/~mist/ ..


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

Date: Thu, 27 May 1999 20:11:40 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <374E096C.F992E040@chatbase.com>

finsol@ts.co.nz wrote:
> 
> Whether a method of instructing a computer can be deemed a programming
> language, scripting language, interface language, job control language
> or some other esoteric jargon you would care to name, is a grey area
> that I don't wish to debate. The fact is that CGI shares the same Y2K
> booby-trap problem as Perl. Fixing Y2K problems is more important than
> playing stupid semantics.
> 

When someone asks you what language you program in, do you tell them "I
program in computers."?

When someone asks what language is affected by the Y2K issue, do you
tell them "variables won't work anymore."?

CGI is *not* an issue at all. If the computer is capable of running past
that year, then the CGI interface won't fail to work -- as everyone here
has been stated, that CGI is *not* a language, and this "it's a gray
area" is pathetic.

Perhaps you create CGI applications in a certain language, but you use a
computer to run it and create it and possibly compile it (if not
interpret it), so do you consider the hard drive used to run a CGI
application a programming language too? There's not much of a
difference. You're way in over your head here.
-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: 27 May 1999 20:14:57 -0700
From: torek@elf.bsdi.com (Chris Torek)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <7il1nh$acj@elf.bsdi.com>

In article <374d6545@cs.colorado.edu> tchrist@mox.perl.com
(Tom Christiansen) writes:
>> There are idiots everywhere.   What's your point?

In article <7ikrh1$kmd$1@nnrp1.deja.com> Jocelyn Amon <finsol@ts.co.nz> writes:
>That's my point exactly. Idiot's [sic] or not, don't expect perfection from
>programmers, we're only human.

If Ms Amon's point is, indeed, that "there are idiots everywhere,
hence it would be better if languages were designed to be idiot-proof,
so that programmers could not shoot themselves in the foot with
them", she has not made it very well.  But it is a *valid* point:
I agree that language designers should strive to define their
languagess in such a way that common mistakes tend to be avoided.
On the other hand, I think history shows that no one has any idea
which mistakes will *be* common until it is too late.  Furthermore,
I suspect that if one could somehow go back in time (say, to the
1970s) and change some of the design decisions of any given language,
having decided today (in 1999, in "present-day future") that those
decisions led to common mistakes, one would, upon returning to an
alternate-future 1999, find that the altered language led to equally
many mistakes.  Those mistakes would simply be of another nature.

In other words, while "strive to idiot-proof the world" is a noble
goal, we seem only to find that, the more we fool-proof something,
the more foolish people become.  There is some sort of Law of
Conservation of Human Error: people make as many mistakes as they
can tolerate, and the harder it is to make mistakes, the more work
and/or less training people will apply, until they make the same
number of mistakes.

>It is particularly likely mistakes will be made when a programming
>language such as Perl, is so easy to mis-use.

Perhaps the reason Perl is so easy to mis-use is that it is so easy
to *use*.  In other words, it "attracts the bigger idiots".  Suppose
Perl had defined its localtime() so that the returned year was
"year AD".  I would bet that many of these same people writing
broken Perl scripts today (i.e., failing to use "$year + 1900" to
obtain a four-digit year) would be writing other broken scripts,
perhaps using "$year - 1900" to extract the last two digits of the
year for human consumption.
-- 
In-Real-Life: Chris Torek, Berkeley Software Design Inc
El Cerrito, CA	Domain:	torek@bsdi.com	+1 510 234 3167
http://claw.bsdi.com/torek/  (not always up)	I report spam to abuse@.


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

Date: Thu, 27 May 1999 20:42:22 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <374E109E.A5990968@chatbase.com>


> Your ignorance of the potential seriousness of this aspect of
> the Y2K problem would indicate that you are unqualified to judge whether
> or not I have the qualifications to write on this subject.
> 

"Oh boy, oh boy" (Best Rainman impression).

Set your computer date to 1970 when the new year comes and shut up.
You're embarrassing yourself. A 3 year old telling me how I don't know
how to program when they've never seen a computer, doesn't mean much to
me, or anyone else in this group, other then the fact that it's good for
a chuckle. :-)


-- 
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.


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

Date: Fri, 28 May 1999 05:01:18 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <ebohlmanFCFFA7.LnG@netcom.com>

finsol@ts.co.nz wrote:
: Tom, thought you may be interested to know that I'm not the only
: mis-guided soul using the term "programming language" to describe CGI
: for expedience.

: Check out these two URL's.

: http://www.net-ads.com/development/CGI.html
: Using CGI & Perl
: CGI, or Common Gateway Interface, is a programming language that allows
: webmaster to add various interactive features to their websites,
: including search engines, free-4-all links pages, clocks, counters,
: bulletin boards and more. Using CGI, it is also possible for webmasters
: to manage their own advertising inventory by rotating and tracking
: banner adviews ...

The description is simply wrong.  "It's on the Web, so it *must* be right!"

: http://www.itknowledge.com/reference/dir.programminglanguages.perlandcgi
: .html
: Programming Languages: Perl & CGI
: CGI Developers Guide
: This book is one of the first books to provide comprehensive information
: on developing with CGI (Common Gateway Interface). It covers many of the
: aspects of CGI including, interactivity, performance, portability, and
: security. After reading this book, the reader will be able to write
: robust, secure, and efficient CGI programs.

This hardly amounts to calling CGI a programming language.  The book is 
specific to a particular programming language (Perl) and therefore is 
correctly categorized as a book on "programming languages" even though it 
only deals with a particular application of that programming language.

The mere fact that word A appears near word B in no way implies that "A 
isa B."  You're engaging in something akin to fundamentalist prooftexting.

: CGI Manual of Style
: CGI is the programming language that allows for accountability on the
: Web.

This is PHB-speak.

 This book will help programmers learn the fundamentals behind CGI -
: showing how to program the included samples, what to watch out for, and
: how to achieve effective scripting. Progressing from easy samples to
: more advanced, this book provides users with the skills they need to
: provide accountability on their Web site.

: Special Edition Using Perl 5 for Web
: Programming
: With a review by Tom Christiansen ...

Nothing about this implies that CGI is a programming language.

: You efforts to educate me in the correct means of using news groups and
: the terminology that should be used is, I'm sure, of a greater
: importance to the computing world than Y2K awareness.

"Never knew we were living in a world with a mind that could be so sure"
  -- Silverchair, "Anthem for the Year 2000"

: BTW, while you're checking out URL's, how does the Perl code at these
: sites look to you?  It doesn't look kosher to me but then I don't claim
: to be a Perl expert.

: www.hollycole.com/WWWboard/wwwboard.html
:  # get information
:     local($string) = @_;
:     ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
: localtime(time);

:     # calculate useful values
:     $cent = ($year < 70) ? 20 : 19;
:     $lyear = $year + $cent*100;

So Daniel Johns should have titled his song "Anthem for the Year 10100"?

: http://www2s.biglobe.ne.jp/~j_okada/free_cgi/j_diary/regist.txt
: if ($year > 97) { $year = "19$year"; }
:     else { $year = "20$year"; }
:     if (!open (DB, "$data_dir/$year$mon\.dat")) {

Or the more prosaic "Anthem for the Year 19100"?

: http://www.linguistic-funland.com/scripts/RemindMe/remindmecgi.txt
: if($data{'Year'} eq "Not Selected"){
:   ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
:   if($year !~ /0/){
:     $form_year = "19$year";
:     }
:   else{$year = "20$year";}
:   }

How about "Anthem for the Year 20100"?  Sounds a little hard to sing.

Let's see...
1999, 20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109,
20110, 19111, 19112, 19113, 19114, 19115, 19116, 19117, 19118, 19119,
20120, 19121 ....

This script must have been written by a member of the Campaign for
Non-Monotonic Time. 

So far, the only point you've been able to make is that Perl is a poor
programming language for people who don't understand programming to write
production code in.  I should certainly hope so.  I've lost my "Murphy's
Law and its Corrolaries" book, so I can't identify the author, but someone
once said "Design a system that can be used by idiots and only an idiot
would want to use it."  Perl's lack of training wheels is not a weak 
point of the language.  Perl's comprehensive documentation is a strong 
point of the language.  It is not Perl's fault that a historical 
coincidence resulted in a bunch of pseudo-anti-structuralist "artiste" 
poseur wannabes (the "HTML is DTP" crowd) trying to write Perl code as if 
Perl were a purely artistic medium in which there were no rules.




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

Date: 28 May 1999 05:07:49 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <slrn7ks9b2.4ck.fl_aggie@thepentagon.com>

On 27 May 1999 20:14:57 -0700, Chris Torek <torek@elf.bsdi.com>, in
<7il1nh$acj@elf.bsdi.com> wrote:

+ In article <7ikrh1$kmd$1@nnrp1.deja.com> Jocelyn Amon
<finsol@ts.co.nz> writes:

+ >It is particularly likely mistakes will be made when a programming
+ >language such as Perl, is so easy to mis-use.

+ Perhaps the reason Perl is so easy to mis-use is that it is so easy
+ to *use*.

Time for a Wall-ism...

Many computer scientists have fallen into the trap of trying to define
languages like George Orwell's Newspeak, in which it is impossible to
think bad thoughts. What they end up doing is killing the creativity
of programming.
 -- Larry Wall


James



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

Date: 28 May 1999 04:25:20 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: ftp passive mode...
Message-Id: <7il5rg$68t$1@netnews.csie.NCTU.edu.tw>


hi all,

I have a problem with Net::FTP module when using
passive mode.
I use pasv_xfer and pasv_wait to transfer file between
two other hosts. I found that
the pasv_xfer + pasv_wait will work fine only for the first
file. It will fail for the second file when I put them in a loop:

foreach (@filelist) {
  $ftp->pasv_xfer(...
  $dftp->pasv_wait($ftp);
}

I trace the code, and find that it got problem with PASV
command at the second time.
so what's the matter with it?


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

Date: Fri, 28 May 1999 05:30:14 GMT
From: lathropj@elite.net (John Lathrop)
Subject: Help explain @_
Message-Id: <7il9ld$hje$1@berry.elite.net>

I am new to perl and I was trying to understand how and what is passed
to a subroutine.  This is some code I was experimenting with:

my $N;
$N = <STDIN>;
chomp($N);
&fib($N);

sub fib
{
	my ($n, $fn2) = @_;
	my $fn3 = @_;
	my $fn4 = scalar(@_);
	my $fn5 = $_;
	my $fn6 = $_[0];
	my $fn7 = $_[1];
	my ($fn) = @_;

etc...

The value of $n = 5 is what I entered at the command line.  The
resulting values were as follows:

$n: 5
$fn: 5
$fn2: 
$fn3: 1
$fn4: 1
$fn5: 
$fn6: 5
$fn7: 


My real confusion is with the value of $fn3.  I expected $fn3=5.  Can
anyone help to explain this?



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

Date: Fri, 28 May 1999 12:52:28 +0800
From: Wilbur <wilbur@hknet.com>
Subject: help
Message-Id: <374E210C.224AABD3@hknet.com>

Dear friends,

hi!  I got a problem.  I download a activeperl run in win98 with dos
windows. I don't know how to start writing.

Best regards
Wilbur



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

Date: Thu, 27 May 1999 20:16:01 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Ineed major help creating a CGI script with PERL
Message-Id: <374E0A71.D251C07@mail.cor.epa.gov>

gryan@lasvegas.com wrote:
> 
> Try starting here:
> http://worldwidemart.com/scripts/

Oof.  That isn't going to win you any brownie points here.
Matt's Script Archive, while popular, is also replete with
problems.  Un-Perlish code, with bugs and ickiness.
Not to mention some yucky Y2K non-compliance that was
discussed in this newsgroup just a few days or so ago.

Perhaps you should try recommending something better,
so that in 6+ months someone doesn't e-mail you angrily
about weird stuff happening in the script you recommended.
 
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

On the Web, I think the phrase is:
"Share what you don't know to be wrong.  Learn what you don't
 know to be right."   :-)

HTH, 
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 28 May 1999 04:12:24 GMT
From: Otis Gospodnetic <otis@my-deja.com>
Subject: killing exec()ed process - how?
Message-Id: <7il537$r3e$1@nnrp1.deja.com>

Hello,

I was wondering if it is possible to get the PID of a 'command' executed
by exec() so that the 'command' can be killed directly (killing the
process that called the exec() doesn't kill the 'command' - the
'command' keeps running)

In particular, my script forks a few processes and each of those
processes does exec("command")
Later, I need to kill everything: my script, all forked processes, as
well as all commands that were exec()ed.

In code:
unless ($childPID = fork)
{
    exec ("sleep 30");
}
wait;

While this code is running I need to be able to kill it, as well as the
forked process and the 'sleep 30' command that the formed process
called.
Is this possible?
I have the PID of the main process as well as PIDs of the forked
processes, but sending them the TERM signal doesn't reach the exec()ed
command ('sleep 30' in this example)

Thanks,

Otis
P.S.
checked man pages, checked Dejanews and found similar questions but no
definite answers.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 27 May 1999 23:39:20 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: m/\d.*?^\d/s;
Message-Id: <1dshjfr.ejfjxfibrqgwN@p122.tc8.metro.ma.tiac.com>

Pletschette Andre <andre.pletschette@ltam.lu> wrote:

> sub number {
> for ($i=1; $i <= $TOTAL ; $i++){
>      $PICS[$i] =~ m/\d.*?^\d/s;
>      $NUMB[$i] = $&;
> }
> }
> 
> All as I know is that the problem could be in the regex, because with
> $PICS[$i] =~ m/\d.*?/s;
> it goes but in the place of 67 I get only 6.

You're right, the problem is in the regex.  That regex wants to match
the beginning of the string, with ^, right in the middle.  But the
beginning of the string can't be in the middle, so the regex fails to
match, so $& is undefined.

Try this instead:

if ($PICS[$i] =~ m/(\d+)/) {
   $NUMB[$i] = $1;
} else {
   $NUMB[$i] = '';
}

which assigns the empty string if the match fails.


There are also issues of coding style in the code you posted, but we'll
leave those be for now.  :)

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
perl -e '$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: Thu, 27 May 1999 23:39:24 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: My first working script; comments, hints?
Message-Id: <1dshjwe.1t8tcvf1y2tzt2N@p122.tc8.metro.ma.tiac.com>

Tad McClellan <tadmc@metronet.com> wrote:

>    double/single quotes are not metacharacters in a char class
>    (there are only 4 such chars:   ]  \  ^  - ), so you do not
>    need to backslash them:

Actually, you need to backslash $ and @ as well, even within a character
class, since regular expressions are double-quotish strings.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
perl -e '$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: Thu, 27 May 1999 23:26:40 -0500
From: Kenneth Oakeson <oakie@cis.tamu.edu>
Subject: parsing a file
Message-Id: <374E1AFF.448FD683@cis.tamu.edu>

I can't seem to figure out how to parse this file. The file looks like
this

dog:run
cat:sleep
fred:barney

Can anyone show me a way to parse that.




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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5810
**************************************

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