[19997] in Perl-Users-Digest
Perl-Users Digest, Issue: 2192 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 23 21:05:51 2001
Date: Fri, 23 Nov 2001 18:05:07 -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: <1006567507-v10-i2192@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 23 Nov 2001 Volume: 10 Number: 2192
Today's topics:
ANNOUNCE: Filter::Simple 0.77 (Damian Conway)
Re: Best language for low IQ programmers? <gg@gg.net>
Re: Difficulty with references and hashes nobull@mail.com
Re: Do Not Redirect CGI Questions To CIWAC <mgjv@tradingpost.com.au>
Re: Enigma encryption <mgjv@tradingpost.com.au>
Re: File locking question <J.E.J.opdenBrouw@st.hhs.nl>
Re: File locking question (Mark Jason Dominus)
Re: File locking question (Mark Jason Dominus)
Re: Help me define PACK? <jazz450@hotmail.com>
I can't figure out this syntax error <mjc@drizzle.net>
Re: I can't figure out this syntax error <tony_curtis32@yahoo.com>
Re: I can't figure out this syntax error <mjc@drizzle.net>
modify arguments in a sub / function... <moodie@fast.net>
Re: modify arguments in a sub / function... (Tad McClellan)
Re: modify arguments in a sub / function... <moodie@fast.net>
Re: modify arguments in a sub / function... <Laocoon@eudoramail.com>
Re: modify arguments in a sub / function... <comdog@panix.com>
Re: Problems with Mirror - ftp.pl doesn't get the right <uri@stemsystems.com>
Strange behavior with Net::FTP (BUCK NAKED1)
Re: Traversing directories <rafalk@home.com>
Re: Traversing directories (Garry Williams)
Re: Using CGI.pm to obtain a list of params <flavell@mail.cern.ch>
Re: Using CGI.pm to obtain a list of params <wsegrave@mindspring.com>
Re: Using CGI.pm to obtain a list of params <wsegrave@mindspring.com>
Re: variable scope <matthew.garrish@sympatico.ca>
Re: Which ISPs support perl scripts? <echang@netstorm.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Nov 2001 19:49:46 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Filter::Simple 0.77
Message-Id: <9tm98q$i4c$1@towncrier.cc.monash.edu.au>
Keywords: perl, module, release
==============================================================================
Release of version 0.77 of Filter::Simple
==============================================================================
NAME
Filter::Simple - Simplified source filtering
SYNOPSIS
# in MyFilter.pm:
package MyFilter;
use Filter::Simple;
FILTER { ... };
# or just:
#
# use Filter::Simple sub { ... };
# in user's code:
use MyFilter;
# this is filtered
no MyFilter;
# this is not
DESCRIPTION
The Filter::Simple module provides a simplified interface to
Filter::Util::Call; one that is sufficient for most common cases.
AUTHOR
Damian Conway (damian@conway.org)
COPYRIGHT
Copyright (c) 2000-2001, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the same terms as Perl itself.
==============================================================================
CHANGES IN VERSION 0.77
- Re-allowed user-defined terminators to be regexes
==============================================================================
AVAILABILITY
Filter::Simple has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Filter-Simple.tar.gz
==============================================================================
------------------------------
Date: Fri, 23 Nov 2001 20:34:20 -0500
From: Gregor <gg@gg.net>
Subject: Re: Best language for low IQ programmers?
Message-Id: <08utvtg6437744cjn7120ul528hjbeg25s@4ax.com>
As a professional web developer, I would have to say LOGO is the wave
of the future. LOGO is an unappreciated language and easy to learn!
It's so fun to watch the turtle running around my Atari Mega ST4's
screen! A few easy commands and you're ready to go.
Avoid at all costs C++, Java, Visual Basic, JavaScript/VBscript, and
PERL. These languages are the tools of the US military/industrial
complex that controls the W3 and are only truly understood by
operatives of the CIA, NSA and FBI.
Also, do not code any web pages beyond the HTML 2.0 spec since there
are serious security issues involved in later implementations of the
DTD.
------------------------------
Date: 23 Nov 2001 19:04:20 +0000
From: nobull@mail.com
Subject: Re: Difficulty with references and hashes
Message-Id: <u9ofltcnrf.fsf@wcl-l.bham.ac.uk>
greg loscombe <lovedaddy@heros-keep.com> writes:
> Hi, Im kind of new to this programming lark, so please go easy.
>
> Slight problem:
>
> #!/usr/bin/perl -w
>
> use strict;
Good - some safety devices in place. BTW: In Perl 5.6 you can 'use
warnings' instead of putting -w on the shebang line. It has some
subtle advantages that are explained in 'perldoc perllexwarn' if you
are interested - otherwise just take it on trust.
> my %search = ("id" => 3);
> my $results = &search_hash('quote', 'search', 'foo');
Why is there an & in that line? If the answer is "I don't know"
then remove it. Some day when you've nothing better to do read
'perldoc perlsub' and find out what the & above means.
> #print $results;
>
> # subs
> sub search_hash {
> no strict;
'My smoke alarms are making that screatching noise again - better go
remove the batteries...'
No!
If your safety devices are preventing you from doing something your
first thought should be to figure out what you need to avoid
triggering the alarms. Disabling alarms should only be done by people
who know what they are doing. Note also that you have disabled 3
safety devices here. Only one of these (strict 'refs') need to be
disabled to allow you to continue to doing the reckless thing you are
doing without triggering alarms.
> ($table, $field_values, $test) = @_;
That's a classic! In the very next statement you run fall foul of
your blunderbus 'no strict'.
Because you also disabled strict 'vars' Perl did not detect the
missing 'my' in the above line. When bypassing safety devices it is
wise to bypass as few as possible. Better still find a safe way to do
what you want.
> The way I see it, in the sub $field_values = "search"
> Thus print %$field_values should be the same as print %search.
You mean 'symbolic reference' not 'scalar reference'.
In Perl symbolic references cannot refer to lexically scoped
variables.
You _could_ make your program work by removing the 'use strict' and
the 'my' in front of %search. But this would be an exceptionally bad
thing to do.
> Im guessing its just something I've missed, but I cannot for the life
> of me work out what it is.
What you have missed is the 1000s the posts from all the experienced Perl
user in this news group pleading with newbies "For $DEITY's sake stop
using symbolic references and use real ones".
#!/usr/bin/perl
use strict;
use warnings;
my %search = ("id" => 3);
my $results = search_hash('quote', \%search, 'foo');
sub search_hash {
my ($table, $field_values, $test) = @_;
my @fields = sort keys %$field_values;
}
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Sat, 24 Nov 2001 11:17:06 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Do Not Redirect CGI Questions To CIWAC
Message-Id: <slrn9vtpo2.to2.mgjv@martien.heliotrope.home>
On Fri, 23 Nov 2001 04:38:53 -0800,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Randal L. Schwartz wrote:
>
>> Godzilla! wrote:
>
>> > I will state again what I have recently stated.
>> > Do not redirect people with cgi questions to
>> > the comp.infosystems.www.authoring.cgi group.
>
>> Ahh yes. The Consensus of One.
>
> It would appear I am the only person who cares
> enough to express concerns about the defunct and
> barely operative cgi group.
There may be many people who care. It is of no concern to us. Neither is
the demise of any other newsgroup that has no bearing on perl.
Take your whinges to a place where they care.
Martien
--
Do not pay any attention to what Godzilla says. It is a troll, and has
no decent working knowledge of Perl or programming in general. Search
groups.google.com to see a history of its posts and replies to these posts.
------------------------------
Date: Sat, 24 Nov 2001 11:12:25 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Enigma encryption
Message-Id: <slrn9vtpf9.to2.mgjv@martien.heliotrope.home>
On Fri, 23 Nov 2001 07:03:59 -0800,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Jonas Nilsson wrote:
>
>
>> The problem is that the average run time is 40-130 hours
>
>> So my question. Is there some nice module that can wrap my code to measure
>> where the bottlenecks are, and thus where the code optimization is most
>> needed. I know about the Benchmark module, but it would be nice to do the
>> measurments in the complete script. Any suggestions?
>
>
> Beneath my signature you will discover a script which can be
> adapted to measuring any portion, portions or an entire script,
> if you have a DOS box available. For multiple measurements,
> just a matter of using my $start, $stop and subroutine call
> as needed within a script.
Totally broken. Don't use it. You want Devel::DProf.
Martien
--
Do not pay any attention to what Godzilla says. It is a troll, and has
no decent working knowledge of Perl or programming in general. Search
groups.google.com to see a history of its posts and replies to these posts.
------------------------------
Date: Fri, 23 Nov 2001 22:00:53 +0100
From: "J. op den Brouw" <J.E.J.opdenBrouw@st.hhs.nl>
Subject: Re: File locking question
Message-Id: <3BFEB905.F27F54A4@st.hhs.nl>
Ahhh, and this is ofcouse safe to use? I know that moving the file
on the same file system is merely a inode move-around, but is
it an atomic operation?
Further more, if another user is reading/writing the file to
be moved, the remove should not take place after the other user
completed his/her operation, but Unix will take care of that too,
right?
Mark Jason Dominus wrote:
>
> For example, on a unix system, if the source and destination names are
> on the same filesystem (that is, the same disk) then you can use the
> Perl 'rename()' function and it will be safe. The file is renamed all
> at once. rename does *not* read A, then remove it, then write B. It
> just renames the file.
--Jesse
------------------------------
Date: Fri, 23 Nov 2001 21:42:24 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: File locking question
Message-Id: <3bfec2bf.2770$17a@news.op.net>
In article <3BFEB905.F27F54A4@st.hhs.nl>,
J. op den Brouw <J.E.J.opdenBrouw@st.hhs.nl> wrote:
>Ahhh, and this is ofcouse safe to use? I know that moving the file
>on the same file system is merely a inode move-around, but is
>it an atomic operation?
Yes.
>Further more, if another user is reading/writing the file to
>be moved, the remove should not take place after the other user
>completed his/her operation, but Unix will take care of that too,
>right?
It doesn't matter, since none of the data blocks are affected. On a
unix system, the file is identified with the inode, not with the
name. An open file descriptor has a pointer to the inode, not to the
file name. If you open a file under a certain name, say A, the
filehandle now contains the i-number, say 123456. Now if A is renamed
to B, it is still inode 123456, and any writing to the filehandle will
go into the same place as if the file had not been renamed. The name
is only a way of looking up the number.
--
@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, 23 Nov 2001 21:44:53 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: File locking question
Message-Id: <3bfec354.278b$135@news.op.net>
In article <776e0325.0111231042.3ccdef3e@posting.google.com>,
Sara <genericax@hotmail.com> wrote:
>Ahh I KNEW there was a reason I always use GDBM- just forgot what it
>was..
GDBM has been a very bad choice in my experience.
See:
http://groups.google.com/groups?selm=88omk2%24hud%241%40monet.op.net
Oh that and the other thing that SDBM and some of the others can
>only handle a small number of records.
DB_File can do that too.
--
@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: Tue, 20 Nov 2001 14:34:33 -0800
From: john <jazz450@hotmail.com>
Subject: Re: Help me define PACK?
Message-Id: <68813D6021F48DE8.E1033E745308DDCE.9E7CF635FDE98DE6@lp.airnews.net>
Clear as mud but thanks for the help. It does START to make sense.
John
------------------------------
Date: Fri, 23 Nov 2001 15:50:32 -0800
From: mike <mjc@drizzle.net>
Subject: I can't figure out this syntax error
Message-Id: <qsntvtsr67e83pkam0e0106k62a2uj2di5@4ax.com>
I'm writing a script to append data from a form input to a
text file, and then to combine three text files into to an
html file. Here's the script:
#!usr/bin/perl
$head = "C:\Xitami\Pat-Acceptance\LAX\Head.txt";
$body = "C:\Xitami\Pat-Acceptance\LAX\Body.txt";
$tail = "C:\Xitami\Pat-Acceptance\LAX\Tail.txt";
$gifts = "C:\Xitami\Pat-Acceptance\LAX\Gifts.html";
%postInputs = readPostInput()
open (BODY, ">>$body");
print BODY << "EOF";
<tr>
<td valign=\"Top\">
$postInputs { 'Giver_Name'}
<br>
</td>
<td valign=\"Top\">
$postInputs { '$Gift_Name'}
<br>
</td>
</tr>
EOF
. . .
The error message I'm getting is this:
C:\Xitami\cgi-bin>perl readInput.pl
syntax error at readInput.pl line 9, near ")
open "
/%([a-fA-F0-9][a-fA-F0-9] /: unmatched () in regexp at
readInput.pl line 35.
The second error message I'm getting occurs, I think because
I'm testing the program for syntax errors at a command line.
But I cannot figure out where the first syntax error is
arising. Any clues, kind people? Other syntax error you
might see, as well?
Mike
------------------------------
Date: Fri, 23 Nov 2001 17:59:28 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: I can't figure out this syntax error
Message-Id: <87snb5t4wv.fsf@limey.hpcc.uh.edu>
>> On Fri, 23 Nov 2001 15:50:32 -0800,
>> mike <mjc@drizzle.net> said:
> I'm writing a script to append data from a form input to
> a text file, and then to combine three text files into
> to an html file. Here's the script:
> #!usr/bin/perl
#!/usr/bin/perl -w
use strict;
use diagnostics;
should help perl to point out some of the more obvious
syntax errors.
> $head = "C:\Xitami\Pat-Acceptance\LAX\Head.txt";
You need to print out the value of $head here; it's not
what you think it is (consider the behaviour of "\" inside
double qoutes). You can use "/" even on MS thingies
(AFAIK).
> open (BODY, ">>$body");
Always check open()s to see if they succeeded.
> open " /%([a-fA-F0-9][a-fA-F0-9] /: unmatched () in
> regexp at readInput.pl line 35.
This looks like a stealth CGI question. Use the CGI.pm
module:
http://stein.cshl.org/WWW/software/CGI/
hth
t
--
Oh! I've said too much. Smithers, use the amnesia ray.
------------------------------
Date: Fri, 23 Nov 2001 16:33:29 -0800
From: mike <mjc@drizzle.net>
Subject: Re: I can't figure out this syntax error
Message-Id: <pkqtvto46c77fbmo3rvif2f21utrn0eqhk@4ax.com>
Tony Curtis wrote:
>>> On Fri, 23 Nov 2001 15:50:32 -0800,
>>> mike <mjc@drizzle.net> said:
>> I'm writing a script to append data from a form input to
>> a text file, and then to combine three text files into
>> to an html file. Here's the script:
>> #!usr/bin/perl
>#!/usr/bin/perl -w
>use strict;
>use diagnostics;
Got it, thanks.
>should help perl to point out some of the more obvious
>syntax errors.
>> $head = "C:\Xitami\Pat-Acceptance\LAX\Head.txt";
>You need to print out the value of $head here; it's not
>what you think it is (consider the behaviour of "\" inside
>double qoutes). You can use "/" even on MS thingies
>(AFAIK).
:) duh, mike.
>> open (BODY, ">>$body");
>Always check open()s to see if they succeeded.
Yep, got it.
>> open " /%([a-fA-F0-9][a-fA-F0-9] /: unmatched () in
>> regexp at readInput.pl line 35.
>This looks like a stealth CGI question. Use the CGI.pm
>module:
> http://stein.cshl.org/WWW/software/CGI/
Thanks, I'll take a look.
>hth
Yes, very much, thank you.
Mike
------------------------------
Date: Fri, 23 Nov 2001 14:21:39 -0500
From: "MisterSoftware" <moodie@fast.net>
Subject: modify arguments in a sub / function...
Message-Id: <tvt8eu4p9a7ta8@corp.supernews.com>
Hi there!
I'm working on a piece of code and I want to modify the args -and- return a
status:
sub contains {
($s1,my($s2)) = @_;
@s2 = split(//,$s2);
for ($i = 0; $i <= $#s2; $i++ ) {
if (!($s1 =~ s/$s2[$i]//)) {return(0)};
}
return (1);
}
if ( &contains ( $string1, $string2 ) { ... and so on }
I want $s2 to be modified on return;
I know I could pass a pointer to struct, etc..., or use a "global" var (not
local or my).
Any suggests?
Thanx in advance!
------------------------------
Date: Fri, 23 Nov 2001 21:19:44 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: modify arguments in a sub / function...
Message-Id: <slrn9vtcka.t9.tadmc@tadmc26.august.net>
MisterSoftware <moodie@fast.net> wrote:
>
>I'm working on a piece of code and I want to modify the args -and- return a
>status:
>
>sub contains {
> ($s1,my($s2)) = @_;
> @s2 = split(//,$s2);
> for ($i = 0; $i <= $#s2; $i++ ) {
> if (!($s1 =~ s/$s2[$i]//)) {return(0)};
> }
> return (1);
>}
>if ( &contains ( $string1, $string2 ) { ... and so on }
^
^ I'm pretty sure that you don't want that ampersand there.
>I want $s2 to be modified on return;
Eh? You do not modify $s2 in your subroutine above.
What form of modification where you hoping to accomplish?
You _do_ modify $s1, is that what you meant to say?
perldoc perlsub
tells you how to do get pass-by-reference semantics (without
"references" even).
------------------------------
Any arguments passed in show up in the array C<@_>. Therefore, if
you called a function with two arguments, those would be stored in
C<$_[0]> and C<$_[1]>. The array C<@_> is a local array, but its
elements are aliases for the actual scalar parameters. In particular,
if an element C<$_[0]> is updated, the corresponding argument is
updated...
------------------------------
Seems really strange that you did not read about Perl subroutines
when you had a question about Perl subroutines.
Use the docs, Luke!
>I know I could pass a pointer to struct, etc..., or use a "global" var (not
>local or my).
>
>Any suggests?
Yes, several:
Do not use global variables ($s1, @s2) unless you really really
need to.
Do not write C code in Perl :-)
foreach my $substr ( split(//, $s2) ) { # look Ma! No explicit indexing!
If any of the elements in @s2 are regex metacharacters, then you'll
need to escape them to match a literal character:
if (!($s1 =~ s/\Q$s2[$i]//)) {return(0)};
^^
^^
There are rather more punctuation characters there than you need:
return 0 unless $s1 =~ s/\Q$s2[$i]//;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Nov 2001 17:03:01 -0500
From: "MisterSoftware" <moodie@fast.net>
Subject: Re: modify arguments in a sub / function...
Message-Id: <tvthtcilasc3f9@corp.supernews.com>
First off, thanks, Tad.
Yes, I meant to modify $s1, not $s2.
I'm embarrassed to say I'm doing my development using Perlwindows, so I
don't have perldoc. I'll check perl.com and see if I can find anything
there.
I've never seen the code structure C<@_> so I'll have to look at that one...
I'm fiddling with passing references, but having trouble making it do what I
want since (after reading a number of scolds on "use strict" and -w on the )
I'm now ""use"ing"" strict". I get some error about "scalars...". But I
did manage to get rid of several hundred warnings... Down to one where I try
to redirect my output to a file -or- STDERR (something about a "bare" string
???) kinky.
Thanks again.
------------------------------
Date: Fri, 23 Nov 2001 23:24:04 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: modify arguments in a sub / function...
Message-Id: <Xns9162EE1E45FFCLaocooneudoramailcom@62.153.159.134>
never mind the C< and >
If you alter the @_ array you alter the actual values
i.e.:
sub change { $_[0] = 'value' }
$test = 'nothing';
change($test);
print $test # prints 'value'
http://www.perldoc.com
You might consider looking for a tutorial too..
Lao
------------------------------
Date: Fri, 23 Nov 2001 17:11:22 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: modify arguments in a sub / function...
Message-Id: <comdog-379008.17112223112001@news.panix.com>
In article <tvthtcilasc3f9@corp.supernews.com>, "MisterSoftware"
<moodie@fast.net> wrote:
> First off, thanks, Tad.
>
> Yes, I meant to modify $s1, not $s2.
>
> I'm embarrassed to say I'm doing my development using Perlwindows, so I
> don't have perldoc. I'll check perl.com and see if I can find anything
> there.
ActiveState Perl comes with documentation. do you have that?
you also also look at the documentation online at
http://www.perldoc.com
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Fri, 23 Nov 2001 22:28:00 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <x76681azpt.fsf@home.sysarch.com>
>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
>> &send( sprintf( "SITE CHMOD %o $path", $mode ) );
AS> This is bad code. The author doesn't know how to use sprintf. In
AS> particular, variable strings ($path) do *not* belong in the sprintf
AS> format. The line should read
AS> &send( sprintf( "SITE CHMOD %o %s", $mode, $path ) );
why can't the sprintf format string interpolate? in fact that is the
only way to emulate c's s/printf using * for a field size and taking the
next argument for its value. and there are times when you want to
interpolate AND sprintf and interpolation is simpler and faster.
here is an example where i have some perl vars (one actually) and some
calls i want to merge into one string:
my $info = sprintf( <<INFO,
SockMsg connected
Type: $type
Local: %s:%d
Remote: %s:%d
INFO
$connected_sock->sockhost(),
$connected_sock->sockport(),
$connected_sock->peerhost(),
$connected_sock->peerport(),
) ;
now if i used the Perl6::Interpolate (IIRC) module i could use $() in
the string and not need sprintf. of course perl6 will allow that.
i won't use the ugly and broken ${\} tricks.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 23 Nov 2001 13:08:46 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Strange behavior with Net::FTP
Message-Id: <13748-3BFE9EBE-181@storefull-245.iap.bryant.webtv.net>
I've read every article I can find in Google about this problem with
Net::FTP; and there is no definitive answer to this question.
Why am I getting "unexpected EOF on Command Channel" when I use Net:FTP
on one server and not another? I get this error on the first line of the
script.
$ftp = Net::FTP->new($host, Debug=>1); and only get it when trying to
upload to a Tripod site.
I'm not a fan of Tripod; but many msntv users use Tripod, and my FTP
script is the only way they have to upload files, so I want my script
to be compatible with Tripod.
My script works fine on a particular webhost on one of their servers;
but will not work on a different server of theirs.
I thought Tripod was the problem...
I researched and found out that Tripod uses a different sort of FTP
server; and others have had problems connecting to Tripod regardless of
what FTP client they used. But the script works from the other server at
the same webhost, so that would eliminate Tripod as the problem.
I also thought my webhost might have different versions of perl, CGI.pm,
Net:FTP, and its dependent modules installed on these 2 different
servers. I checked and all is the same on both servers... same versions,
and same number of bytes on all the files. So, it doesn't look like it's
a server problem either.
I'm stumped.
Regards,
Dennis
------------------------------
Date: Fri, 23 Nov 2001 23:53:54 GMT
From: Rafal Konopka <rafalk@home.com>
Subject: Re: Traversing directories
Message-Id: <3BFEE415.2DA03EA5@home.com>
Tad McClellan wrote:
>
> I expect you meant error _message_?
>
> Care to share the error message text with us?
>
Tad,
Here's your code (I modified the $dir variable):
#!/usr/bin/perl -w
use strict;
use File::Find;
my $dir = '.';
print "$_\n" foreach find_htm($dir);
sub find_htm {
my @htm;
find sub { push @htm, $File::Find::name if /\.htm$/ }, @_;
return @htm;
}
The error message it produces is:
Missing $ on loop variable at test1.pl line 6.
which is the "...foreach find_htm($dir);" line
I have not had an opportunity to test your code on my work PC, where I
have installed Active Perl 5_6_?. It seems like my (work) alter ego did
get with the times more than my home one :-).
When I get back to my office (10 days or so), I'll test it and let you
know.
BTW, how would you amend the above code to allow for filtering some
parent-level directories from search--i.e. out of say six folders in "."
I only really want to search through 2 or 3, disregarding the rest.
Regards,
Rafal
--
=================
Rafal S. Konopka
<rafalk@home.com>
=================
------------------------------
Date: Sat, 24 Nov 2001 01:06:09 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Traversing directories
Message-Id: <slrn9vtsk8.8o.garry@zfw.zvolve.net>
On Fri, 23 Nov 2001 23:53:54 GMT, Rafal Konopka <rafalk@home.com>
wrote:
> Tad McClellan wrote:
>>
>> I expect you meant error _message_?
>>
>> Care to share the error message text with us?
>>
> Here's your code (I modified the $dir variable):
>
> #!/usr/bin/perl -w
> use strict;
> use File::Find;
>
> my $dir = '.';
> print "$_\n" foreach find_htm($dir);
>
> sub find_htm {
> my @htm;
> find sub { push @htm, $File::Find::name if /\.htm$/ }, @_;
> return @htm;
> }
>
> The error message it produces is:
>
> Missing $ on loop variable at test1.pl line 6.
I suspect that you have a bug in your version of Perl. I cannot
reproduce your reported error with perl 5.6.1 (Solaris).
--
Garry Williams
------------------------------
Date: Fri, 23 Nov 2001 19:54:41 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Using CGI.pm to obtain a list of params
Message-Id: <Pine.LNX.4.30.0111231942580.13774-100000@lxplus023.cern.ch>
On Nov 23, William Alexander Segraves inscribed on the eternal scroll:
> > > Subjectively, I feel the code in the former is more efficient,
> > You evidently haven't been following this group for long! Your point
> > is frequently raised and discussed.
> little archived in clpm about my specific problem. A Google search confirms
> this.
But I wasn't talking at that point about solutions to your specific
problem, I was talking about the general issue of modules in relation
to "efficiency".
(Indeed, I _should_ have mentioned that I have no specific expertise
in dealing with Adobe forms content. But the CGI is the CGI - a
programming interface between a web server (HTTPD) and your
server-side program; the content doesn't _have_ to be (X)HTML.)
> I see the discourse is drifting away from the thread;
That's normal on usenet ;-)
best regards
--
I have been recently reading:
http://www.phundria.org/megasloth/boozo.html
------------------------------
Date: Fri, 23 Nov 2001 13:14:49 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Using CGI.pm to obtain a list of params
Message-Id: <9tm79u$3or$1@slb2.atl.mindspring.net>
"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:9tm4pu$47r$1@slb0.atl.mindspring.net...
> The reason I stated a subjective feeling is that in the areas you list,
> CGI.pm has taken a lot more effort to employ than plain old Perl code. You
> can probably tell us exactly when (which version) CGI.pm would have broken
a
> script for Acrobat form data processing. Thanks to the excellent books on
OTOH, maybe not books, but archived ng submittals and LS web pages on
CGI.pm, IIRC.
> the subject, I was able to discover that the -no_xhtml pragma fixed a
> problem I had with Perl v.5.6.1 and CGI.pm default headers.
Mea culpa! Never mind. V. 2.69 of CGI.pm, according to several posts
archived on Google groups, including one by Alan F. that I may have
overlooked because it was in German.
Bill Segraves
Auburn, AL
------------------------------
Date: Fri, 23 Nov 2001 13:47:01 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Using CGI.pm to obtain a list of params
Message-Id: <9tm985$lrv$1@slb6.atl.mindspring.net>
"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.LNX.4.30.0111231942580.13774-100000@lxplus023.cern.ch...
> But I wasn't talking at that point about solutions to your specific
> problem, I was talking about the general issue of modules in relation
> to "efficiency".
>
On my own Windows and Linux servers, I would agree that CGI.pm-based scripts
would be more efficient, even though I had to write my own FDF library to
produce the FDF-specific stuff that CGI.pm doesn't do.
> (Indeed, I _should_ have mentioned that I have no specific expertise
> in dealing with Adobe forms content.
Nor do I. In fact, I've scupulously avoided using the Adobe FDF toolkit
because I can do what I need to do with Acrobat forms data with Perl (and,
yes, CGI.pm), using only a few lines of code.
BTW, you'll note, if you submit a blank registration form from
http://segraves.tripod.com/index2.htm, the format of FDF is neither HTML nor
XHTML. You'll also see the headers and trailers of FDF that I snipped from
the examples I sent in my earlier posts.
Most of my user-support problems center around MSIE browsers ignoring the
Content-type: that it sent to them, and then trying to interpret the FDF as
something else. Netscape's browser, BTW, works fine, with no tricks required
to get around the MSIE-generated problems. But this is Off-Topic of the ng,
so I'll stop here.
Thanks again for your insights.
Bill Segraves
Auburn, AL
------------------------------
Date: Fri, 23 Nov 2001 18:12:17 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: variable scope
Message-Id: <NDAL7.108186$i61.3906865@news20.bellglobal.com>
"Joe Schaefer" <joe+usenet@sunstarsys.com> wrote in message
news:m3r8qq6otm.fsf@mumonkan.sunstarsys.com...
>
> I'd like to apologize for the boorish and inappropriate tone in
> my earlier post. Your honest answer here convinced me that I
> misunderstood your intentions, and I'm sincerely very sorry about
> how I responded to your post.
>
> I do hope that someone else here will actually give you good advice,
> and not more irrelevant oratory and posturing, about how to deal with
> this issue from a programmer's perspective. Personally I think you'd
> be better served by a source-code scanner that checks for multiple
> declarations of a variable within a common context, but I think it's
> a bad idea to add another special-case compiler warning to perl.
>
You really didn't need to apologize (as I've grown a thick skin from posting
to newsgroups), but I appreciate that you took the time to do so. I'm not at
the level where I can make any comment on whether adding such a warning is a
good or bad thing; I was just very surprised when none appeared (from what I
thought I knew about Perl). It was a fun discussion while it lasted, and
thanks to everyone else who took the time to respond (even if we didn't
necessarily see eye-to-eye!).
Matt
------------------------------
Date: Fri, 23 Nov 2001 23:43:44 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: Which ISPs support perl scripts?
Message-Id: <Xns9162BF96616D8echangnetstormnet@207.106.92.86>
tadmc@augustmail.com (Tad McClellan) wrote in
news:slrn9vq1fp.sk5.tadmc@tadmc26.august.net:
> Chris Clarke <mad-biker@couplands-well.freeserve.co.uk> wrote:
>
>>As an absolute perl beginner... how do I find an ISP which supports
>>perl scripts?
>
> I recommend that you don't try to learn both the application area
> (CGI) and the programming language at the same time.
>
> Learn Perl first. When you are comfortable with Perl, then move
> on to whatever application area you wish to apply Perl to.
I humbly disagree. It's almost impossible to learn a new programming
language without writing practice programs applying it to something,
and most books implicitly assume some sort of application body of
knowledge. It may be the basic mathematics of many traditional
programming textbooks (the quadratic formula, Euclidean algorithm,
Fibonacci numbers, ...) or business (mortgage payments, inventory, ...)
or Unix (illustrating split with a line from /etc/passwd, explaining
regexes by referring to grep, ...). Many learners find the assumed
application area as much of a stumbling block as the language, which in
one sense supports your statement, but part of the problem is that it
is assumed, not explained. (Though explaining the Euclidean algorithm
doesn't help with the student who barely passed high school grade
algebra and forgot what little he did know about it.)
If the learner already knows something about programming, I believe
that it is very possible to learn Perl in the context of CGI
programming as long as the CGI standards and constraints are clearly
laid out in the study materials or otherwise learned before plunging
into coding. One problem with many CGI tutorials (and some books) is
that they just show code examples without discussing the CGI interface
(and the HTTP protocol, especially its statelessness) in more than a
few sentences. (The O'Reilly CGI programming book by Gundavaram, et
alia, does a great job of explaining CGI programming, but it assumes
that the reader already knows the Perl language.)
Of course the beginner who knows a little HTML without understanding
HTTP, doesn't known how to program in any language, and wants an
instant shopping cart is a different matter. (I do not mean to suggest
that the OP is one of these.)
[snipped good advice about installing Perl and a server locally.]
--
EBC
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 2192
***************************************