[26458] in Perl-Users-Digest
Perl-Users Digest, Issue: 8627 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 3 14:05:29 2005
Date: Thu, 3 Nov 2005 11:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 3 Nov 2005 Volume: 10 Number: 8627
Today's topics:
Re: dynamically adding member sub to object? (Anno Siegel)
FAQ 5.17 How can I open a file with a leading ">" or tr <comdog@pair.com>
Re: Find a hex digit. <Juha.Laiho@iki.fi>
just because is a tiger (was: Re: s///x) <rvtol+news@isolution.nl>
ppm problem, no Email-Folder module <jheim@wisc.edu>
Re: ppm problem, no Email-Folder module <noreply@gunnar.cc>
Re: s///x (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Nov 2005 14:59:03 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: dynamically adding member sub to object?
Message-Id: <dkd8jn$86b$1@mamenchi.zrz.TU-Berlin.DE>
Eckstein C. <casabianca@suplitein.junk.de.net.org.com> wrote in comp.lang.perl.misc:
> John Bokma wrote:
> > "Eckstein C." <casabianca@suplitein.junk.de.net.org.com> wrote:
> >
> >> Is this possible? (Without using eval, as the scripts in this app
> >> seem to be wrapped in a eval behind the scenes, evident when theres
> >> an error in the code, in the error mesages. )
> >
> > I would inherit from "SomeClass", and use AUTOLOAD.
>
> I wanted to avoid that, and I wanted to loop through the "properties"
> (hash items) and dynamically generate a method for that class on the
> fly, but I can't find any info anywhere (perldoc, google, etc.)
I haven't followed the thread very closely, but the symbol-table
manipulation to install a method at run-time is (untested):
my $meth_name = 'do_something';
my $class = 'Target::Class';
my $code = sub { print "doing something with $_\n" for shift };
{
no strict 'refs';
*{ $class . '::' . $meth_name } = $code;
}
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: Thu, 3 Nov 2005 17:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@pair.com>
Subject: FAQ 5.17 How can I open a file with a leading ">" or trailing blanks?
Message-Id: <dkdfs5$ncj$1@reader2.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
5.17: How can I open a file with a leading ">" or trailing blanks?
(contributed by Brian McCauley)
The special two argument form of Perl's open() function ignores trailing
blanks in filenames and infers the mode from certain leading characters
(or a trailing "|"). In older versions of Perl this was the only version
of open() and so it is prevalent in old code and books.
Unless you have a particular reason to use the two argument form you
should use the three argument form of open() which does not treat any
charcters in the filename as special.
open FILE, "<", " file "; # filename is " file "
open FILE, ">", ">file"; # filename is ">file"
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: Thu, 3 Nov 2005 16:44:01 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Find a hex digit.
Message-Id: <dkdeoh$cmj$2@ichaos.ichaos-int>
"V S Rawat" <VSRawat@Invalid.none> said:
>Saw the following in a manual.
>
># Find a hex digit.
>$hexdigit = ('a','b','c','d','e','f')[$digit-10];
...
>4 -6 ARRAY(0x224ed4) a
>5 -5 ARRAY(0x224ed4) b
>6 -4 ARRAY(0x224ed4) c
>7 -3 ARRAY(0x224ed4) d
>8 -2 ARRAY(0x224ed4) e
>9 -1 ARRAY(0x224ed4) f
To explain these: accessing an array (or list) with a negative index
will produce the 'n'th element from the end of the array - so, with
index [-1] the last element of the array is returned ('f' in this case).
So, the code demonstrates a number of nice small features of perl,
but for this use there are much better constructs, as others have
already told.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Thu, 3 Nov 2005 15:58:44 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: just because is a tiger (was: Re: s///x)
Message-Id: <dkdch6.1as.1@news.isolution.nl>
Anno Siegel:
> Dr.Ruud:
>> "Gewoon is een tijger."
>
> "Habit is a tiger"?
>
> Yeah, a sleepy one, but when you want him to move he's got teeth.
A bit like that yes. It covers adjectives like 'normal', 'usual',
'habitual', 'customary', 'ordinary', 'general', 'common', 'simple',
'just', and most related adverbs too.
It is something my 3 year old answered when she got fed up with me
asking her several times in a row what she meant with 'Gewoon.' (I knew
that she meant "Just because." and she knew that I knew).
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Thu, 3 Nov 2005 15:09:22 +0000 (UTC)
From: John Heim <jheim@wisc.edu>
Subject: ppm problem, no Email-Folder module
Message-Id: <Xns97035D248AE82jheimwiscedu@144.92.9.81>
I wrote a script on a linux machine to process messages in a mail folder.
It uses Email::Folder. Now I want to use it on a Windows machine using
Active perl.
So I ran ppm and typed 'install Email-Folder' but it says there is no such
module. Anybody know why not? A bzillion other Email:: modules are there.
------------------------------
Date: Thu, 03 Nov 2005 16:54:04 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: ppm problem, no Email-Folder module
Message-Id: <3suq13Fq8kjoU1@individual.net>
John Heim wrote:
> I wrote a script on a linux machine to process messages in a mail folder.
> It uses Email::Folder. Now I want to use it on a Windows machine using
> Active perl.
>
> So I ran ppm and typed 'install Email-Folder' but it says there is no such
> module. Anybody know why not?
Maybe because it failed all the build tests.
http://ppm.activestate.com/BuildStatus/5.8-E.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 3 Nov 2005 14:13:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: s///x
Message-Id: <dkd5u1$6ud$1@mamenchi.zrz.TU-Berlin.DE>
Dr.Ruud <rvtol+news@isolution.nl> wrote in comp.lang.perl.misc:
> "Gewoon is een tijger."
"Habit is a tiger"?
Yeah, a sleepy one, but when you want him to move he's got teeth.
Anno
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
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 8627
***************************************