[24710] in Perl-Users-Digest
Perl-Users Digest, Issue: 6867 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 15 09:06:43 2004
Date: Sun, 15 Aug 2004 06:05:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 15 Aug 2004 Volume: 10 Number: 6867
Today's topics:
ActiveState PPM/PPM3 just hang up for me (Graham)
Re: ActiveState PPM/PPM3 just hang up for me <sbryce@scottbryce.com>
Re: Counting text area <andrewpalmer@email.com>
Re: favorite perl IDE <cwilbur@mithril.chromatico.net>
File::Find in FreeBSD msdosfs mounts (Senandung Mendonan)
Re: Good way to un-chomp an array <abigail@abigail.nl>
Re: noob question: use File::Copy; <tadmc@augustmail.com>
Untaint file name <wfsp@yahoo.com>
Re: Untaint file name <noreply@gunnar.cc>
Re: Untaint file name <gnari@simnet.is>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 14 Aug 2004 20:17:20 GMT
From: graham@nospam.steelworks.org.uk (Graham)
Subject: ActiveState PPM/PPM3 just hang up for me
Message-Id: <411d23ec.4797987@news.freenetname.co.uk>
I am running Perl 5.8.0 on Windows ME. If I run PPM or PPM3, I can
query my installed modules, but if I try to access the repositories on
the Internet (eg, typing "search *", it just hangs up. Anybody else
had this problem? Anybody know the answer?
Graham
--
Graham Steel: graham@nospam.steelworks.org.uk
Web: http://www.steelworks.org.uk
------------------------------
Date: Sat, 14 Aug 2004 14:37:16 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: ActiveState PPM/PPM3 just hang up for me
Message-Id: <10hstvphudats9e@corp.supernews.com>
Graham wrote:
> I am running Perl 5.8.0 on Windows ME. If I run PPM or PPM3, I can
> query my installed modules, but if I try to access the repositories on
> the Internet (eg, typing "search *", it just hangs up. Anybody else
> had this problem? Anybody know the answer?
I had a similar problem when I installed Perl 5.8 on top of Perl 5.6.
The solution was to uninstall Perl, then reinstall Perl 5.8.
------------------------------
Date: Sat, 14 Aug 2004 13:56:56 -0500
From: "Andrew Palmer" <andrewpalmer@email.com>
Subject: Re: Counting text area
Message-Id: <6dtTc.15502$5s3.11671@fe40.usenetserver.com>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:2o4vc2F7172nU1@uni-berlin.de...
> Andrew Palmer wrote:
> > Gunnar Hjalmarsson wrote:
> >> Joe Smith wrote:
> >>> Gunnar Hjalmarsson wrote:
> >>>>
> >>>> my $count = 0;
> >>>> $count ++ for split /\n/, $in{packageID};
> >>>
> >>> my $count = () = split /\n/,$in{packageID};
> >>
> >> my %in = ( packageID => "one\ntwo\nthree" );
> >>
> >> my $count = () = split /\n/, $in{packageID};
> >> print "$count\n";
> >>
> >> $count = 0;
> >> $count ++ for split /\n/, $in{packageID};
> >> print "$count\n";
> >
> > my $count = split /\n/, $in{packageID};
> > print "$count\n";
> >
> >> Outputs:
> >> 1
> >> 3
> >
> > 3
>
> Hey, did you read the docs or something?
I wish I could claim such a high virtue, but obviously not!
From the second paragraph: "Use of split in scalar context is deprecated"
>
> Thanks! ;-)
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 14 Aug 2004 19:00:26 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: favorite perl IDE
Message-Id: <87brhda74l.fsf@mithril.chromatico.net>
>>>>> "TMcC" == Tad McClellan <tadmc@augustmail.com> writes:
TMcC> dragonbide <allen.jordan@colorado.edu> wrote:
>> I'm looking for a good perl IDE.
TMcC> Linux or BSD.
Bah. Emacs is a better operating system than either of those!
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: 14 Aug 2004 20:37:38 -0700
From: mendonan@gmail.com (Senandung Mendonan)
Subject: File::Find in FreeBSD msdosfs mounts
Message-Id: <94c7120b.0408141937.37f3dc87@posting.google.com>
Dear group,
I wrote this perl snippet below on FreeBSD-5.2.1, which I find works
in normal UFS -type filesystems, but doesn't work in msdosfs mounts
(File::Find's find() doesn't traverse into directories). The -f test
inside wanted() also fails. Is this just me, or is this an issue with
FreeBSD?
#!/usr/bin/perl -w
use strict;
use Digest::MD5;
use File::Find;
use Data::Dumper;
my %md5sums = ();
foreach my $dir (@ARGV) {
# Somehow find() does not work in FAT partitions!
find { no_chdir => 1,
wanted => sub {
return unless -f;
# Get relative file name as key
my $file = $_;
$file =~ s/$dir(\/|)*//g;
open my $fh, $_ or
warn "Can't open `$_': $!\n" and return;
$md5sums{$file} =
Digest::MD5->new->addfile($fh)->hexdigest, ' ', $_;
}
}, $dir;
}
print Dumper \%md5sums;
btw, my msdosfs mount in /etc/fstab is as follows:-
/dev/ad0s6 /d msdosfs rw 0
0
Appreciate any pointers. Meanwhile I'll just use find shell command.
Thanks.
--mendonan
------------------------------
Date: 14 Aug 2004 19:29:42 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Good way to un-chomp an array
Message-Id: <slrnchsq15.ohj.abigail@alexandra.abigail.nl>
Douglas Hunter (dug@plusthree.com) wrote on September MCMXCIII in
<URL:news:slrnchqgvp.6lo.dug@plusthree.com>:
)) On 2004-08-13, Tad McClellan <tadmc@augustmail.com> wrote:
)) >
)) > If we want unchomp(), then we'd better:
)) >
)) > $_ .= $/ foreach @lines;
)) >
)) > so it will work even when the input record separator is not the default.
)) >
))
)) On my perl (5.8.3) this solution works when $/ is undef, but appends
)) reference address when $/ is in fixed-length record mode.
))
)) ref $/ eq 'SCALAR' and undef $/;
)) $_ .= $/ foreach @lines;
))
)) seems to handle both situations.
Of course, it can never really 'unchomp'. Consider:
$/ = "\n";
$var1 = "foo";
$var2 = "foo\n";
chomp ($var1);
chomp ($var2);
Now $var1 and $var2 have identical values.
And there's the case of $/ being an empty string.
Abigail
--
print v74.117.115.116.32.97.110.111.116.104.101.114.
v32.80.101.114.108.32.72.97.99.107.101.114.10;
------------------------------
Date: Sat, 14 Aug 2004 16:52:56 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: noob question: use File::Copy;
Message-Id: <slrncht2do.mb0.tadmc@magna.augustmail.com>
Jeff Thies <jeff@spamalanadingong.com> wrote:
><snip>
>
>> Perldoc 1, Tad 0
>>
>> ( See? The docs are better than "some guy" on Usenet. If you can find
>> an answer in the docs, that would be better than posting.
>> )
>
> Well at least you know I was paying attention!
>
> I've just been reading -f utime
>
> Which doesn't give you any indication of what either the first or second
> arg are!
The first two elements of the list must be the
NUMERICAL access and modification times, in that order.
So the 1st arg is the Access time and the 2nd is the Modification time.
> I like perldoc but it can leave you grasping for what others
> may assume is obvious.
Managing the file system is not the job of a programming language,
it is the job of the Operating System.
So it is the OS that will determine what values those times may take,
Perl just gives you access to whatever they are.
On *nix it is "epoch time", the number of seconds since midnight
January 1, 1970 GMT.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 15 Aug 2004 10:42:27 +0000 (UTC)
From: John S <wfsp@yahoo.com>
Subject: Untaint file name
Message-Id: <Xns9546772434C35johnsharpenospambtin@217.32.252.50>
Hi,
In an earlier post the following was suggested by Gunnar:
if ( $PATH =~ /^([-\/\w])$/ ) {...
Would adding an underscore introduce any risks? Also, the % character (if
there was a space e.g. '%20')?
Thanks in advance.
wfsp
------------------------------
Date: Sun, 15 Aug 2004 13:28:31 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Untaint file name
Message-Id: <2o9014F7ts4sU1@uni-berlin.de>
John S wrote:
> In an earlier post the following was suggested by Gunnar:
>
> if ( $PATH =~ /^([-\/\w])$/ ) {...
Hopefully it wasn't, since it would require that $PATH contains only
one character...
> Would adding an underscore introduce any risks?
Doing so would not make a difference at all, since the underscore is
included in the \w character class.
> Also, the % character (if there was a space e.g. '%20')?
Paths do not get URI encoded, so adding % for that reason appears to
be pointless.
I suppose you are on Windows, since you worry about possible spaces,
and that we are talking about the full path to a file. In that case
there are a couple of other things to consider. Something like this
should - typically - work on both *nix and Windows:
if ( $PATH =~ /^([-\w\/\\.: ]+)$/ ) {...
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 15 Aug 2004 11:28:29 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Untaint file name
Message-Id: <cfnh8v$873$1@news.simnet.is>
"John S" <wfsp@yahoo.com> wrote in message
news:Xns9546772434C35johnsharpenospambtin@217.32.252.50...
> Hi,
> In an earlier post the following was suggested by Gunnar:
>
> if ( $PATH =~ /^([-\/\w])$/ ) {...
>
> Would adding an underscore introduce any risks? Also, the % character (if
> there was a space e.g. '%20')?
it all depends on what you are going to do with it.
in the context of a filepath, underscores are harmless,
but I do not see how the %20 comes into it. are you
going to use the path in a querysting ?
if the context is a file name, spaces can be ok if you take
care not to use it unquoted in system calls, where a space
might change the meaning. for example if you have a file
name $file="foo bar" , then this might not be what you wanted:
system("rm temp/$file"); # rm temp/foo bar (deletes ./bar)
but this might be:
system("rm 'temp/$file'");
the idea behind the untaint, is that you are declaring
that you are dealing a certain type of input.
gnari
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6867
***************************************