[28024] in Perl-Users-Digest
Perl-Users Digest, Issue: 9388 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 27 03:06:59 2006
Date: Tue, 27 Jun 2006 00:05: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 Tue, 27 Jun 2006 Volume: 10 Number: 9388
Today's topics:
Re: File::Find beginner question <none@nowhere.com>
Re: Need Search::Binary examples <benmorrow@tiscali.co.uk>
new CPAN modules on Tue Jun 27 2006 (Randal Schwartz)
Re: Please help Perl Newbie understand this statement <jurgenex@hotmail.com>
Re: Please help Perl Newbie understand this statement <jurgenex@hotmail.com>
Re: Problem with Multi- threaded Server <janicehwang1325@yahoo.com>
Re: Problem with Multi- threaded Server <janicehwang1325@yahoo.com>
Re: reference to object method <benmorrow@tiscali.co.uk>
Re: Regular Expression Generator <jurgenex@hotmail.com>
syntax for print form layout <<tabluar>> <raosrinat@gmail.com>
Re: What is a type error? <marshall.spight@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Jun 2006 13:16:41 +1200
From: Warwick <none@nowhere.com>
Subject: Re: File::Find beginner question
Message-Id: <1151370786.893707@ftpsrv1>
Thanks for your time and effort Ben. You have supplied plenty of ideas
for me to hack around with.
cheers
------------------------------
Date: Tue, 27 Jun 2006 02:10:28 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Need Search::Binary examples
Message-Id: <45d6n3-4d3.ln1@osiris.mauzo.dyndns.org>
Quoth Arvin Portlock <nomail@sorry.com>:
> Tad McClellan wrote:
>
> > >For some reason I
> > >have had problems with defined() working as advertised so
> > >typically shy away from it aside from checking for the
> > >existence of hash keys.
> >
> > You cannot use defined() to check the existence of hash keys!
> >
> > You must use exists() for that.
>
> I get confused and I'm too lazy to look up things I
> don't use enough to remember. Hence my personal idiom
> if ($var or $var eq '0').
This doesn't cover '', which is also false. It also doesn't cover
existing-but-undef hash values, which was Tad's point.
> There's another personal
> idiom I have. I'll often use [\w\W] in regular expressions
> because I'm too lazy to remember or look up when . matches
> \n or \r (I think it does if you put a /m at the end
> but [\w\W] is faster than looking it up to be certain).
No, it's /s. The way I remember it is
/s affects a *s*ingle metachar (.)
/m affects *m*any metachars (^ and $)
I find this easier than the 'single/many lines' they are meant to stand
for.
Using this will probably cause the regex optimizer to produce a slower
regex (I'm not sure if it's clever enough to convert /[\w\W]/ -> /./),
and will *certainly* confuse readers of your code.
> Yeah, everyone is apalled I'm sure. Just thought I'd
> post a confession from the Dark Side for if you ever
> wonder why some people do the craziest things in perl.
> Answer: we're lazy and it's faster/less work than
> looking it up
This is false Laziness. Especially 'cos it's wrong :).
Ben
--
The Earth is degenerating these days. Bribery and corruption abound.
Children no longer mind their parents, every man wants to write a book,
and it is evident that the end of the world is fast approaching.
Assyrian stone tablet, c.2800 BC benmorrow@tiscali.co.uk
------------------------------
Date: Tue, 27 Jun 2006 04:42:11 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Jun 27 2006
Message-Id: <J1I52B.1tKK@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.
Acme-MetaSyntactic-0.80
http://search.cpan.org/~book/Acme-MetaSyntactic-0.80/
Themed metasyntactic variables names
----
Best-0.01
http://search.cpan.org/~gaal/Best-0.01/
Fallbackable module loader
----
Catalyst-Action-RenderView-0.01
http://search.cpan.org/~mramberg/Catalyst-Action-RenderView-0.01/
Sensible default end action.
----
Catalyst-Model-Jifty-DBI-0.01
http://search.cpan.org/~mramberg/Catalyst-Model-Jifty-DBI-0.01/
A Catalyst interface to the Jifty db layer
----
Class-Accessor-Grouped-0.01
http://search.cpan.org/~claco/Class-Accessor-Grouped-0.01/
----
Class-Accessor-Grouped-0.02
http://search.cpan.org/~claco/Class-Accessor-Grouped-0.02/
Lets you build groups of accessors
----
Class-Accessor-Named-0.002
http://search.cpan.org/~jesse/Class-Accessor-Named-0.002/
Better profiling output for Class::Accessor
----
Class-Pluggable-0.02
http://search.cpan.org/~takeshige/Class-Pluggable-0.02/
Simple pluggable class.
----
DBIx-Class-0.06999_03
http://search.cpan.org/~dkamholz/DBIx-Class-0.06999_03/
Extensible and flexible object <-> relational mapper.
----
DBIx-SimplePerl-1.41
http://search.cpan.org/~landman/DBIx-SimplePerl-1.41/
Perlish access to DBI
----
Date-Language-Hungarian-0.011
http://search.cpan.org/~lgoddard/Date-Language-Hungarian-0.011/
Magyar format for Date::Format
----
Deco-0.03
http://search.cpan.org/~narked/Deco-0.03/
Module for simulating body tissue during a scuba dive
----
Email-Valid-Loose-0.05
http://search.cpan.org/~miyagawa/Email-Valid-Loose-0.05/
Email::Valid which allows dot before at mark
----
FEAR-API-0.489
http://search.cpan.org/~xern/FEAR-API-0.489/
Web Scraping Zen
----
Finance-Bank-AllianceAndLeicester-1.00
http://search.cpan.org/~bisscuitt/Finance-Bank-AllianceAndLeicester-1.00/
Check your Alliance & Leicester bank accounts from Perl
----
Games-Maze-SVG-0.75
http://search.cpan.org/~gwadej/Games-Maze-SVG-0.75/
Build mazes in SVG.
----
HTTP-CryptoCookie-1.13
http://search.cpan.org/~dparis/HTTP-CryptoCookie-1.13/
Perl extension for encrypted HTTP cookies
----
JavaScript-XRay-1.0
http://search.cpan.org/~jbisbee/JavaScript-XRay-1.0/
See What JavaScript is Doing
----
JavaScript-XRay-1.01
http://search.cpan.org/~jbisbee/JavaScript-XRay-1.01/
See What JavaScript is Doing
----
KinoSearch-0.12
http://search.cpan.org/~creamyg/KinoSearch-0.12/
search engine library
----
Locale-Object-0.73
http://search.cpan.org/~fotango/Locale-Object-0.73/
OO locale information
----
Module-Compile-0.16
http://search.cpan.org/~ingy/Module-Compile-0.16/
Perl Module Compilation
----
Net-NBName-0.26
http://search.cpan.org/~jmacfarla/Net-NBName-0.26/
NetBIOS Name Service Requests
----
Net-Whois-Proxy-1.10
http://search.cpan.org/~cfaber/Net-Whois-Proxy-1.10/
an easy to use recursive whois client library
----
Perl6-Pugs-6.2.12
http://search.cpan.org/~autrijus/Perl6-Pugs-6.2.12/
A Perl 6 Implementation
----
Pugs-Compiler-Rule-0.06
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.06/
Compiler for Perl 6 Rules
----
Pugs-Compiler-Rule-0.07
http://search.cpan.org/~fglock/Pugs-Compiler-Rule-0.07/
Compiler for Perl 6 Rules
----
RRD-Simple-1.39
http://search.cpan.org/~nicolaw/RRD-Simple-1.39/
Simple interface to create and store data in RRD files
----
Test-Litmus-0.01
http://search.cpan.org/~zlipton/Test-Litmus-0.01/
Perl module to submit test results to the Litmus testcase management tool
----
Test-Litmus-0.02
http://search.cpan.org/~zlipton/Test-Litmus-0.02/
Perl module to submit test results to the Litmus testcase management tool
----
WWW-YouTube-2006.0626
http://search.cpan.org/~ermeyers/WWW-YouTube-2006.0626/
YouTube Development Interface (YTDI)
----
WebPresence-Profile
http://search.cpan.org/~dodger/WebPresence-Profile/
----
orz-0.12
http://search.cpan.org/~ingy/orz-0.12/
Total Failure
----
v6-pugs-0.001
http://search.cpan.org/~fglock/v6-pugs-0.001/
----
worky-0.10
http://search.cpan.org/~ingy/worky-0.10/
For when your code no worky
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: Tue, 27 Jun 2006 03:19:08 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Please help Perl Newbie understand this statement
Message-Id: <Ms1og.8385$Wl.3183@trnddc01>
[For future reference: it is customary to shorten the quoted text to the
relevant part and to insperse your comments at the appropriate place]
jm-1@remotekontrol.com wrote:
> If the current line starts with a word character
>> "\w Match a "word" character (alphanumeric plus "_")"
>
> what does the m/^ mean in " if (m/^\w/)"
The way you are asking it stands for a syntax error because the command is
not complete.
The m operator (which is explained in perldoc perlop) takes one argument
that is a regular expression (RE), commonly written as m/..../ where the
.... is to be replaced with the RE.
The ^ at the beginning of an RE indicates a match at the beginning of the
line and the \w indicates a word character. That means the whole RE matches,
if the line begins with a word character in which case m/.../ returns true.
jue
------------------------------
Date: Tue, 27 Jun 2006 03:20:08 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Please help Perl Newbie understand this statement
Message-Id: <It1og.8387$Wl.6895@trnddc01>
Tad McClellan wrote:
> So then, m/^\w/ will match (and return true) if the 1st
> character in $_ is one of the 63 "word" characters.
Subject to your locale, of course ;-)
jue
------------------------------
Date: 26 Jun 2006 18:39:10 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Re: Problem with Multi- threaded Server
Message-Id: <1151372350.647272.200710@m73g2000cwd.googlegroups.com>
Ya, I miss that part and I amend my program by putting the close with
SSL_no_shutdown. However, this only help when the client program ends
the connection and the server program would not hang. It does not
actually solve the segmentation fault problem. I did send my problem to
the maintainers of IO::Socket::SSL. While waiting for their reply, will
keep debuggin. Thank you very much for your information. I appreciates
a lot. Anyhow, any progressions on the program will be shared.
Ted Zlatanov wrote:
> On 26 Jun 2006, xhoster@gmail.com wrote:
>
> "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com> wrote:
> >> Thanks for the debuggin guidelines. Here are some results for my
> >> testing:
> >>
> >> 1. Threaded server works fine without SSL.
> >> 2. DBI doesn't cause a problem for threaded server (either enable or
> >> disable DBI does not cause the problem with the condition WITHOUT SSL)
> >> 3. Threaded server fails when use with SSL
> >
> >
> > Have you read and understood the parts about close and SSL_no_shutdown in
> > the IO::Socket::SSL docs?
> >
> > I can't get SSL to install, so I can't test it, but I suspect this is
> > likely the problem.
>
> I'm glad we've established the problem is just in the SSL layer.
>
> An additional suggestion: after you looked at the docs, if you still
> can't figure the problem out, contact the IO::Socket::SSL
> maintainers. Until the problem is resolved, you could turn off SSL so
> your server can be used, if that's prudent depending on your
> particular security situation.
>
> Ted
------------------------------
Date: 26 Jun 2006 20:29:57 -0700
From: "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com>
Subject: Re: Problem with Multi- threaded Server
Message-Id: <1151378997.099532.51700@b68g2000cwa.googlegroups.com>
I found another funny error in the code. When I test the socket whether
it is detached or not, by $thread->detach() or die "can't detach"; it
prompts that "A thread exited while 2 threads were running." I test it
with the IO::Socket::INET, same error occurs. I wonder this is the
cause of the problem or just another problem as I can run the program
with IO::Socket::INET perfectly without the checking on detach.
janicehwang1325@yahoo.com wrote:
> Ya, I miss that part and I amend my program by putting the close with
> SSL_no_shutdown. However, this only help when the client program ends
> the connection and the server program would not hang. It does not
> actually solve the segmentation fault problem. I did send my problem to
> the maintainers of IO::Socket::SSL. While waiting for their reply, will
> keep debuggin. Thank you very much for your information. I appreciates
> a lot. Anyhow, any progressions on the program will be shared.
>
> Ted Zlatanov wrote:
> > On 26 Jun 2006, xhoster@gmail.com wrote:
> >
> > "janicehwang1325@yahoo.com" <janicehwang1325@yahoo.com> wrote:
> > >> Thanks for the debuggin guidelines. Here are some results for my
> > >> testing:
> > >>
> > >> 1. Threaded server works fine without SSL.
> > >> 2. DBI doesn't cause a problem for threaded server (either enable or
> > >> disable DBI does not cause the problem with the condition WITHOUT SSL)
> > >> 3. Threaded server fails when use with SSL
> > >
> > >
> > > Have you read and understood the parts about close and SSL_no_shutdown in
> > > the IO::Socket::SSL docs?
> > >
> > > I can't get SSL to install, so I can't test it, but I suspect this is
> > > likely the problem.
> >
> > I'm glad we've established the problem is just in the SSL layer.
> >
> > An additional suggestion: after you looked at the docs, if you still
> > can't figure the problem out, contact the IO::Socket::SSL
> > maintainers. Until the problem is resolved, you could turn off SSL so
> > your server can be used, if that's prudent depending on your
> > particular security situation.
> >
> > Ted
------------------------------
Date: Tue, 27 Jun 2006 02:15:42 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: reference to object method
Message-Id: <ued6n3-4d3.ln1@osiris.mauzo.dyndns.org>
Quoth Charles DeRykus <ced@blv-sam-01.ca.boeing.com>:
> Hobo Salesman wrote:
> > Can I store a reference to an object method in a scalar and use that to
> > call the method? Something like (and I'm sure this is wrong):
> >
> > $methodRef = \$object->method();
>
> No, that invokes the method and gives you a reference to the return
> value (or last return value if the method returns a list)*.
The method doesn't return a list. ${} provides scalar context.
(Yes, I know I've argued against the 'there are no lists in scalar
context' model in the past. I accepted that it mekes it easier for most
people to understand what's going on :) )
Ben
--
Outside of a dog, a book is a man's best friend.
Inside of a dog, it's too dark to read.
benmorrow@tiscali.co.uk Groucho Marx
------------------------------
Date: Tue, 27 Jun 2006 03:27:14 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Regular Expression Generator
Message-Id: <mA1og.8389$Wl.1124@trnddc01>
Ted Zlatanov wrote:
> On 26 Jun 2006, jurgenex@hotmail.com wrote:
>
> jeremyje@gmail.com wrote:
>>> Is there a library or a way to generate an appropriate regular
>>> expression for any given input string?
>
>> Seriously: it is impossible to derive a generic RE pattern from a
>> single text sample.
>
> I think this is incorrect, Jurgen. The OP was asking about an
> appropriate, not a generic regex. Other than
> http://search.cpan.org/~dankogai/Regexp-Optimizer-0.15/lib/Regexp/Optimizer.pm
> (which I mentioned in c.l.p.modules to answer his post, before I saw
> his cross-post here), you can always just say
>
> my $regex = '^(' . join('|', @strings) . ')$';
>
> and that's a regex that will match any given non-empty strings.
True. As will /.+/. And the other extreme is /\Q$string\E/.
Chances are the OP was looking for neither of those 'solution' but for
something in between.
But where the right 'in between' can be found that is something you cannot
decide based on a single sample.
jue
------------------------------
Date: 26 Jun 2006 21:58:55 -0700
From: "Srinath" <raosrinat@gmail.com>
Subject: syntax for print form layout <<tabluar>>
Message-Id: <1151384335.217676.11210@y41g2000cwy.googlegroups.com>
Hi..
I am facing syntax error with "print form :layout<<tabluar>>"
Please someone from the group provide me a proper syntax for the same
Following code flags syntax error for the same.
syntax error at <filename>line 685, near "form:"
syntax error at <filename> line 691, near "form:"
demo()
{
print form :layout<<tabular>>
"File name Missing ostags ",
"____________ ____________",
"{[[[[[[[[[[} {[[[[[[[[[[}",
@strfilenameMissing, @TagsMissing;
print form :layout<<tabular>>
"File name Additional ostags ",
"____________ ____________",
"{[[[[[[[[[[} {[[[[[[[[[[}",
@strFileNameAdditional, @strAdditionalFiles;
}
------------------------------
Date: 26 Jun 2006 19:18:24 -0700
From: "Marshall" <marshall.spight@gmail.com>
Subject: Re: What is a type error?
Message-Id: <1151374704.304776.60630@u72g2000cwu.googlegroups.com>
Pascal Costanza wrote:
>
> Consider division by zero: appropriate arguments for division are
> numbers, including the zero.
A bold assertion!
The general question is, what do we do about partial functions?
> The dynamic type check will typically not
> check whether the second argument is zero, but will count on the fact
> that the processor will raise an exception one level deeper.
This is an implementation artifact, and hence not relevant to our
understanding of the issue.
Marshall
------------------------------
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 9388
***************************************