[24174] in Perl-Users-Digest
Perl-Users Digest, Issue: 6366 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 5 18:06:08 2004
Date: Mon, 5 Apr 2004 15:05:08 -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 Mon, 5 Apr 2004 Volume: 10 Number: 6366
Today's topics:
[p.s.]: HTTP Header with mod_perl?? <rhersiczky@cuthere-hotmail.com>
Re: BigInt.pm acting dumb, or is it me? (Steve The Geek)
Re: Can PERL code check is email of sender is valid? <matternc@comcast.net>
Re: CGI::Carp and "useless quotes" <noreply@gunnar.cc>
comp.lang.perl.misc Archicves?? <jcanfield@tshmail.com>
Re: comp.lang.perl.misc Archicves?? <noreply@gunnar.cc>
Re: comp.lang.perl.misc Archicves?? <matternc@comcast.net>
Re: custom perl interpreter? (Peter J. Acklam)
Getting the "Last modified" folder value to change furt <D.r Pickle>
Re: Getting the "Last modified" folder value to change (Walter Roberson)
Re: Getting the "Last modified" folder value to change <ittyspam@yahoo.com>
Re: How read email headers? <nobull@mail.com>
Re: HTML Tag Counter (GreenLight)
Re: HTTP Header with mod_perl?? <tore@aursand.no>
Locale not working with Unicode strings in Perl 5.8? <john@newchester.com>
Re: Locale not working with Unicode strings in Perl 5.8 <scriptyrich@yahoo.co.uk>
Re: Re: Getting the "Last modified" folder value to cha <D.r Pickle>
Re: Re: Getting the "Last modified" folder value to cha (Walter Roberson)
Re: Re: Getting the "Last modified" folder value to cha <D.r Pickle>
Re: real, simple sample OOP intro text??!! <geoffacox@dontspamblueyonder.co.uk>
Re: real, simple sample OOP intro text??!! <tassilo.parseval@rwth-aachen.de>
Re: rename <xaonon@hotpop.com>
simple scratch variable parsing (Grant)
Re: simple scratch variable parsing <tadmc@augustmail.com>
subroutine only returns non zero sums <PerlGuRu2b@bobotheclown.org>
Re: subroutine only returns non zero sums <noreply@gunnar.cc>
Re: subroutine only returns non zero sums <xx087@freenet.carleton.ca>
Re: subroutine only returns non zero sums <nobull@mail.com>
Re: Unknown function <bik.mido@tiscalinet.it>
Re: Unknown function <krahnj@acm.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 5 Apr 2004 17:50:29 +0200
From: "retoh :\)" <rhersiczky@cuthere-hotmail.com>
Subject: [p.s.]: HTTP Header with mod_perl??
Message-Id: <40718045$0$715$5402220f@news.sunrise.ch>
[p.s.]
I'm using mod_perl 1_99_13 with Apache 2.0.x
------------------------------
Date: 5 Apr 2004 13:23:31 -0700
From: slkleine@hotmail.com (Steve The Geek)
Subject: Re: BigInt.pm acting dumb, or is it me?
Message-Id: <863f122c.0404051223.3f6a510d@posting.google.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<c3paib$853$2@mamenchi.zrz.TU-Berlin.DE>...
> Steve The Geek <slkleine@hotmail.com> wrote in comp.lang.perl.misc:
> > When compiling, Net::SNMP gets to BigInt.pm and hangs there, devouring
> Or are you loading Math::BigInt? If so, are you doing so before or after
> "use Net::SNMP"? Math::BigInt overloads arithmetic operations and
> calculations could significantly slow down after it is loaded.
> Show a minimal program that exhibits the behavior. From your description
> it isn't clear what it happening when.
Finally, I have an alswer: Math::BigFloat was bad (mis-made?).
Reinstalled, all is well.
Steve the (baffled) Geek
------------------------------
Date: Mon, 05 Apr 2004 12:22:23 -0400
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Can PERL code check is email of sender is valid?
Message-Id: <ccudnRQBre0iGuzdRVn-uw@comcast.com>
PHP2 wrote:
> Hello,
>
> Can PERL code check is email of sender is valid?
>
> If someone send email from example: wrongemail@hotmail.com PERL code must
> check: can wrongemail@hotmail.com receive email (without sending test
> email).. if wrongemail@hotmail.com can receive email code inform me about
> that..
>
> I need any possible ideas.. :-))
>
It is not possible to determine whether an arbitrary email address can
receive email. The only way you can get even an approximation is to
try sending it email, but even then the email server may lie to you.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Mon, 05 Apr 2004 18:12:45 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: CGI::Carp and "useless quotes"
Message-Id: <c4s0n5$2ll41c$1@ID-184292.news.uni-berlin.de>
As a result of this thread, I just reported this bug:
http://rt.cpan.org/NoAuth/Bug.html?id=5932
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 5 Apr 2004 11:52:24 -0500
From: "Jim Canfield" <jcanfield@tshmail.com>
Subject: comp.lang.perl.misc Archicves??
Message-Id: <10733marolcau0f@corp.supernews.com>
Is this group archived somewhere? The site mentioned on the perfaq appears
to be bad. I'm trying to find a post from a month ago.
Are archives of comp.lang.perl.misc available?
Yes, there are. ftp.cis.ufl.edu:/pub/perl/comp.lang.perl.*/monthly has an
almost complete collection dating back to 12/89 (missing 08/91 through
12/93). They are kept as one large file for each month.
------------------------------
Date: Mon, 05 Apr 2004 19:05:43 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: comp.lang.perl.misc Archicves??
Message-Id: <c4s3qg$2nekl4$2@ID-184292.news.uni-berlin.de>
Jim Canfield wrote:
> Is this group archived somewhere?
Yes. Google has the most well-known archive of Usenet groups.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 05 Apr 2004 14:51:06 -0400
From: Chris Mattern <matternc@comcast.net>
Subject: Re: comp.lang.perl.misc Archicves??
Message-Id: <ROOdnQgMPP8BN-zdRVn-ig@comcast.com>
Jim Canfield wrote:
> Is this group archived somewhere?
Like every other group in Usenet, it's archived in Google Groups.
> The site mentioned on the perfaq
> appears to be bad. I'm trying to find a post from a month ago.
Try Google.
>
> Are archives of comp.lang.perl.misc available?
> Yes, there are. ftp.cis.ufl.edu:/pub/perl/comp.lang.perl.*/monthly has an
> almost complete collection dating back to 12/89 (missing 08/91 through
> 12/93). They are kept as one large file for each month.
Yes, that does seem to have gone the way of the wind; I can find
no sign of /pub/perl on that server. Probably nobody has noticed
because everybody uses Google these days.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: 05 Apr 2004 18:53:33 +0200
From: pjacklam@online.no (Peter J. Acklam)
Subject: Re: custom perl interpreter?
Message-Id: <65ce4b8y.fsf@online.no>
Peter Hickman <peter@semantico.com> wrote:
> I think that the best you will get is
>
> #!/usr/bin/perl /opt/local/bin/script.pl -f
>
> and the rest of the file is the contents of specfile. At least
> thats the way I got it to work for me.
AFAIK, that only works on Solaris. Other Unices will complain
about not finding "/opt/local/bin/script.pl -f".
Peter
--
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((?:(?:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;
------------------------------
Date: Mon, 05 Apr 2004 15:23:27 GMT
From: <D.r Pickle>
Subject: Getting the "Last modified" folder value to change further up the hierarchy.
Message-Id: <8e8a9d866c1baa5efb14e34b10186294@unlimited.ultrafeed.com>
I need the date of folder modification to effect the folders more than one level up.
IE.
When a file is added to
/main/subdir1/subdir2/
I want the "Last modified" dates of /main/ and /subdir1/ to also be updated.
Is there any easy way to do this?
Or does anyone know of some perl code that could take a full length path string and touch each of the dirs in it?
I'm really stumped here.
----------------------------
Red Hat Linux 8.0
------------------------------
Date: 5 Apr 2004 16:13:01 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Getting the "Last modified" folder value to change further up the hierarchy.
Message-Id: <c4s0id$60t$1@canopus.cc.umanitoba.ca>
In article <8e8a9d866c1baa5efb14e34b10186294@unlimited.ultrafeed.com>,
<D.r Pickle> wrote:
:I need the date of folder modification to effect the folders more than one level up.
:IE.
:When a file is added to
:/main/subdir1/subdir2/
:I want the "Last modified" dates of /main/ and /subdir1/ to also be updated.
:Is there any easy way to do this?
That is not in accordance with the POSIX standards. That leaves you
with a series of choices:
1) Modify your kernel filesystem to be non-POSIX compliant (possibly
breaking many other things in the process)
2) Use a "file alteration monitor" facility to watch all areas of interest
and change the modification times as per your specifications;
3) Re-design your code so that you do not have that requirement, such
as by coding yourself up a "last_modified_recursive" function that will
dig down recursively for the information you require (watch out for
symbolic links!)
:Or does anyone know of some perl code that could take a full length path string and touch each of the dirs in it?
Not generally, no. You do realize that the directory '/' is part of
the path /main/subdir1/subdir2/ and thus you are asking for the change
time on / to be updated every time any file anywhere on the system is
modified? You probably don't own '/' though, so your code would have to
run as root.
What, by the way, do you expect to have happen in the case of symbolic
links? If /main/subdir3/foo is a symbolic link to /main/subdir1/subdir2/bar
then when 'bar' changes, should the modification time on 'subdir3'
change as well, seeing as there is a path through subdir3 that has
a modified file? Then there are symbolic links to directories...
--
*We* are now the times. -- Wim Wenders (WoD)
------------------------------
Date: Mon, 5 Apr 2004 12:16:32 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Getting the "Last modified" folder value to change further up the hierarchy.
Message-Id: <20040405121518.G5768@dishwasher.cs.rpi.edu>
On Mon, 5 Apr 2004, Walter Roberson wrote:
> In article <8e8a9d866c1baa5efb14e34b10186294@unlimited.ultrafeed.com>,
> <D.r Pickle> wrote:
> :I need the date of folder modification to effect the folders more than one level up.
>
> :IE.
>
> :When a file is added to
>
> :/main/subdir1/subdir2/
> :I want the "Last modified" dates of /main/ and /subdir1/ to also be updated.
>
> :Is there any easy way to do this?
>
> :Or does anyone know of some perl code that could take a full length path string and touch each of the dirs in it?
>
> Not generally, no. You do realize that the directory '/' is part of
> the path /main/subdir1/subdir2/ and thus you are asking for the change
> time on / to be updated every time any file anywhere on the system is
> modified? You probably don't own '/' though, so your code would have to
> run as root.
The fact that the OP refers to directories as "folders" rather strongly
suggests he's running some flavor of Windows, doesn't it?
Paul Lalli
------------------------------
Date: 05 Apr 2004 18:24:34 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: How read email headers?
Message-Id: <u98yha49t9.fsf@wcl-l.bham.ac.uk>
"PHP2" <gp@nospm.hr> writes:
> I wish read email headers... how do it with Perl?
Mail::Header
> I wish send email from server to someemail@xxx.com
> and if someemail@xxx.com is invalid after some time I'll receive
> 'nodelivery' message... how I can read 'nodelivery' email header?
You probably also want a module to read your mailbox.
There are modules in the usual place for reading various types of
mailbox (Unix, IMAP, POP3...)
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 5 Apr 2004 08:30:50 -0700
From: google@milbaugh.com (GreenLight)
Subject: Re: HTML Tag Counter
Message-Id: <c4b60ce1.0404050730.b7d80fe@posting.google.com>
Gisle Aas <gisle@activestate.com> wrote in message news:<m31xn2q235.fsf@eik.i-did-not-set--mail-host-address--so-shoot-me>...
>
> #!/usr/bin/perl -w
>
> use strict;
> use HTML::Parser;
>
> my %count;
> my $p = HTML::Parser->new(start_h => [sub { $count{$_[0]}++ }, "tagname"],
> end_h => [sub { $count{"/$_[0]"}++ }, "tagname"],
> );
> $p->parse_file(*STDIN);
>
> for (sort { $count{$b} <=> $count{$a} } keys %count) {
> printf "%5d %s\n", $count{$_}, $_;
> }
Here is a variation that print the list in alphabetical order, with
opening and closing tags (if applicable) listed together:
#!/usr/bin/perl -w
use strict;
use HTML::Parser;
my %count;
my $p = HTML::Parser->new(start_h => [sub { $count{$_[0]}++ },
"tagname"],
end_h => [sub { $count{"/$_[0]"}++ }, "tagname"],
);
$p->parse_file(<THIS IS WHERE YOU DECIDE WHAT FILE TO PARSE>);
for (sort keys %count) {
next if(/^\//);
printf "%5d %s\n", $count{$_}, $_;
my $slashed = "/" . $_;
if (defined($count{$slashed})) {
printf "%5d %s\n", $count{$slashed}, $slashed;
}
}
--
my real address is perl - at - milbaugh - dot - com
------------------------------
Date: Mon, 05 Apr 2004 19:42:58 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: HTTP Header with mod_perl??
Message-Id: <pan.2004.04.05.17.42.56.670410@aursand.no>
On Mon, 05 Apr 2004 16:52:58 +0200, retoh :) wrote:
> Howto send HTTP Header lines with mod_perl?
This is explained in the mod_perl documentation;
<http://perl.apache.org/docs/2.0/user/coding/coding.html#HTTP_Response_Headers>
--
Tore Aursand <tore@aursand.no>
"The pure and simple truth is rarely pure and never simple." -- Oscar
Wilde
------------------------------
Date: Mon, 5 Apr 2004 13:00:44 -0500
From: "John" <john@newchester.com>
Subject: Locale not working with Unicode strings in Perl 5.8?
Message-Id: <c4s6sj$t01$1@news.f.de.plusline.net>
After an upgrade from Perl 5.6 to perl 5.8, strings with character semantics
stopped sorting according to the locale settings. In the following script,
I sort a latin1-encoded string and a utf8-encoded string. The first sorts
correctly, the latter doesn't. In Perl 5.6, strings that had character
semantics sorted just fine as long as I used 'locale'.
I found a bug notice in perlunicode.html, under "Interaction with Locales",
dissuading the use of locales with Unicode in perl 5.8. So, if I want to
correctly sort a list of Spanish words encoded in UTF8, what do I do? Do I
have to convert back to latin1 every time I want to do a collating
operation?
Or does someone out there know of a better solution?
use locale;
use charnames ':full';
use Encode qw (from_to);
###Latin1-encoded literals.
my @data1 = split //, "eáú";
my @data2 = split //, "e\N{LATIN SMALL LETTER A WITH ACUTE}\N{LATIN SMALL
LETTER U WITH ACUTE}";
print "Data 1: ".join(', ', sort {$a cmp $b} @data1)."\n";
print "Data 2: ".join(', ', sort {$a cmp $b} @data2)."\n";
OUTPUT:
Data 1: á, e, ú
Data 2: á, ú, e
------------------------------
Date: Mon, 05 Apr 2004 20:31:23 +0100
From: Rich <scriptyrich@yahoo.co.uk>
Subject: Re: Locale not working with Unicode strings in Perl 5.8?
Message-Id: <c4sbkh$mvt$1@newsg4.svr.pol.co.uk>
John wrote:
> After an upgrade from Perl 5.6 to perl 5.8, strings with character
> semantics
> stopped sorting according to the locale settings. In the following
> script,
> I sort a latin1-encoded string and a utf8-encoded string. The first sorts
> correctly, the latter doesn't. In Perl 5.6, strings that had character
> semantics sorted just fine as long as I used 'locale'.
>
> I found a bug notice in perlunicode.html, under "Interaction with
> Locales",
> dissuading the use of locales with Unicode in perl 5.8. So, if I want to
> correctly sort a list of Spanish words encoded in UTF8, what do I do? Do
> I have to convert back to latin1 every time I want to do a collating
> operation?
>
> Or does someone out there know of a better solution?
Unicode::Collate will do the job, but it's heavyweight and some tailoring
will probably be required.
Sort::ArbBiLex is lighter and might be a better solution - again you'll
probably need to do a little spade work to get the correct sorting order.
I'm sure there are other solutions as well - if you don't get any joy
posting here, try perl.unicode.
Cheers
--
Rich
scriptyrich@yahoo.co.uk
------------------------------
Date: Mon, 05 Apr 2004 17:30:59 GMT
From: <D.r Pickle>
Subject: Re: Re: Getting the "Last modified" folder value to change further up the hierarchy.
Message-Id: <80069cc2bd36a7ca547386c90394d486@unlimited.ultrafeed.com>
The code is running as root and symlinks are irrelivant becasue there will not be any.
In reality I do not want to update "/"
I want to update "/home/BLOP/" when somthing in "/home/BLOP/main/subdir1/subdir2/" is modified.
Assuming I have the FULL path in $dirstring
I just dont know how to break the $dirstring down at each / so that I could write a
quick file touch for each of the dirs in the whole path.
This area is being used exclusivly to crunch large amounts of raw data.
Currently the way the script is written, if I had a piece of code that could touch
each of the directories in the string I could easliy incorperate it so the date
update would only occur once every time the script changes dirs to dump its data.
---X-Abuse-Trace: 706c61737469636c7364
---From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
---Newsgroups: comp.lang.perl.misc
---Subject: Re: Getting the "Last modified" folder value to change further up the hierarchy.
---Date: 5 Apr 2004 16:13:01 GMT
---Organization: National Research Council Canada - Conseil national de rechereches Canada
---Lines: 43
---Message-ID: <c4s0id$60t$1@canopus.cc.umanitoba.ca>
---References: <8e8a9d866c1baa5efb14e34b10186294@unlimited.ultrafeed.com>
---NNTP-Posting-Host: zeno.ibd.nrc-cnrc.gc.ca
---X-Trace: canopus.cc.umanitoba.ca 1081181581 6173 192.70.172.132 (5 Apr 2004 16:13:01 GMT)
---X-Complaints-To: abuse@cc.umanitoba.ca
---NNTP-Posting-Date: 5 Apr 2004 16:13:01 GMT
---Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
---Path: kermit!newsfeed-east.nntpserver.com!nntpserver.com!newshosting.com!nx02.iad01.newshosting.com!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!newsfeed2.telusplanet.net!newsfeed.telus.net!cyclone.bc.net!torn!canopus.cc.umanitoba.ca!not-for-mail
---Xref: kermit comp.lang.perl.misc:312543
---
---In article <8e8a9d866c1baa5efb14e34b10186294@unlimited.ultrafeed.com>,
--- <D.r Pickle> wrote:
---:I need the date of folder modification to effect the folders more than one level up.
---
---:IE.
---
---:When a file is added to
---
---:/main/subdir1/subdir2/
---:I want the "Last modified" dates of /main/ and /subdir1/ to also be updated.
---
---:Is there any easy way to do this?
---
---That is not in accordance with the POSIX standards. That leaves you
---with a series of choices:
---
---1) Modify your kernel filesystem to be non-POSIX compliant (possibly
---breaking many other things in the process)
---
---2) Use a "file alteration monitor" facility to watch all areas of interest
---and change the modification times as per your specifications;
---
---3) Re-design your code so that you do not have that requirement, such
---as by coding yourself up a "last_modified_recursive" function that will
---dig down recursively for the information you require (watch out for
---symbolic links!)
---
---
---:Or does anyone know of some perl code that could take a full length path string and touch each of the dirs in it?
---
---Not generally, no. You do realize that the directory '/' is part of
---the path /main/subdir1/subdir2/ and thus you are asking for the change
------time on / to be updated every time any file anywhere on the system is
---modified? You probably don't own '/' though, so your code would have to
---run as root.
---
---What, by the way, do you expect to have happen in the case of symbolic
---links? If /main/subdir3/foo is a symbolic link to /main/subdir1/subdir2/bar
---then when 'bar' changes, should the modification time on 'subdir3'
---change as well, seeing as there is a path through subdir3 that has
---a modified file? Then there are symbolic links to directories...
-----
--- *We* are now the times. -- Wim Wenders (WoD)
---
---
---**********End Of Post*************
------------------------------
Date: 5 Apr 2004 18:18:57 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Re: Getting the "Last modified" folder value to change further up the hierarchy.
Message-Id: <c4s7uh$fgj$1@canopus.cc.umanitoba.ca>
In article <80069cc2bd36a7ca547386c90394d486@unlimited.ultrafeed.com>,
<D.r Pickle> wrote:
:The code is running as root and symlinks are irrelivant becasue there will not be any.
There's won't be any symlinks today, but 157 days from now, someone
is going to come along and innocently symlink something, and you're
going to be called back from your vacation to fix the result...
:In reality I do not want to update "/"
:I want to update "/home/BLOP/" when somthing in "/home/BLOP/main/subdir1/subdir2/" is modified.
Why not just touch /home/BLOP/.we_got_an_update then? And leave the
directories alone?
:Assuming I have the FULL path in $dirstring
:I just dont know how to break the $dirstring down at each / so that I could write a
:quick file touch for each of the dirs in the whole path.
split, then repeat {pop, join} or repeat substr $dirstring, 0, rindex ...
:This area is being used exclusivly to crunch large amounts of raw data.
:Currently the way the script is written, if I had a piece of code that could touch
:each of the directories in the string I could easliy incorperate it so the date
:update would only occur once every time the script changes dirs to dump its data.
Somehow I have the suspicion that all you really need is to touch
the directory named .. and that the rest of your update logic will
result in the updates crawling their way upwards.
Or if you have a monitoring process that's supposed to notice the
changed time, why not just change that process to accept data on a
named pipe, and have the data-dumping process write the directory
name to the named pipe, so that the monitoring process knows -exactly-
where to look instead of having to monitor directory change times?
You're leaving chunks of information out, and I'm getting the impression
that it would be better to take some other approach than the one
you are asking about.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
------------------------------
Date: Mon, 05 Apr 2004 19:53:02 GMT
From: <D.r Pickle>
Subject: Re: Re: Getting the "Last modified" folder value to change further up the hierarchy.
Message-Id: <f34ea2e259a2884f814f743dde87600f@unlimited.ultrafeed.com>
Thanks for bearing with me... I forgot to mention this is my first perl script ever.
yes touching a .update file in each dir would work and thats what I want to do but
"split, then repeat {pop, join} or repeat substr $dirstring, 0, rindex ..."
..I dont understand that. I'm still learning and this is not any kind of production
level software. I'm just trying ot get my feet wet.
Can you tell me if this is correct?
-----------
my @dirarray = split(/\//, $dirstring);
while (pop @dirarray) {
my $touchy = join("\/", @dirarray);
touch "$touchy/.updated";
}
-----------
Do I need to have "MExtUtils::Command" in there to call touch?
This is serously like my 4th day of using perl so I'm sorry for
the dumb questions.
Thanks again for leading me twards the correct information.
---X-Abuse-Trace: 706c61737469636c7364
---From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
---Newsgroups: comp.lang.perl.misc
---Subject: Re: Re: Getting the "Last modified" folder value to change further up the hierarchy.
---Date: 5 Apr 2004 18:18:57 GMT
---Organization: National Research Council Canada - Conseil national de rechereches Canada
---Lines: 45
---Message-ID: <c4s7uh$fgj$1@canopus.cc.umanitoba.ca>
---References: <80069cc2bd36a7ca547386c90394d486@unlimited.ultrafeed.com>
---NNTP-Posting-Host: zeno.ibd.nrc-cnrc.gc.ca
---X-Trace: canopus.cc.umanitoba.ca 1081189137 15891 192.70.172.132 (5 Apr 2004 18:18:57 GMT)
---X-Complaints-To: abuse@cc.umanitoba.ca
---NNTP-Posting-Date: 5 Apr 2004 18:18:57 GMT
---Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
---Path: kermit!newsfeed-east.nntpserver.com!nntpserver.com!news-out.visi.com!petbe.visi.com!news.octanews.net!upp1.onvoy!msc1.onvoy!onvoy.com!snoopy.risq.qc.ca!torn!canopus.cc.umanitoba.ca!not-for-mail
---Xref: kermit comp.lang.perl.misc:312559
---
---In article <80069cc2bd36a7ca547386c90394d486@unlimited.ultrafeed.com>,
--- <D.r Pickle> wrote:
---:The code is running as root and symlinks are irrelivant becasue there will not be any.
---
---There's won't be any symlinks today, but 157 days from now, someone
---is going to come along and innocently symlink something, and you're
---going to be called back from your vacation to fix the result...
---
---
---:In reality I do not want to update "/"
---:I want to update "/home/BLOP/" when somthing in "/home/BLOP/main/subdir1/subdir2/" is modified.
---
---Why not just touch /home/BLOP/.we_got_an_update then? And leave the
---directories alone?
---
---
---:Assuming I have the FULL path in $dirstring
---
---:I just dont know how to break the $dirstring down at each / so that I could write a
---:quick file touch for each of the dirs in the whole path.
---
---split, then repeat {pop, join} or repeat substr $dirstring, 0, rindex ...
---
---
---:This area is being used exclusivly to crunch large amounts of raw data.
---:Currently the way the script is written, if I had a piece of code that could touch
---:each of the directories in the string I could easliy incorperate it so the date
---:update would only occur once every time the script changes dirs to dump its data.
---
---Somehow I have the suspicion that all you really need is to touch
---the directory named .. and that the rest of your update logic will
---result in the updates crawling their way upwards.
---
---Or if you have a monitoring process that's supposed to notice the
---changed time, why not just change that process to accept data on a
---named pipe, and have the data-dumping process write the directory
---name to the named pipe, so that the monitoring process knows -exactly-
---where to look instead of having to monitor directory change times?
---
---You're leaving chunks of information out, and I'm getting the impression
---that it would be better to take some other approach than the one
---you are asking about.
---
--- I was very young in those days, but I was also rather dim.
--- -- Christopher Priest
---
---
---**********End Of Post*************
------------------------------
Date: Mon, 05 Apr 2004 20:48:03 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: real, simple sample OOP intro text??!!
Message-Id: <bsk370lvi6aub56od8h0a3aqfs5kl3v89a@4ax.com>
On 4 Apr 2004 18:20:36 GMT, "Tassilo v. Parseval"
<tassilo.parseval@rwth-aachen.de> wrote:
Tassilo,
having got to the point of having an OOP script that works for 1 html
file, is it possible to work with a series of similar files using
File::Find ? I am trying this but getting errors which I correct
yet...
Cheers
Geoff
------------------------------
Date: 5 Apr 2004 21:06:02 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: real, simple sample OOP intro text??!!
Message-Id: <c4shnq$142$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Geoff Cox:
> On 4 Apr 2004 18:20:36 GMT, "Tassilo v. Parseval"
><tassilo.parseval@rwth-aachen.de> wrote:
>
> Tassilo,
>
> having got to the point of having an OOP script that works for 1 html
> file, is it possible to work with a series of similar files using
> File::Find ? I am trying this but getting errors which I correct
> yet...
Sure, why not? What you can do once, you can do twice (and more times)
as well. It's just a matter of calling '$parser->parse_file' for each
file you want to process.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 5 Apr 2004 20:58:10 GMT
From: Xaonon <xaonon@hotpop.com>
Subject: Re: rename
Message-Id: <slrnc73i28.cs1.xaonon@xaonon.local>
Ned i bach <vfkf3qln.fsf@online.no>, Peter J. Acklam <pjacklam@online.no>
teithant i thiw hin:
> Xaonon <xaonon@hotpop.com> wrote:
>
> > $ perl -e 'rename $_, lc $_ for @ARGV' *.jpg
> >
> > Add error code and checks for pre-existing files as appropriate.
>
> There is no point in checking for pre-existing files here, since
> if "MyPiCiNPaRiS.jpg" exists, then "mypicinparis.jpg" exists, but
> it is actually the same file.
At least until someone tries to use the same code on a system where "foo"
and "Foo" are distinct files. That's what "as appropriate" means.
--
Xaonon, EAC Chief of Mad Scientists and informal BAAWA, aa #1821, Kibo #: 1
http://xaonon.dyndns.org/ Guaranteed content-free since 1999. No refunds.
"How benevolent of you! We will always be free to be stupid." "Cherish
that freedom, young master; it is basic to all others." -- The Golden Age
------------------------------
Date: 5 Apr 2004 14:14:06 -0700
From: emailgrant123@yahoo.com (Grant)
Subject: simple scratch variable parsing
Message-Id: <1c9d8b45.0404051314.2cc926ac@posting.google.com>
Hello! I've got scratch variables like:
c1
sc1
sr1
The letters involved should either be "c", "sc", or "sr", and the
number(s) could be any. This is pulled from the URL, and I'd like to
make sure it's formed correctly, so I'd rather not just filter it for
letters and filter it for numbers. It seems like I'd need to check it
character by character? How can I do this? I'm a Perl newbie.
Thanks!
- Grant
------------------------------
Date: Mon, 5 Apr 2004 16:44:54 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: simple scratch variable parsing
Message-Id: <slrnc73kqm.q2m.tadmc@magna.augustmail.com>
Grant <emailgrant123@yahoo.com> wrote:
> Hello! I've got scratch variables like:
How is a "scratch variable" different from a "variable"?
> c1
> sc1
> sr1
Those are not variables. Variables in Perl have sigils.
Those are probably values rather than variables.
> The letters involved should either be "c", "sc", or "sr", and the
> number(s) could be any. This is pulled from the URL, and I'd like to
> make sure it's formed correctly, so I'd rather not just filter it for
> letters and filter it for numbers. It seems like I'd need to check it
> character by character? How can I do this?
if ( $scratch =~ /^(c|sc|sr)\d+$/ )
{ print "valid\n" }
else
{ print "not valid\n" }
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 05 Apr 2004 16:34:33 GMT
From: Rocky <PerlGuRu2b@bobotheclown.org>
Subject: subroutine only returns non zero sums
Message-Id: <pan.2004.04.05.16.33.20.859780@bobotheclown.org>
hi all,
this subroutine was written originally without the if/else statement for
$total. It returned any non-zero sum perfectly but whenever @number was
all zeros it came back blank(undefined?) What did I miss? It works now
but it soesn't seem to be the best way. Thank you.
Rocky
sub addnums {
my @number = @_;
my $total;
my $digit;
foreach $digit (@number)
{
$total += $digit;
}
if (defined($total))
{
$total = $total;
}
else
{$total = 0;}
return $total;
}
------------------------------
Date: Mon, 05 Apr 2004 19:04:30 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: subroutine only returns non zero sums
Message-Id: <c4s3o7$2nekl4$1@ID-184292.news.uni-berlin.de>
Rocky wrote:
> this subroutine was written originally without the if/else
> statement for $total. It returned any non-zero sum perfectly but
> whenever @number was all zeros it came back blank(undefined?) What
> did I miss?
Are you asking what you missed in some code you don't show?
> It works now but it soesn't seem to be the best way.
Well, it can be shortened:
sub addnums {
my $total = 0;
$total += $_ for @_;
$total
}
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 5 Apr 2004 17:02:11 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: subroutine only returns non zero sums
Message-Id: <slrnc7348k.bvm.xx087@smeagol.ncf.ca>
Rocky <PerlGuRu2b@bobotheclown.org> wrote:
> hi all,
> this subroutine was written originally without the if/else statement for
> $total. It returned any non-zero sum perfectly but whenever @number was
> all zeros it came back blank(undefined?) What did I miss? It works now
Initialize $total when you declare it:
sub addnums {
my $total = 0;
$total += $_ foreach @_;
return $total;
}
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
Date: 05 Apr 2004 18:14:26 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: subroutine only returns non zero sums
Message-Id: <u9d66m4aa5.fsf@wcl-l.bham.ac.uk>
Rocky <PerlGuRu2b@bobotheclown.org> writes:
> this subroutine was written originally without the if/else statement for
> $total. It returned any non-zero sum perfectly but whenever @number was
> all zeros it came back blank(undefined?) What did I miss?
Initialisation of $total to 0 before the loop.
> It works now but it soesn't seem to be the best way. Thank you.
> Rocky
>
> sub addnums {
> my @number = @_;
Why copy @_ ?
> my $total;
Here is where you should have initialised $total.
> my $digit;
> foreach $digit (@number)
Don't do that. Perl will see that $digit in the foreach is currently
in scope as a lexical and implicitly redeclare a new lexical $digit
scoped to the loop. The $digit in the outer lexical scope is never
used. You only want the one scoped to the lood. So say instead:
foreach my $digit (@number)
> {
> $total += $digit;
> }
> if (defined($total))
> {
> $total = $total;
> }
> else
> {$total = 0;}
> return $total;
> }
Oh and some indentation would be good.
sub addnums {
my $total = 0;
my $digit;
foreach my $digit (@_)
{
$total += $digit;
}
return $total;
}
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 05 Apr 2004 22:58:47 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Unknown function
Message-Id: <mvd370lbl9npc6105pl8ktk9n34e80e7d8@4ax.com>
On Mon, 05 Apr 2004 11:56:42 GMT, "Martin L." <mjpliv@eastlink.ca>
wrote:
>There is one function #### @files = ('logs/*.log'); ##### I am not
>familiar with and a look through PERLFUNC did not turn up anything.
I skipped the rest of your post but somehow I strongly suspect that
the above statement should really be
@files = <'logs/*.log'>;
^ ^
are you sure you didn't mistook them for parens?
Michele
--
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
"perl bug File::Basename and Perl's nature"
------------------------------
Date: Mon, 05 Apr 2004 21:50:35 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Unknown function
Message-Id: <4071D4A4.E89E8A91@acm.org>
Michele Dondi wrote:
>
> On Mon, 05 Apr 2004 11:56:42 GMT, "Martin L." <mjpliv@eastlink.ca>
> wrote:
>
> >There is one function #### @files = ('logs/*.log'); ##### I am not
> >familiar with and a look through PERLFUNC did not turn up anything.
>
> I skipped the rest of your post but somehow I strongly suspect that
> the above statement should really be
>
> @files = <'logs/*.log'>;
> ^ ^
>
> are you sure you didn't mistook them for parens?
You do realize that the single quotes will be included as part of the
path/file name meaning that you are looking for the directory "'logs"
with files ending in ".log'"?
John
--
use Perl;
program
fulfillment
------------------------------
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 6366
***************************************