[18093] in Perl-Users-Digest
Perl-Users Digest, Issue: 253 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 9 06:05:31 2001
Date: Fri, 9 Feb 2001 03:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981716712-v10-i253@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 9 Feb 2001 Volume: 10 Number: 253
Today's topics:
*perl newbie* asking for hash-of-hashes basics <none@nowhere.noland.etc>
Re: a bug in perl-5.6.0? (Csaba Raduly)
Re: Builing INSERT-statement from hash (Mark Jason Dominus)
Re: Can perl define vars dynamically? <krahnj@acm.org>
Re: dialog with spawned process? <Jerome.Abela@free.fr>
Re: don't want to let them enter & and = ... <emelin@my-deja.com>
Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? (John McNamara)
Re: How can I modify the value of a variable directly f <bart.lateur@skynet.be>
Re: how to prevent Browser from loading a page from cac <troyr@vicnet.net.au>
killing a cgi nicely <emelin@my-deja.com>
Re: killing a cgi nicely (Rudolf Polzer)
Re: killing a cgi nicely <emelin@my-deja.com>
Re: Linux does reclaim memory from perl <Jerome.Abela@free.fr>
Re: Mailtools-1.15 confusing to me. pointers, please? <nospam@nospam.com>
Re: mod_perl opinion needed <drifter@clix.pt>
Re: Need Help Checking IP Address Syntax w/ PERL? <nospam.newton@gmx.li>
Net::FTP error - timeout on put() lawrenceang@my-deja.com
Partial Apology to Perl Fans topmind@technologist.com
Q: regular expression matkaopas@my-deja.com
Re: Q: regular expression (Bernard El-Hagin)
Re: Regular Expression Question <uri@sysarch.com>
Re: Regular Expression Question (Craig Berry)
Re: setting degree of parallelism <Jerome.Abela@free.fr>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 09 Feb 2001 11:42:11 +0100
From: Perique des Palottes <none@nowhere.noland.etc>
Subject: *perl newbie* asking for hash-of-hashes basics
Message-Id: <3A83C983.F41C6CD6@nowhere.noland.etc>
In the process of learning perl (from awk, C, rexx), I was
wondering if perl 'hash of hashes' is analogous to awk
'multidimensional associative array' but implemented the
way it should have been (that is, with each dimension
iterable on its own).
So considering this gawk chunk:
assoc[dim1,dim2]=whatever
...
# both key1 and key2 unsorted
for((key1,key2) in assoc){
print key1" "key2" "assoc[key1,key2]
}
Is this code valid (and sensible) perl and has it the
expected behaviour?
$assoc{$dim1}{$dim2}=$whatever;
...
# key1 unsorted
foreach $key1 (keys $assoc) {
# grouped by key1, key2 unsorted
foreach $key2 (keys $assoc{$key1}){
print $key1." ".$key2." ".$assoc{$key1}{$key2}."\n";
}
}
--
All true believers shall break their eggs at the convenient end.
------------------------------
Date: Fri, 9 Feb 2001 10:30:32 +0000 (UTC)
From: real.email@signature.this.is.invalid (Csaba Raduly)
Subject: Re: a bug in perl-5.6.0?
Message-Id: <Xns90436CAC5quuxi@194.203.134.135>
And so it came to pass that Chris Stith <mischief@velma.motion.net>
on 07 Feb 2001 wrote <t83fcptb9o5u9e@corp.supernews.com>:
[snip]
>
>True. This is because of the behavior in Perl of an assignment
>returning a value (a Perlism, for sure.. not very common in languages).
^^^^^
Did you mean lvalue ? C/C++ assignment operators return rvalues allright.
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
You are in a maze of twisted little minds, all different.
------------------------------
Date: Fri, 09 Feb 2001 05:41:00 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Builing INSERT-statement from hash
Message-Id: <3a8382ec.7007$128@news.op.net>
In article <MPG.14ed320ffb1acbd698989b@news.online.no>,
Tore Aursand <tore@extend.no> wrote:
> 'firstname' => 'John',
> 'lastname' => 'Doe'
>
>How do I convert this data the smoothest (...) way to fit into my
>insert statement? I would like to do something like this;
>
> my $sth = $dbh->prepare(qq|INSERT INTO tbl
> ($fields) VALUES ($values)|);
>
If you are going to insert more than one record where the field names
are the same, it is a bad move to include the data values in the
'prepare'.
http://www.perl.com/pub/1999/10/DBI.html
explains why.
In that case, try this:
my @fields = qw(firstname lastname etc);
my $FIELDS = join ',', @fields;
my $QQQ = join ',', (('?') x @fields); # Looks like '?,?,?'
my $sth = $dbh->prepare(qq|INSERT INTO tbl
($FIELDS) VALUES ($QQQ)|);
for my $hash (@hashes) { # $hash is one hashref as in your example
$sth->execute(@{$hash}(@fields));
}
This assumes that every $hash has all the fields; if not you have to
add some extra processing to turn the Perl 'undef' values into the
'NULL' that SQL expects.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Fri, 09 Feb 2001 07:09:50 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Can perl define vars dynamically?
Message-Id: <3A8398D2.F73F63C6@acm.org>
Joe Schaefer wrote:
>
> my $FS = '|'; # (used in a regexp) why is this here?
> my @sepf; # desired array (what's it good for?)
>
> while (<>) {
> chomp; # get rid of potential teminating newline
> my (undef, $field) = split /$FS/o, $_, 3; # field 2 into my $field
$ perl -e '$FS = q{|}; $x = "ab|cd|ef|gh"; @y = split /$FS/o, $x; print
">$_< " for @y;'
>a< >b< >|< >c< >d< >|< >e< >f< >|< >g< >h<
John
------------------------------
Date: Fri, 09 Feb 2001 10:22:40 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: dialog with spawned process?
Message-Id: <3A83C3E6.B0DBB630@free.fr>
big_amko@my-deja.com a écrit :
> system("my_black_box.exe");
> we get on the stdout something like:
> >"Are you happy? [Y/N]"
> from the "black box".
>
> How I can pass my input (i.e. "Y") from within calling perl script in
> order to succesfuly exit from the "black box"?
open(BOX, "|my_black_box.exe")
select(BOX);
$|=1;
print "Y";
Jerome.
------------------------------
Date: Fri, 09 Feb 2001 08:11:43 GMT
From: emelin <emelin@my-deja.com>
Subject: Re: don't want to let them enter & and = ...
Message-Id: <9608nt$cgo$1@nnrp1.deja.com>
>
> tr/&//d;
>
> That gets rid of it. If you like, you can get the count of how many
were
> deleted, by taking the return value of tr///.
>
> --
> Bart.
>
Yes, but where do I put this???
I can't put it after
use CGI qw(import_names);
import_names('FORM');
because then the form contents have already been split by &... so all &
are gone, but things aren't split like I want them to be...
And if I put it BEFORE... well, I don't have anything yet...
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Fri, 09 Feb 2001 10:46:21 GMT
From: jmcnamara@cpan.org (John McNamara)
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <3a83c5b9.7405072@News.CIS.DFN.DE>
Ar Fri, 09 Feb 2001 01:17:01 GMT, do schriobh PerlFAQ Server
<faq@denver.pm.org>:
> Is there an IDE or Windows Perl Editor?
>
> If you're on Unix, you already have an IDE -- Unix itself. ...
> ...
I never really liked this answer. Any UNIX programmer would agree but
they (we) are not the people who are going to ask this FAQ.
The updated FAQ contains more general, more useful information,
thanks to Peter Primmer and others (see Language-sensitive editors):
http://www.perl.com/pub/2000/12/p5pdigest/THISWEEK-20001225.html
In the same way I am glad that the binmode docs were changed to be
less UNIX-centric.
John.
--
------------------------------
Date: Fri, 09 Feb 2001 09:48:59 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How can I modify the value of a variable directly from within a sub?
Message-Id: <oee78t0rsevou35kd0nvjhifvp1a18t256@4ax.com>
Philip Obbard wrote:
>sub commify
> {
> local $_ = shift;
> 1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
> return $_;
> }
>
>In my code, I can do:
>my $number = 32566;
>$number = commify($number);
>
>$number now returns 32,566 - so this works fine. However, I also tried:
>&commify(\$number);
>
>...hoping that would change the value of $number directly (since I am
>passing it by reference), but obviously I am misunderstanding something
Yes you misunderstand something. You're passing a reference to a
variable, not a variable by reference. Shall I tell you a little secret?
ALL parameters to subs are passed by reference! It's when you do the
local $_ = shift;
that you actually make a copy. If you modify $_[0] instead, you're
changing the original value (geek speek: $_[0] is an alias to the first
parameter.)
You can do two things. Either (a) you change the sub so that it always
attempts to modify the passed value, or (b) you make your interface
work.
a)
sub commify {
for($_[0]) {
1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
return $_;
}
}
Here, $_ is an alias for $_[0] which is an alias for your parameter.
print commify("12345678");
-->
Modification of a read-only value attempted at ...
Making a temporary copy of the parameter and passing that instead, is
one way around it:
print commify(my $temp = "12345678");
Note that the scope for $temp is the enclosing block.
b) Making your interface work:
sub commify {
my $param = shift;
for(ref($param)?$$param:$param) {
1 while s/^([-+]?\d+)(\d{3})/$1,$2/;
return $_;
}
}
Here you first make a copy of the parameter. If it's not a reference,
use it directly. If it is a reference, use the dereferenced parameter
directly, thereby modifying the original.
$\ = "\n"; # newline after print
my $param = "12345678";
print commify($param);
print $param;
print commify(\$param);
print $param;
-->
12,345,678
12345678
12,345,678
12,345,678
Note that both sub calls return the same value, but the first time, the
original variable wasn't changed. The second time, it is.
--
Bart.
------------------------------
Date: Fri, 9 Feb 2001 16:35:59 -0800
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: Re: how to prevent Browser from loading a page from cache?
Message-Id: <mmLg6.271$FU5.9342@ozemail.com.au>
> I have a few static HTML pages in the home page directory. There is a link
> to my PERL script, in the cgi-bin directory, which updates one of the HTML
> pages. The script then output a confirmation page and a OK link which
points
> to the URL of the newly modified HTML page. The problem is that the
browser
> always loads the old page when I click on the OK link.
>
> I have tried a few things:
Have you tried just adding a simple
<http-equiv="Pragma" content="no-cache">
and
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
------------------------------
Date: Fri, 09 Feb 2001 08:18:35 GMT
From: emelin <emelin@my-deja.com>
Subject: killing a cgi nicely
Message-Id: <96094p$cre$1@nnrp1.deja.com>
I noticed that the ordinary die messages won't show up in cgi... so I
used "use CGI::Carp qw(fatalsToBrowser);"... But this prints out LOTS
of stuff from the server. How do I kill a cgi and print out ONLY my
error message??
(I know how to change the little message where it says you can contact
the webmaster for help and all that, but I want to get rid of
EVERYTHING, including info on the line where it died.)
I tried
die print "Error";
and it looked right, but does it do the same, is it a correct way to do
it?
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Fri, 9 Feb 2001 10:16:44 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: killing a cgi nicely
Message-Id: <slrn987dbs.25l.rpolzer@rebounce.rpolzer-lx>
emelin <emelin@my-deja.com> schrieb Folgendes:
> I noticed that the ordinary die messages won't show up in cgi... so I
> used "use CGI::Carp qw(fatalsToBrowser);"... But this prints out LOTS
> of stuff from the server. How do I kill a cgi and print out ONLY my
> error message??
>
> (I know how to change the little message where it says you can contact
> the webmaster for help and all that, but I want to get rid of
> EVERYTHING, including info on the line where it died.)
>
> I tried
> die print "Error";
> and it looked right, but does it do the same, is it a correct way to do
> it?
No. Try
sub DIE
{
print <<"X";
Content-type: text/plain
@{[join "\n", @_]}
X
exit 0;
}
--
#!/usr/bin/perl
eval($0=q{$0="\neval(\$0=q{$0});\n";for(<*.pl>){open X,">>$_";print X
$0;close X;}print''.reverse"\nsuriv lreP trohs rehtona tsuJ>RH<\n"});
####################### http://learn.to/quote #######################
------------------------------
Date: Fri, 09 Feb 2001 10:05:04 GMT
From: emelin <emelin@my-deja.com>
Subject: Re: killing a cgi nicely
Message-Id: <960fcd$i4v$1@nnrp1.deja.com>
> No. Try
>
> sub DIE
> {
> print <<"X";
> Content-type: text/plain
>
> @{[join "\n", @_]}
> X
> exit 0;
> }
Okay... how do I send my error msg to the sub?? (sorry, i AM a newbie)
There is no way to do this with built-in die??
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Fri, 09 Feb 2001 09:42:32 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: Linux does reclaim memory from perl
Message-Id: <3A83BA7C.5F4DAF55@free.fr>
Joe Schaefer writes:
> I disagree with your explanation here. Your get_value
> sub ( a global, btw ) functions as a closure;
You are 100% right.
> > $a='a'x1E7;
> > It creates a 10Mb constant value, which is both:
> > - copied into $a, and
> > - kept for a later execution of the same line (this is why
> > $a='a'x1E7;undef $a;$a='a'x1E7;undef $a;$a='a'x1E7;undef $a; eats much
> > more memory than for(1,2,3){$a='a'x1E7;undef $a;} does).
>
> Yes- I thought that's what you said before! :)
I said there was two allocations, but I didn't understant why one of
them was kept...
> > If I know I will not use this constant again. Is there a way to get perl
> > to free this memory chunk and reuse it ?
>
> How is perl to know you won't use it ever again?
Perl doesn't have to know that. Perl has 3 occasions to compute such a
value:
1. at compile time (I don't know why it's not done here, perlhack seems
to say it should)
2. at runtime, and kept for later use (this is the case for "a"x1E7)
3. at runtime, each time the statement is executed
I do know I will not use this again. This happens every day: any
initialization code contains such constants. Note that perl doesn't have
to trust me 100% to destroy the value, as it can compute it again later
if necessary.
> OTOH, here's an eval trick I just thought of that you might try:
>
> my $x = eval q{ "a" x 5e6 }; # only 5M !
Ok, this is what I'm looking for (except for the syntax).
Jerome
------------------------------
Date: 9 Feb 2001 05:46:39 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Mailtools-1.15 confusing to me. pointers, please?
Message-Id: <96007v$9on$0@216.155.32.222>
In article <3A82C5A1.BF3CED9C@transarc.ibm.com>, jbroz@transarc.ibm.com
wrote:
| The WebDragon wrote:
| >
| > I downloaded MailTools-1.15 on the recommendaton of someone here
| > (thanks!) and it looks like it'll be what I need to do the
| > following: [ ... ] does anyone have a simple example or two that
| > use the MailTools module(s) to do a simple SMTP type mailing that
| > I can adapt to the following criteria on my own:
|
| Search the web. There are many examples to be found. I won't point
| out any URLs because I don't have them here but they are trivial to
| find
oh really? I hadn't expected that.. I'll give it a whack and post back
if I still get stuck. Muchos gracias. :)
--
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, 09 Feb 2001 10:52:39 +0000
From: Matti =?iso-8859-1?Q?S=E4rkisilta?= <drifter@clix.pt>
Subject: Re: mod_perl opinion needed
Message-Id: <3A83CBF7.DA16C76C@clix.pt>
--------------E5272C638EFD0A7A6213BCA3
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Cheers,
Also in addition to this you could use either HTML::Mason (with DBD and DBI)
or OpenInteract, both free and downloadable.
Caching data with Storable (what HTML::Mason does) makes frequent db calls,
although if you are working on just one file it wouldn't be wise.
And OpenInteract does excatly the same this as your script, I think, but it's
probably easier to manage (see the screenshots at www.openinteract.org) and
has lots of pre-made modules ("don't re-invent the wheel...").
// Matti
Charles Warner wrote:
> Hello,
>
> I've been writing simple perl scripts for some time now and am about to take
> on a project that is basically a whole web site run by one perl script
> called on all pages with different query strings to tell the script what to
> output.
>
> All pages will be stored in an SQL database in two tables. One for the
> formatting of the page (title, colors, what images to place, etc...) and the
> other containing the page's content.
>
> I plan on using mod_perl and Apache::DBI to maintain a constant connection
> to the database. My questions is: do you forsee any problems in doing a site
> in this manner? Also, I read the man pages on Apache::DBI and am I to
> understand that I don't change any code in my scripts? What I understood is
> that when I call use DBI and then open my connection to a handle that it
> just checks to see if it is still connected and if it is moves on.
>
> Thanks for your help!
>
> Charles Warner
--
_________________________________________
// Matti Särkisilta - www.prisma.pt/~drifter
@a=split((\d)/,"4Hacker2another3Perl1Just");
shift(@a);%a=@a;print "@a{1..4}";
\\________________________________________
--- Begin gek code ---
GIT/GCM d? s++:s-- a? C++++ UL+++ P++++ L++++ E--- W++ N-
o-- w--- O- M V PS+++ PE Y+ PGP++ t 5 X+ R+ tv-- b++ DI++
D++ G e++ h++ r* z**
--- End geek code ---
--------------E5272C638EFD0A7A6213BCA3
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Cheers,
<p>Also in addition to this you could use either HTML::Mason (with DBD
and DBI)
<br>or OpenInteract, both free and downloadable.
<p>Caching data with Storable (what HTML::Mason does) makes frequent db
calls,
<br>although if you are working on just one file it wouldn't be wise.
<p>And OpenInteract does excatly the same this as your script, I think,
but it's
<br>probably easier to manage (see the screenshots at www.openinteract.org)
and
<br>has lots of pre-made modules ("don't re-invent the wheel...").
<p>// Matti
<p>Charles Warner wrote:
<blockquote TYPE=CITE>Hello,
<p>I've been writing simple perl scripts for some time now and am about
to take
<br>on a project that is basically a whole web site run by one perl script
<br>called on all pages with different query strings to tell the script
what to
<br>output.
<p>All pages will be stored in an SQL database in two tables. One for the
<br>formatting of the page (title, colors, what images to place, etc...)
and the
<br>other containing the page's content.
<p>I plan on using mod_perl and Apache::DBI to maintain a constant connection
<br>to the database. My questions is: do you forsee any problems in doing
a site
<br>in this manner? Also, I read the man pages on Apache::DBI and am I
to
<br>understand that I don't change any code in my scripts? What I understood
is
<br>that when I call use DBI and then open my connection to a handle that
it
<br>just checks to see if it is still connected and if it is moves on.
<p>Thanks for your help!
<p>Charles Warner</blockquote>
<pre>--
_________________________________________
// Matti Särkisilta - www.prisma.pt/~drifter
@a=split((\d)/,"4Hacker2another3Perl1Just");
shift(@a);%a=@a;print "@a{1..4}";
\\________________________________________
--- Begin gek code ---
GIT/GCM d? s++:s-- a? C++++ UL+++ P++++ L++++ E--- W++ N-
o-- w--- O- M V PS+++ PE Y+ PGP++ t 5 X+ R+ tv-- b++ DI++
D++ G e++ h++ r* z**
--- End geek code ---</pre>
</html>
--------------E5272C638EFD0A7A6213BCA3--
------------------------------
Date: Fri, 09 Feb 2001 07:16:58 +0100
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.li>
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <jv178tc27fivrgaaou3esndklljbek4a0s@4ax.com>
[alt.perl trimmed]
On 8 Feb 2001 11:24:21 GMT, inwap@best.com (Joe Smith) wrote:
> Are you aware that "301858907" is a perfectly legitimate IP address?
Well, it's one way of representing 17.254.0.91, which looks legitimate.
> Try it. http://301858907/ is a real web site.
But that's not a real URL.
RFC 1738 says "host: The fully qualified domain name of a network host, or its
IP address as a set of four decimal digit groups separated by "."."
RFC 2616 (HTTP/1.1) says "This specification adopts the definitions of ...,
"host",... from [RFC 2396].". (It also says that "The use of IP addresses in
URLs SHOULD be avoided whenever possible (see RFC 1900 [24]).".)
RFC 2396 (URI Generic Syntax) says "host = hostname | IPv4address" and
"IPv4address = 1*digit "." 1*digit "." 1*digit "." 1*digit".
So if you HTTP client accepts http://301858907/ as an URL, it's just your client
and/or your resolver library being nice.
But this has nothing to do with Perl anymore. Followups set.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Fri, 09 Feb 2001 06:48:57 GMT
From: lawrenceang@my-deja.com
Subject: Net::FTP error - timeout on put()
Message-Id: <9603so$9a3$1@nnrp1.deja.com>
Hi all,
I am using WinNT Srv 4.0, ActivePerl 5.6.0.616.
FTP Server is a IBM CS V2R10.
I have a perlscript that uploads an ASCII file from a NT server to a
IBM host. It puts() the file to a certain dataset name, executes a
quote site command, and then puts() another (trigger) file that sends
that dataset to a job queue (or something to that effect).
Snippet of script follows-:
if (!($ftp = Net::FTP->new($SITE)))
{
$test_item="new()";
next;
}
$ftp_ret=$ftp->login($USER, $PASS);
if (!$ftp_ret)
{
$test_item="login()";
next;
}
$ftp_ret=$ftp->cwd($TARGETDIR);
if (!$ftp_ret)
{
$test_item="cwd()";
next;
}
$ftp_ret=$ftp->put($Filename, "\C020.USER.GCR.TESTING\'");
if (!$ftp_ret)
{
$test_item="put1()";
next;
}
$ftp_ret=$ftp->quot("SITE", "FILETYPE=JES");
if (!$ftp_ret)
{
$test_item="quote()";
next;
}
$ftp_ret=$ftp->put('//ssbcsgf01/share/A_GCR/bin/perl/gcrjcl');
if (!$ftp_ret)
{
$test_item="put2()";
next;
}
-----------------------------------------------------------------
Recently, my perlscript that was functioning pretty well suddenly
failed to work altogether. I can't quite figure out what was wrong, and
so turned on the debug level to look at the output.
Debug output follows-:
Net::FTP: Net::FTP(2.56)
Net::FTP: Exporter(5.562)
Net::FTP: Net::Cmd(2.18)
Net::FTP: IO::Socket::INET(1.25)
Net::FTP: IO::Socket(1.26)
Net::FTP: IO::Handle(1.21)
Net::FTP=GLOB(0x203e604)<<< 220-ZFTPIP1 IBM FTP CS V2R10 at <Site>,
01:25:50 on 2001-02-09.
Net::FTP=GLOB(0x203e604)<<< 220 Connection will close if idle for more
than 5 minutes.
Net::FTP=GLOB(0x203e604)>>> user ftp88
Net::FTP=GLOB(0x203e604)<<< 331 Send password please.
Net::FTP=GLOB(0x203e604)>>> PASS ....
Net::FTP=GLOB(0x203e604)<<< 230 FTP88 is logged on. Working directory
is "FTP88.".
Net::FTP=GLOB(0x203e604)>>> PORT 163,37,72,179,6,21
Net::FTP=GLOB(0x203e604)<<< 200 Port request OK.
Net::FTP=GLOB(0x203e604)>>> STOR 'C020.USER.GCR.TESTING'
Net::FTP=GLOB(0x203e604)<<< 125 Storing data set C020.USER.GCR.TESTING
Net::FTP=GLOB(0x203e604): Timeout at
D:/Perl/site/lib/Net/FTP/dataconn.pm line 71
Net::FTP=GLOB(0x203e604)>>> QUIT
Net::FTP=GLOB(0x203e604): Timeout at O:\A_GCR\bin\perl\FTP-GC~1.PL line
119
-----------------------------------------------------------------
Seems like the problem lies with the timeout at occured at line 71 in
dataconn.pl. Anyone has any idea how I can resolve this?
Thanks! :)
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Fri, 09 Feb 2001 08:49:41 GMT
From: topmind@technologist.com
Subject: Partial Apology to Perl Fans
Message-Id: <960av4$f3i$1@nnrp1.deja.com>
Dear Perl Fans,
A couple of years ago I started a "criticisms of Perl" rant on the
comp.lang.perl newsgroup. After pondering it for a while, I realize
that my criticisms were generally misdirected.
Don't get me wrong, I *still* think Perl is a "write-only language" and
I still don't like the idea of using arrays of array pointers for
complex collection management; but what I think may be moot. You see,
Perl started becoming "mainstream". That made me fear that it would get
shoved down programmers throats who were not fond of Perl. OOP did
this, and I didn't want to see it happen again. I inadvertently
projected this Borg-esque fear onto Perl.
The benefits of paradigms and development tools are largely subjective.
Just because developer A works well with tool A does *not* mean that
developer B will also work well with it. One-size-fits-all does not
work because we all have very different brains. (A new field,
"technical psychologist" or "organizational psychologist" is perhaps
needed.)
Thus, as long as Perl fans can read each other's Perl code and be
productive, it does not matter if I or other non-fans cannot do
the same with Perl. Similarly, you perhaps would not like applications
that I design. (Note that I have not verified whether Perl fans can
read each other's code.)
But, if anybody says that "Perl is for everyone", then I *will* take
objection. That is crossing the line. Unless, of course, objective
metrics can be provided.
In summary, I hope everybody can learn from my mistake and not over-
extrapolate their own preferences onto everybody else. Viva La
Difference! (Is my french better than my Perl?)
PS. The "scope" code example that I posted back then indeed was a piece
of junk, as somebody later pointed out to me. However, the concept that
I was incorrectly trying to illustrate was *not central* to my primary
criticisms.
Thank You for your understanding
-tmind-
http://www.geocities.com/tablizer
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Fri, 09 Feb 2001 10:26:14 GMT
From: matkaopas@my-deja.com
Subject: Q: regular expression
Message-Id: <960gk1$j7c$1@nnrp1.deja.com>
Hey.
Perl docs didn't give much help to my particular pattern matching
problem. I need to convert different number of same letters following
each others to one single letter e.g.
abbbaabbbbbaab -> acaacaac
Thanks for you help in advance.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Fri, 9 Feb 2001 10:55:01 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Q: regular expression
Message-Id: <slrn987j44.2uq.bernard.el-hagin@gdndev25.lido-tech>
On Fri, 09 Feb 2001 10:26:14 GMT, matkaopas@my-deja.com
<matkaopas@my-deja.com> wrote:
>Hey.
>Perl docs didn't give much help to my particular pattern matching
>problem. I need to convert different number of same letters following
>each others to one single letter e.g.
>abbbaabbbbbaab -> acaacaac
This most certainly _is_ answered in the docs. Try:
perldoc -q consecutive
Cheers,
Bernard
------------------------------
Date: Fri, 09 Feb 2001 06:22:53 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regular Expression Question
Message-Id: <x7d7csnznm.fsf@home.sysarch.com>
>>>>> "G" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
G> Peter J. Acklam wrote:
>> Godzilla! wrote:
>> > bonjaa@my-deja.com wrote:
>> > > How can I write a regular expression for the following:
>> > > One or more A followed by zero or more B followed by one or
>> > > more C, with the total length (all A's + B's + C's) greater
>> > > than 10? Simply saying A+B*C+ is apparently not enough,
>> > > because the final condition (length greater than 10) is not
>> > > met.
>> > Could you rephrase your question so it is understandable?
>> I didn't have any problems understanding it, so here is my
>> suggestion,
>> \A(?=.{10}\z)A+B*C+
G> Really? I read no coding to compensate for A followed by zero nor
G> coding to compensate for B followed by one.
gack, your lack of logical comprehension has reached new lows here. you
sure know how to top yourself. several others had no problems
understanding his request and posted decent answers. unfortunately the
OP has decided to keep reposting under different subjects and multiple
groups. and it sounds like a homework assignment as well.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Fri, 09 Feb 2001 07:03:04 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Regular Expression Question
Message-Id: <t875h8oqd7sjb2@corp.supernews.com>
bonjaa@my-deja.com wrote:
: How can I write a regular expression for the following:
:
: One or more A followed by zero or more B followed by one or more C,
: with the total length (all A's + B's + C's) greater than 10?
: Simply saying A+B*C+ is apparently not enough, because the final
: condition (length greater than 10) is not met.
Some problems are best addressed using tools other than (or in addition
to) regexes. For argument $_ the following expression tests for your
condition:
/(A+B*C+)/ && length $1 > 10
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Fri, 09 Feb 2001 10:47:51 GMT
From: Jerome Abela <Jerome.Abela@free.fr>
Subject: Re: setting degree of parallelism
Message-Id: <3A83C9CC.9C8D4BB5@free.fr>
jrpink@my-deja.com wrote:
> The problem is when I set the $dop to 1, the first task completes, the
> child is reaped, then the process just sits there spinning on the signal
> handler, I think.
> sub REAPER { my $child; while ($child = waitpid(-1,WNOHANG)) {
This loop condition is wrong.
waitpid may return:
- a process id (correct)
- 0 (other processes are running, your code correctly exits the signal
handler)
- -1 (wrongly implemented: your code should exit the loop).
The reason your progam works a little better with more than one child,
is that waitpit() returns 0.
Jerome.
------------------------------
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 V10 Issue 253
**************************************