[29671] in Perl-Users-Digest
Perl-Users Digest, Issue: 915 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 8 03:09:38 2007
Date: Mon, 8 Oct 2007 00:09:05 -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, 8 Oct 2007 Volume: 11 Number: 915
Today's topics:
Re: FAQ 5.5 How can I copy a file? <ben@morrow.me.uk>
Re: FAQ 5.5 How can I copy a file? <kevin@vaildc.net>
Re: Getting file size before closing the file <ldolan@thinkinghatbigpond.net.au>
Re: Getting file size before closing the file <ldolan@thinkinghatbigpond.net.au>
new CPAN modules on Mon Oct 8 2007 (Randal Schwartz)
Re: Open a file from PERL / ASP ? <ben@morrow.me.uk>
Re: passing $fd as a reference <ben@morrow.me.uk>
Re: perl join on a non printable variable character ? <paduille.4061.mumia.w+nospam@earthlink.net>
reconnect to database was: SIG{'PIPE'} <stoupa@practisoft.cz>
Re: Script not able to work on Server 2003 <tadmc@seesig.invalid>
Re: Script not able to work on Server 2003 <jruffino@gailborden.info>
Re: Script not able to work on Server 2003 <veatchla@yahoo.com>
Re: Script not able to work on Server 2003 <rkb@i.frys.com>
Should an empty regex match everything <tony@skelding.co.uk>
Re: Should an empty regex match everything <peter@makholm.net>
Re: The Modernization of Emacs: terminology buffer and <dkixk@earthlink.net>
Re: The Modernization of Emacs: terminology buffer and bbound@gmail.com
Re: The Modernization of Emacs: terminology buffer and <lew@lewscanon.com>
Re: Threads in perl for Solaris <ben@morrow.me.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 7 Oct 2007 22:04:13 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 5.5 How can I copy a file?
Message-Id: <d7unt4-83d.ln1@osiris.mauzo.dyndns.org>
Quoth brian d foy <brian.d.foy@gmail.com>:
> In article <fe6fvn.j0.1@news.isolution.nl>, Dr.Ruud
> <rvtol+news@isolution.nl> wrote:
>
> > PerlFAQ Server schreef:
> >
> > > use File::Copy;
> >
> > But not before reading some of
> > http://www.google.co.uk/search?q=file.copy+abigail
> >
> > http://perl.abigail.be/Talks/FC/HTML/
>
>
> Indeed, although I think we should fix File::Copy so it doesn't have
> those problems. I'm not sure why nobody hasn't.
Because it's Hard. The most important advantage to using cp(1), AFAICS,
is that it knows about attributes files have that are particular to your
OS; writing a Perl module to locate and copy all of these is not an easy
task.
Ben
------------------------------
Date: Mon, 08 Oct 2007 02:43:03 GMT
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: FAQ 5.5 How can I copy a file?
Message-Id: <kevin-C54F69.22425707102007@news.verizon.net>
In article <d7unt4-83d.ln1@osiris.mauzo.dyndns.org>,
Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth brian d foy <brian.d.foy@gmail.com>:
> > In article <fe6fvn.j0.1@news.isolution.nl>, Dr.Ruud
> > <rvtol+news@isolution.nl> wrote:
> >
> > > PerlFAQ Server schreef:
> > >
> > > > use File::Copy;
> > >
> > > But not before reading some of
> > > http://www.google.co.uk/search?q=file.copy+abigail
> > >
> > > http://perl.abigail.be/Talks/FC/HTML/
> >
> >
> > Indeed, although I think we should fix File::Copy so it doesn't have
> > those problems. I'm not sure why nobody hasn't.
>
> Because it's Hard. The most important advantage to using cp(1), AFAICS,
> is that it knows about attributes files have that are particular to your
> OS; writing a Perl module to locate and copy all of these is not an easy
> task.
So maybe File::Copy should use 'cp' behind the scenes on Unix?
--
Kevin Michael Vail | a billion stars go spinning through the night,
kevin@vaildc.net | blazing high above your head.
. . . . . . . . . | But _in_ you is the presence that
. . . . . . . . | will be, when all the stars are dead.
. . . . . . . . . | (Rainer Maria Rilke)
------------------------------
Date: Sun, 07 Oct 2007 20:18:19 GMT
From: "Peter Jamieson" <ldolan@thinkinghatbigpond.net.au>
Subject: Re: Getting file size before closing the file
Message-Id: <fabOi.6734$H22.2341@news-server.bigpond.net.au>
"Josef Moellers" <5502109103600001@t-online.de> wrote in message
news:feak2v$984$03$1@news.t-online.com...
> Peter Jamieson wrote:
>> G'day all,
>> I receive numerous web files that I archive:
>> #..........code snippet
>> # .........$count increments, $tmp contains the data
>>
>> my $name_of _file = $expenses."_".$count ;
>> print "name_of _file: ",$name_of _file,"\n";
>> # save as txt
>> open(FH, ">$name_of _file.txt");
>> print FH $tmp;
>> close(FH);
>>
>> After saving, I can find the size of a file by:
>> my $filesize = -s "$name_of _file.txt";
>>
>> Can I determine the file size before closing it?
>
> "-s" takes either a filename or a filehandle. However, you must flush the
> output to the file before applying -s to the filehandle:
>
> use warnings;
> use strict;
> open my $dst, '>', 'PerlTestFile';
> select((select($dst), $| = 1)[0]); # <<<<<<<<<<<<<<<<<
> print $dst "Hello, my dear\n";
> my $size = -s $dst;
> print "Destination file is $size\n";
>
> If you leave out the "select" call, then this will show a size of 0, if
> you leave the "select" call in, the size will show as 15.
>
>> This would be useful because some files contain
>> no useful data and there is no point retaining them
>> so for example if file size is <21000 probably no data present
>> so don't keep, just move to next file.
>>
>> Or can I only determine the file size after it has been closed and
>> is in a directory?
>
> That introduces a race condition.
>
> Josef
Thanks Josef! Your comments are very helpful
esp. re flushing the output. Your point re a "race"
is also noted.....thanks again for your help.
I have printed out your comments for study....cheers, Peter
------------------------------
Date: Sun, 07 Oct 2007 20:18:20 GMT
From: "Peter Jamieson" <ldolan@thinkinghatbigpond.net.au>
Subject: Re: Getting file size before closing the file
Message-Id: <gabOi.6735$H22.1956@news-server.bigpond.net.au>
"Brian McCauley" <nobull67@gmail.com> wrote in message
news:1191779198.088102.312090@r29g2000hsg.googlegroups.com...
> On Oct 7, 1:39 pm, Josef Moellers <5502109103600...@t-online.de>
> wrote:
>
>> select((select($dst), $| = 1)[0]); # <<<<<<<<<<<<<<<<<
>> print $dst "Hello, my dear\n";
>> my $size = -s $dst;
>> print "Destination file is $size\n";
>
> If there's more than on print it would reduce the inefficiency to
> flush the handle _after_ all the prints().
>
> Although the above works it's more idiomatic to say:
>
> use IO::Handle;
> $dst->flush;
> my $size = -s $dst;
>
> Or, since we know the cursor will be at a the end we can do away with
> the flush and simply:
>
> my $size = tell $dst;
>
Thanks Brian! Very helpful info esp.
your mention of the IO::Handle module
which I will look at asap. I had searched
the Perl faq's and elsewhere but found only
references to getting file size after the file
was in a directory.
Your suggestions and code sample much appreciated!
Cheers, Peter
------------------------------
Date: Mon, 8 Oct 2007 04:42:14 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Oct 8 2007
Message-Id: <JpKt2E.1I08@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Algorithm-CheckDigits-0.45
http://search.cpan.org/~mamawe/Algorithm-CheckDigits-0.45/
Perl extension to generate and test check digits
----
Apache-SimpleTemplate-0.06
http://search.cpan.org/~forty/Apache-SimpleTemplate-0.06/
----
Apache-SimpleTemplate-0.06b
http://search.cpan.org/~forty/Apache-SimpleTemplate-0.06b/
----
Atompub-0.2.2
http://search.cpan.org/~takeru/Atompub-0.2.2/
Atom Publishing Protocol implementation
----
B-Deobfuscate-0.20
http://search.cpan.org/~jjore/B-Deobfuscate-0.20/
Deobfuscate source code
----
BSD-Process-0.04
http://search.cpan.org/~dland/BSD-Process-0.04/
Information about running processes on BSD platforms
----
Bot-Net-0.0.1
http://search.cpan.org/~hanenkamp/Bot-Net-0.0.1/
run your very own IRC bot net
----
CGI-Application-PhotoGallery-0.07
http://search.cpan.org/~bricas/CGI-Application-PhotoGallery-0.07/
module to provide a simple photo gallery
----
Cache-Memcached-Managed-0.18
http://search.cpan.org/~elizabeth/Cache-Memcached-Managed-0.18/
provide API for managing cached information
----
Cache-Memcached-Managed-0.19
http://search.cpan.org/~elizabeth/Cache-Memcached-Managed-0.19/
provide API for managing cached information
----
Catalyst-Manual-5.701003
http://search.cpan.org/~jrockway/Catalyst-Manual-5.701003/
The Catalyst developer's manual
----
Catalyst-Model-Adaptor-0.01
http://search.cpan.org/~jrockway/Catalyst-Model-Adaptor-0.01/
use a plain class as a Catalyst model
----
Class-Modular-0.05
http://search.cpan.org/~don/Class-Modular-0.05/
Modular class generation superclass
----
DBICx-TestDatabase-0.01
http://search.cpan.org/~jrockway/DBICx-TestDatabase-0.01/
create a temporary database from a DBIx::Class::Schema
----
Data-Visitor-0.09
http://search.cpan.org/~nuffin/Data-Visitor-0.09/
Visitor style traversal of Perl data structures
----
Devel-file-0.01
http://search.cpan.org/~bowmanbs/Devel-file-0.01/
show source lines around errors and warnings
----
GD-3DBarGrapher-0.9.3
http://search.cpan.org/~swarhurst/GD-3DBarGrapher-0.9.3/
Create 3D bar graphs using GD
----
Geo-ECEF-0.09
http://search.cpan.org/~mrdvt/Geo-ECEF-0.09/
Converts between ECEF (earth centered earth fixed) coordinates and latitude, longitude and height above ellipsoid.
----
Geo-ECEF-0.10
http://search.cpan.org/~mrdvt/Geo-ECEF-0.10/
Converts between ECEF (earth centered earth fixed) coordinates and latitude, longitude and height above ellipsoid.
----
Geo-Functions-0.07
http://search.cpan.org/~mrdvt/Geo-Functions-0.07/
Package for standard Geo:: functions.
----
Goo-Canvas-0.03
http://search.cpan.org/~yewenbin/Goo-Canvas-0.03/
Perl interface to the GooCanvas
----
Goo-Canvas-0.04
http://search.cpan.org/~yewenbin/Goo-Canvas-0.04/
Perl interface to the GooCanvas
----
IPC-Messaging-0.01_05
http://search.cpan.org/~gruber/IPC-Messaging-0.01_05/
process handling and message passing, Erlang style
----
Math-Counting-0.0704
http://search.cpan.org/~gene/Math-Counting-0.0704/
Combinatorial counting operations
----
POE-Declarative-0.005
http://search.cpan.org/~hanenkamp/POE-Declarative-0.005/
write POE applications without the mess
----
Quota-1.5.2
http://search.cpan.org/~tomzo/Quota-1.5.2/
Perl interface to file system quotas
----
RPC-Async-1.02
http://search.cpan.org/~tlbdk/RPC-Async-1.02/
Asynchronous RPC framework
----
Remind-Parser-0.04
http://search.cpan.org/~nkuitse/Remind-Parser-0.04/
parse `remind -lp' output
----
SNMP-Effective-0.04
http://search.cpan.org/~eidolon/SNMP-Effective-0.04/
An effective SNMP-information-gathering module
----
SNMP-Effective-1.04
http://search.cpan.org/~eidolon/SNMP-Effective-1.04/
An effective SNMP-information-gathering module
----
SOAP-WSDL-2.00_18
http://search.cpan.org/~mkutter/SOAP-WSDL-2.00_18/
SOAP with WSDL support
----
Set-Object-1.22
http://search.cpan.org/~samv/Set-Object-1.22/
set of objects and strings
----
Sprocket-0.07
http://search.cpan.org/~xantus/Sprocket-0.07/
A pluggable POE based Client / Server Library
----
Sys-Statistics-Linux-0.19
http://search.cpan.org/~bloonix/Sys-Statistics-Linux-0.19/
Front-end module to collect system statistics
----
Tk-GraphItems-0.07
http://search.cpan.org/~lamprecht/Tk-GraphItems-0.07/
Display relation-graphs on a Tk::Canvas
----
Tk-Wizard-2.116
http://search.cpan.org/~mthurn/Tk-Wizard-2.116/
GUI for step-by-step interactive logical process
----
UWO-Directory-Student-0.01
http://search.cpan.org/~frequency/UWO-Directory-Student-0.01/
Perform lookups using the University of Western Ontario's student directory
----
WWW-WorldLingo-0.01
http://search.cpan.org/~ashley/WWW-WorldLingo-0.01/
tie into WorldLingo's subscription based translation service.
----
ack-1.67_02
http://search.cpan.org/~petdance/ack-1.67_02/
grep-like text finder
----
relative-0.02
http://search.cpan.org/~saper/relative-0.02/
Load modules with relative names
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sun, 7 Oct 2007 22:12:35 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Open a file from PERL / ASP ?
Message-Id: <3nunt4-83d.ln1@osiris.mauzo.dyndns.org>
Quoth Jack <jack_posemsky@yahoo.com>:
> Hi I use this all the time with .pl programs and it works great but
> as soon as I put in ASP it blows up b/c it cant find the file ;
> however same code works as tested in a .pl and the file DOES exist !
> Any code that works for within an ASP file would be appreciated !
> <%@Language="PerlScript"
>
> if ($var ne '') {
> $filename1 = 'e:\temp2\searchlog.txt';
> open(OUTFILE,">>$filename1")|| die 'ERROR : external table not
Use three-arg open and lexical FHs.
open(my $OUTFILE, '>>', $filename1) || die '...';
Use interpolation rather than the . operator.
... || die "ERROR : external table not found :$filename1\n";
> found :'.$filename1."\n";
Since this message is for debugging, leave off the "\n". Then perl will
tell you where the error came from.
Include $! in your error message, then you'll know why the file couldn't
be opened. I suspect you've got a permission problem (that is, the error
is 'Access denied' rather than 'File not found').
Ben
------------------------------
Date: Sun, 7 Oct 2007 22:06:48 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: passing $fd as a reference
Message-Id: <8cunt4-83d.ln1@osiris.mauzo.dyndns.org>
Quoth Jim Gibson <jgibson@mail.arc.nasa.gov>:
> In article <dontmewithme-AF2DFA.21063105102007@news.tin.it>, Larry
> <dontmewithme@got.it> wrote:
>
> > Hi everybody,
> >
> > below is a few lines from http::daemon pod:
> >
> > --
> > $c->send_file( $filename )
> > $c->send_file( $fd )
> >
> > Copy the file to the client. The file can be a string (which will be
> > interpreted as a filename) or a reference to an IO::Handle or glob.
> > --
> >
> > I have to admit I have never read file contents by IO::Handle
> >
> > I usually go about it by:
> >
> > my $song = 'song.mp3';
> > open my $fh1, '<', $song or die "open(): $!\n";
> > binmode $fh1;
> > close($fh1);
> >
> > how can I tie the code above to $c->send_file( $fd ) ???
>
> Use IO::File (untested):
>
> my $fh1 = new IO::File $song;
IO::File is obsolete. Lexical filehandles are globrefs, and as such can
be passed directly to HTTP::Daemon->send_file.
> > btw, when reading a binary file in order to move cursor position, do you
> > think I should use "seek" or "sysseek" and the should I use read the
> > file by "read" or "sysread" ??
>
> Use sysseek if you are using sysread to read the file, seek otherwise.
IMHO sys* are obsolete as well; I would use
binmode $FH, ':unix';
and then use the ordinary functions. But that's just a point of view :).
Ben
------------------------------
Date: Sun, 07 Oct 2007 16:00:31 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: perl join on a non printable variable character ?
Message-Id: <13giifvavldbf06@corp.supernews.com>
On 10/07/2007 12:31 PM, Brian McCauley wrote:
> [...]
> The solution I posted (Sat, 06 Oct 2007 17:46:15 -0000) covers all
> possibilities but I'm not 100% convinced that my escaping of ["$@]
> characters would be sufficient to prevent a determined attacker from
> exploiting the eval.
>
Okay, now I see it. I somehow missed that message before.
I'm tempted to add this alternative:
die "bad delimiter = '$delimiter'" unless
($delimiter =~ /\A(\\\d+|0x\d+|\d+|\\X{\d+})\z/);
$delimiter = eval qq{"$delimiter"};
However, Jack can probably adjust his requirements to not require the eval:
perl e:\add_uniquekeyfield.pl e:\tmp\file1.txt e:\tmp\file2.txt 034
Then all he needs is this:
my ($filename1, $filename2, $delimiter) = @ARGV;
$delimiter = chr oct $delimiter;
__ONLY_PARTIALLY_TESTED__
------------------------------
Date: Sun, 7 Oct 2007 23:43:33 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: reconnect to database was: SIG{'PIPE'}
Message-Id: <febkd1$1n9f$1@ns.felk.cvut.cz>
As I mentioned earlier on some crazy hosting server my script is terminated
by SIG{PIPE}. Thanks for all who help me to find the reason, but now I need
to resolve found reason.
On the hosting a MySQL server is running but is limited to keep connection
max to 10 seconds. Idea of my script is this:
1) connect to database server ($dbh is "our" variable)
2) define sql commands e.g.:
our $findit=$dbh->prepare("select max(myid) from table";
our $storeit=$dbh->prepare("insert into table set myid=?, text=?");
3) download some web page using LWP module
4) parse data
5) store data to tables e.g.
$storeit->execute($myid,$sometext);
Points 3 and 4 can take more then 10 seconds and in this case MySQL server
disconnect me and at point 5 I will be killed by SIGPIPE. So I thinked up a
routine to connect to MySQL server again if needed, but this not work and I
still get SIGPIPE.
I define
our $testdb=$dbh->prepare("select 1");
and sub recon()
sub recon
{
my $ok=1;
$testdb->execute() or $ok=0;
unless($ok)
{
$dbh=DBI->connect("DBI:mysql:$db:$dbhost",$dbuser,$dbpassword);
}
}
Have somebody some idea how to resolve it? I not need to do something like
this
connect db
prepare sql command
execute sql
disconnect
do some non-db operations
connect to db
...
I use about 30 different sql commands and I thought that is good idea to
define all command in one sub and use execute() commands in script only.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Sun, 7 Oct 2007 16:20:03 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Script not able to work on Server 2003
Message-Id: <slrnfgijc3.4s9.tadmc@tadmc30.sbcglobal.net>
Joe <jruffino@gailborden.info> wrote:
> I have PERL scripst that I created on a Windows 2000 Server, that work
> great. We switched to a Windows 2003 Server, PERL is installed, but my
> script that works on 2000, will not work with the 2003 server. I keep
> getting the following error on all my scripts:
>
> "Content-type: text/html
>
> 'C:\Inetpub\wwwroot\cgi-bin\Employee_Status\employee_status.cgi'
> script produced no output"
>
> Plus, I have tried changing the extension to cgi, and I get the same
> error.
>
> Does anyone have any suggestions for me? I'm almost positive it is
> something simple, but I am just not seeing it.
I'm almost positive it has nothing to do with Perl.
It likely has to do with web server configuration.
Ask in a newsgroup about web servers.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sun, 07 Oct 2007 15:23:20 -0700
From: Joe <jruffino@gailborden.info>
Subject: Re: Script not able to work on Server 2003
Message-Id: <1191795800.989692.181830@d55g2000hsg.googlegroups.com>
Good suggestion, but the one thing I forgot to mention is, another
person wrote scripts a few years ago, and those, basically work out of
the box. His and mine are somewhat identical, but his work and mine
don't.
I have check for differences in coding style, and some we are fairly
close and other note. The big difference from his and mine are that
most of his are links in .asp pages, mine are just straight links.
Possibly it has something to do with the way IIS is calling it. Most
of my scripts do not have much to do with IIS. I'm sorry I'm rabling,
I just been looking at this all weekend.
------------------------------
Date: Sun, 07 Oct 2007 18:01:50 -0500
From: l v <veatchla@yahoo.com>
Subject: Re: Script not able to work on Server 2003
Message-Id: <13gipaq5vhq1q3e@news.supernews.com>
Joe wrote:
> Good suggestion, but the one thing I forgot to mention is, another
> person wrote scripts a few years ago, and those, basically work out of
> the box. His and mine are somewhat identical, but his work and mine
> don't.
>
> I have check for differences in coding style, and some we are fairly
> close and other note. The big difference from his and mine are that
> most of his are links in .asp pages, mine are just straight links.
>
> Possibly it has something to do with the way IIS is calling it. Most
> of my scripts do not have much to do with IIS. I'm sorry I'm rabling,
> I just been looking at this all weekend.
>
Write the output to a file and compare how many carriage returns does
your code and the the other person's code that works send after
Content-type: text/html ?
--
Len
------------------------------
Date: Sun, 07 Oct 2007 19:53:19 -0700
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: Script not able to work on Server 2003
Message-Id: <1191811999.269715.77640@r29g2000hsg.googlegroups.com>
On Oct 7, 3:23 pm, Joe <jruff...@gailborden.info> wrote:
> Good suggestion, but the one thing I forgot to mention is, another
> person wrote scripts a few years ago, and those, basically work
Without seeing you coder and knowing how your web server is
configured, it's anyones guess as to the problem/solution.
> His and mine are somewhat identical, but his work ....
^^^^^^^^^^^^^^^^^^
That's probably the key. What's the difference between yours and his?
>
> I have check for differences in coding style, and some we are fairly
> close and other note. The big difference from his and mine are that
> most of his are links in .asp pages, mine are just straight links.
Show us your code. Style is just style, what it's doing is most
important. We may not be able to troubleshoot the asp side, but if we
see your Perl code, we may be able to find the problem/solution.
>
> Possibly it has something to do with the way IIS is calling it.
That may be the case, and if so, we'll probably direct you to posting
in an IIS forum, but without seeing your code, it's impossible to say.
------------------------------
Date: Sun, 07 Oct 2007 22:03:27 -0700
From: Mintcake <tony@skelding.co.uk>
Subject: Should an empty regex match everything
Message-Id: <1191819807.198712.178510@d55g2000hsg.googlegroups.com>
The script at the end of this post produces the folllowing output...
Matching on 'plugh'
Contains the word plugh
Does not contain the word plugh
Matching on 'xyzzy'
Contains the word xyzzy
Matching on ''
1
I don't understand why 3rd call to gettd() does not produce any
matches.
#!/usr/bin/env perl
use strict;
use warnings;
my $tr = <<EOTR;
<tr>
<td>Contains the word plugh</td>
<td>Does not contain the word plugh</td>
<td>Contains the word xyzzy</td>
</tr>
EOTR
sub gettd {
my $regex = shift;
print "Matching on '$regex'\n";
for (grep /$regex/, $tr =~ /<td>(.*?)<\/td>/g) {
print " $_\n";
}
}
gettd('plugh');
gettd('xyzzy');
gettd('');
my $regex = '';
my $str = 'Any old string';
print $str =~ /$regex/, "\n";
------------------------------
Date: Mon, 08 Oct 2007 05:25:54 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: Should an empty regex match everything
Message-Id: <871wc6w525.fsf@hacking.dk>
Mintcake <tony@skelding.co.uk> writes:
> I don't understand why 3rd call to gettd() does not produce any
> matches.
Because a pattern consisting of the empty string has a special
meaning, documented in perlop:
If the PATTERN evaluates to the empty string, the last success-
fully matched regular expression is used instead. In this case,
only the "g" and "c" flags on the empty pattern is honoured -
the other flags are taken from the original pattern. If no
match has previously succeeded, this will (silently) act
instead as a genuine empty pattern (which will always match).
//Makholm
------------------------------
Date: Sun, 07 Oct 2007 20:07:56 -0500
From: Damien Kick <dkixk@earthlink.net>
Subject: Re: The Modernization of Emacs: terminology buffer and keybinding
Message-Id: <13gj0neh59oks91@corp.supernews.com>
Roedy Green wrote:
> On Fri, 28 Sep 2007 18:27:04 -0500, Damien Kick <dkixk@earthlink.net>
> wrote, quoted or indirectly quoted someone who said :
>
>> "free as in beer".
>
> but does not "free beer" nearly always come with a catch or implied
> obligation?
I had been trying to find a good Nietzsche quote about the role of debt
in the relationship of a child to his or her parents but I could not
seem to find a good one. I did, however, find what I think to be an
interesting secondary source
<http://www.eurozine.com/articles/2007-09-20-neilson-en.html>:
<blockquote>
For Nietzsche, debt was linked to the problem of promising and
forgetting. It would be a mistake to underestimate the importance of the
etymological play that underlies his association of debts (Schulden)
with guilt (Schuld). As is well known, the Second Essay of On the
Genealogy of Morals argues that the feeling of guilt, of personal
obligation, has its origin in the contractual relationship between
creditor and debtor. "It was here", Nietzsche writes, "that one person
first measured himself against another". And he continues:
Perhaps our word "man" (manas) still expresses something of precisely
this feeling of self-satisfaction: man designated himself as the
creature that measures values, evaluates and measures, as the "valuating
animal as such".[1]
How today are we to understand these claims and Nietzsche's extension of
them into arguments about the role of debt in the relations between
parents and children or between man and the deity?
</blockquote>
Beer helps to eliminate debt by promoting forgetfulness.
------------------------------
Date: Mon, 08 Oct 2007 05:04:54 -0000
From: bbound@gmail.com
Subject: Re: The Modernization of Emacs: terminology buffer and keybinding
Message-Id: <1191819894.369786.130300@v3g2000hsg.googlegroups.com>
On Oct 7, 9:07 pm, Damien Kick <dk...@earthlink.net> wrote:
> Perhaps our word "man" (manas) still expresses something of precisely
> this feeling of self-satisfaction: man designated himself as the
> creature that measures values, evaluates and measures, as the "valuating
> animal as such".[1]
Don't both "man" and those words for measurement come ultimately from
words for "hand" (similarly to words like "manual", as in labor)? Our
clever hands with their opposable thumbs being considered a defining
characteristic. And our tool use thus derived. Handspans also having
been a common (if imprecise) early unit of measurement (along with
forearm-spans, as in cubits, strides, and foot-length, from which the
measurement in feet still derives its name).
------------------------------
Date: Mon, 08 Oct 2007 01:11:04 -0400
From: Lew <lew@lewscanon.com>
Subject: Re: The Modernization of Emacs: terminology buffer and keybinding
Message-Id: <nMidnf2Pqut1JpTanZ2dnUVZ_sfinZ2d@comcast.com>
bbound@gmail.com wrote:
> Don't both "man" and those words for measurement come ultimately from
> words for "hand" (similarly to words like "manual", as in labor)? Our
> clever hands with their opposable thumbs being considered a defining
> characteristic. And our tool use thus derived. Handspans also having
> been a common (if imprecise) early unit of measurement (along with
> forearm-spans, as in cubits, strides, and foot-length, from which the
> measurement in feet still derives its name).
For most humans, the length of their foot from heel to toe is nearly equal to
the length of their forearm elbow to wrist.
--
Lew
------------------------------
Date: Sun, 7 Oct 2007 22:01:32 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Threads in perl for Solaris
Message-Id: <c2unt4-83d.ln1@osiris.mauzo.dyndns.org>
Quoth mohdejaz <mohdejaz@yahoo.com>:
> Is there threads support in perl for Solaris? I checked with SA and he
> said there was no "threads.pm" for Solaris. Please advise...
Who is SA?
threads.pm exists in all versions of 5.8. If your version of Solaris
comes with 5.6 (or earlier) pre-installed you cannot install threads.pm
for that perl; however, you can install a new perl which does support
threads. I am fairly certain there is a Solaris package for perl 5.8
available from sunfreeware.com.
Ben
------------------------------
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 V11 Issue 915
**************************************