[30460] in Perl-Users-Digest
Perl-Users Digest, Issue: 1703 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 9 00:09:55 2008
Date: Tue, 8 Jul 2008 21:09:17 -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, 8 Jul 2008 Volume: 11 Number: 1703
Today's topics:
Re: Compiled perl executable <simon.chao@gmail.com>
Re: Compiled perl executable <simon.chao@gmail.com>
Re: Compiled perl executable <owinsloe@gmail.com>
Re: Compiled perl executable <owinsloe@gmail.com>
Re: Compiled perl executable <ben@morrow.me.uk>
Constructor API opinions <nospamplease@yahoo.com>
Re: Constructor API opinions <ben@morrow.me.uk>
Re: Constructor API opinions <spamtrap@dot-app.org>
Re: embeding perl in C++ <wahab@chemie.uni-halle.de>
Re: FAQ 1.12 What's the difference between "perl" and " sln@netherlands.com
Re: FAQ 1.12 What's the difference between "perl" and " sln@netherlands.com
Re: FAQ 1.12 What's the difference between "perl" and " <g.seesig@gmail.com>
Re: FAQ 1.12 What's the difference between "perl" and " sln@netherlands.com
Re: FAQ 1.12 What's the difference between "perl" and " <tadmc@seesig.invalid>
Re: help with regular expression sln@netherlands.com
Re: help with regular expression <tadmc@seesig.invalid>
Re: Perl/Tk and Tk 8.5 <mjcarman@mchsi.com>
Pugs versus Perl 6 on Parrot <himanshu.garg@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 8 Jul 2008 19:41:56 -0700 (PDT)
From: nolo contendere <simon.chao@gmail.com>
Subject: Re: Compiled perl executable
Message-Id: <5a1e76a8-860a-4545-ace2-5dd50410b2ab@a1g2000hsb.googlegroups.com>
On Jul 7, 10:52=A0pm, owins...@gmail.com wrote:
> Anyone else noticed on Windows that when you run a compiled perl
> script (compiled using pp) it causes TWO copies of the executable to
> run? I'm running perl5.8.8 and previously perl5.8.6. A compile of the
> same script in 5.8.6 only runs one copy. I want to revert to only one
> copy, ....2 copies looks ugly and can be confusing as to whats going
> on (through Windows task manager), especially if you are running
> multiple instances of the same executable. Ta
why did you compile it? what's the performance comparison against the
uncompiled version?
------------------------------
Date: Tue, 8 Jul 2008 19:46:26 -0700 (PDT)
From: nolo contendere <simon.chao@gmail.com>
Subject: Re: Compiled perl executable
Message-Id: <7f4b760b-257d-4aa8-ab13-de22f7cbc037@59g2000hsb.googlegroups.com>
On Jul 8, 1:38=A0am, pilc...@pp.info wrote:
> Excuse me, gents. =A0What is 'pp'?
for detailed info, google 'perl pp'.
------------------------------
Date: Tue, 8 Jul 2008 19:54:55 -0700 (PDT)
From: O <owinsloe@gmail.com>
Subject: Re: Compiled perl executable
Message-Id: <51742918-ab30-4d7e-874c-98f5f509cf81@e53g2000hsa.googlegroups.com>
On Jul 8, 3:09 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth owins...@gmail.com:
>
> > Anyone else noticed on Windows that when you run a compiled perl
> > script (compiled using pp) it causes TWO copies of the executable to
> > run? I'm running perl5.8.8 and previously perl5.8.6. A compile of the
> > same script in 5.8.6 only runs one copy. I want to revert to only one
> > copy, ....2 copies looks ugly and can be confusing as to whats going
> > on (through Windows task manager), especially if you are running
> > multiple instances of the same executable. Ta
>
> If you use Sysinternals' procexp.exe instead of Task Manager, you will
> see that one is the child of the other: the parent is the instance you
> started, and the child is a new copy that has been created in the par-
> xxxx temp directory and is the one actually doing all the work. I don't
> really know why this is necessary, but it's probably part of getting
> Windows' dll loader to do the right thing.
>
> Ben
>
> --
> It will be seen that the Erwhonians are a meek and long-suffering people,
> easily led by the nose, and quick to offer up common sense at the shrine of
> logic, when a philosopher convinces them that their institutions are not based
> on the strictest morality. [Samuel Butler, paraphrased] b...@morrow.me.uk
Thanks Ben, I guessed that was the case. The behaviour must have
changed as it did not do this for 5.8.6 (only ran one exe). If
possible I would like to go back to having only one exe but I could
not find anything through the PAR/PP doc that suggested there was a
compile time option that would achieve this.
------------------------------
Date: Tue, 8 Jul 2008 19:58:14 -0700 (PDT)
From: O <owinsloe@gmail.com>
Subject: Re: Compiled perl executable
Message-Id: <fd61fc68-8935-408f-ac2a-91ce713c70ff@i76g2000hsf.googlegroups.com>
On Jul 8, 5:38 pm, pilc...@pp.info wrote:
> On Tue, 8 Jul 2008 04:09:06 +0100, Ben Morrow <b...@morrow.me.uk> wrote:
>
> >Quoth owins...@gmail.com:
> >> Anyone else noticed on Windows that when you run a compiled perl
> >> script (compiled using pp) it causes TWO copies of the executable to
> >> run? I'm running perl5.8.8 and previously perl5.8.6. A compile of the
> >> same script in 5.8.6 only runs one copy. I want to revert to only one
> >> copy, ....2 copies looks ugly and can be confusing as to whats going
> >> on (through Windows task manager), especially if you are running
> >> multiple instances of the same executable. Ta
>
> >If you use Sysinternals' procexp.exe instead of Task Manager, you will
> >see that one is the child of the other: the parent is the instance you
> >started, and the child is a new copy that has been created in the par-
> >xxxx temp directory and is the one actually doing all the work. I don't
> >really know why this is necessary, but it's probably part of getting
> >Windows' dll loader to do the right thing.
>
> >Ben
>
> Excuse me, gents. What is 'pp'?
Its part of the Perl PAR package that allows you to compile your
scripts into an executable. This enables you to distribute to another
server/pc that does not have Perl installed ->
http://search.cpan.org/~autrijus/PAR-0.85/script/pp
------------------------------
Date: Wed, 9 Jul 2008 04:42:45 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Compiled perl executable
Message-Id: <lmodk5-8h32.ln1@osiris.mauzo.dyndns.org>
Quoth O <owinsloe@gmail.com>:
> On Jul 8, 3:09 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> > Quoth owins...@gmail.com:
> >
> > > Anyone else noticed on Windows that when you run a compiled perl
> > > script (compiled using pp) it causes TWO copies of the executable to
> > > run?
<snip>
> >
> > If you use Sysinternals' procexp.exe instead of Task Manager, you will
> > see that one is the child of the other: the parent is the instance you
> > started, and the child is a new copy that has been created in the par-
> > xxxx temp directory and is the one actually doing all the work. I don't
> > really know why this is necessary, but it's probably part of getting
> > Windows' dll loader to do the right thing.
>
> Thanks Ben, I guessed that was the case. The behaviour must have
> changed as it did not do this for 5.8.6 (only ran one exe). If
> possible I would like to go back to having only one exe but I could
> not find anything through the PAR/PP doc that suggested there was a
> compile time option that would achieve this.
I rather doubt it's related to perl version. It's much more likely
related to either PAR.pm version or the options you passed to
PAR::Packer. AFAICT, with current versions of pp you get two instances
if you don't pass -d or if your perl wasn't built with a shared libperl
(but practically all Win32 perls are), but I don't really understand any
of this so ICBW.
Ben
--
I must not fear. Fear is the mind-killer. I will face my fear and
I will let it pass through me. When the fear is gone there will be
nothing. Only I will remain.
ben@morrow.me.uk Frank Herbert, 'Dune'
------------------------------
Date: Tue, 08 Jul 2008 19:28:04 -0700
From: Bob Smith <nospamplease@yahoo.com>
Subject: Constructor API opinions
Message-Id: <nospamplease-04B7C5.19280408072008@comcast.dca.giganews.com>
I have a class that is used two ways: given an id, it pulls an object
from a web page identified by id, and stores the object in a database.
A different part of the system uses the same class to (later) retrieve
the object from the database, by id. You can think of this app as a
small Web scraper.
I use the terminology "pull" to indicate an HTTP GET, and "retrieve" to
mean a db retrieval.
My question is, what's the best or recommended way to structure the use
of the constructor(s). For example:
my $object = MyClass->new($id);
could mean either (a) get the object from the Web and store it; or (b)
get the object from the database.
This gives me several options for how to structure the API.
* # Initially, to pull from Web
my $object = MyClass->new($id); # get from Web, store to db.
# Later, in a different part of the system ...
my $dbRetrievalObject = MyClass->new(); # returns empty object.
$dbRetrievalObject->retrieve($id);
This solution is non-symmetric -- you new() on the way in, and new();
retrieve(); on the way out.
* Or, use a flag in new(), with suitably defined constants:
my $object = MyClass->new($id, PULL);
....
my $object = MyClass->new($id, RETRIEVE);
Symmetric, but now the caller needs to know the constants.
* Or, have two different constructors:
my $object = MyClass->pull($id);
...
my $object = MyClass->retrieve($id);
Symmetric and simple, but possibly confusing because there's no
constructor called new(), and it's not immediately apparent that pull()
and retrieve() are constructors.
Opinions? Best practices?
------------------------------
Date: Wed, 9 Jul 2008 04:19:15 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Constructor API opinions
Message-Id: <jandk5-je22.ln1@osiris.mauzo.dyndns.org>
Quoth Bob Smith <nospamplease@yahoo.com>:
>
> This gives me several options for how to structure the API.
>
> * # Initially, to pull from Web
> my $object = MyClass->new($id); # get from Web, store to db.
>
> # Later, in a different part of the system ...
> my $dbRetrievalObject = MyClass->new(); # returns empty object.
> $dbRetrievalObject->retrieve($id);
>
> This solution is non-symmetric -- you new() on the way in, and new();
> retrieve(); on the way out.
>
<snip>
> * Or, have two different constructors:
>
> my $object = MyClass->pull($id);
> ...
> my $object = MyClass->retrieve($id);
>
> Symmetric and simple, but possibly confusing because there's no
> constructor called new(), and it's not immediately apparent that pull()
> and retrieve() are constructors.
I would have
MyClass->new(...)->pull($id);
MyClass->new(...)->retrieve($id);
(both returning the object, of course) with
MyClass->pull($id);
MyClass->retrieve($id);
shortcuts that call 'new' with default parameters. You can test if
you're being called on the class or an object with 'ref', so
something like
sub pull {
my ($self, $id) = @_;
ref $self or $self = $self->new;
...
}
Ben
--
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one.
'We come in peace'---the order came to cut them down. [ben@morrow.me.uk]
------------------------------
Date: Tue, 08 Jul 2008 23:48:47 -0400
From: Sherman Pendley <spamtrap@dot-app.org>
Subject: Re: Constructor API opinions
Message-Id: <m1bq17afa8.fsf@dot-app.org>
Bob Smith <nospamplease@yahoo.com> writes:
> I have a class that is used two ways: given an id, it pulls an object
> from a web page identified by id, and stores the object in a database.
>
> A different part of the system uses the same class to (later) retrieve
> the object from the database, by id. You can think of this app as a
> small Web scraper.
>
> I use the terminology "pull" to indicate an HTTP GET, and "retrieve" to
> mean a db retrieval.
>
> My question is, what's the best or recommended way to structure the use
> of the constructor(s). For example:
>
> my $object = MyClass->new($id);
>
> could mean either (a) get the object from the Web and store it; or (b)
> get the object from the database.
Could your new() method check the database first, and retrieve the
object if it's there, and pull it from the web if not?
sherm--
--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Wed, 09 Jul 2008 00:19:44 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: embeding perl in C++
Message-Id: <g50p60$2tal$1@nserver.hrz.tu-freiberg.de>
Leon Timmermans wrote:
> On Wed, 02 Jul 2008 23:00:58 -0700, Peng Yu wrote:
>> It seem libperl can be used to embed perl in C++. But that was developed
>> long ago and is for C. I'm wondering if there are any new and better
>> library to embed perl in C++.
>
> Actually I'm working on just that!
Fine!
> It's similar to boost.python,
I hope not ;-)
> but in an earlier stage. Mail me if you're interested.
Boost_Python is, IIRC, for exposing C++ functions
to a Python program and not for using Python within
a C++ program. It does what SWIG does - but hides that
process it behind an interface.
(I don't get it - what this is all about and what this
one has to do with Boost, but YMMV ...)
Regards
M.
------------------------------
Date: Tue, 08 Jul 2008 23:06:39 GMT
From: sln@netherlands.com
Subject: Re: FAQ 1.12 What's the difference between "perl" and "Perl"?
Message-Id: <ggs774p4ik8n5t69ihbdd3n7v2ns7d4cg3@4ax.com>
On Tue, 8 Jul 2008 14:45:33 -0700, "Gordon Corbin Etly" <gvinalcde@gmail.com> wrote:
>Charlton Wilbur wrote:
>>>>>>> "GCE" == Gordon Corbin Etly <gvinalcde@gmail.com> writes:
>
>> > Please tell me where it says you cannot write "PERL" to mean
>> > "Practical Extraction and Report Language" in short? Where is
>> > it written that this explicitly cannot be done? That's all I
>> > ask, and no one wants to give a real answer other than
>> > reiterating the status quo. That is not the same as delivering
>> > a concrete explaining of why it is wrong, and this is why I
>> > continue to put forth that there is nothing inherently wrong.
>
>> In an abstract sense, there's nothing inherently wrong with writing
>> PERL. But, as has been explained to you at least a dozen times, this
>> is a shibboleth that the core of the Perl community uses to
>> distinguish between people who are in the Perl community and people
>> who are not.
>
>And I've been pointing out to people like yourself that this so called
>"shibboleth" is flawed. As you point out, there is nothing inherently
>wrong with writing "PERL", and even more so, it actually proves one has
>read the words of Larry himself, whether directly or through other
>sources (including perldoc.)
>
>
>> If you write PERL, you are marking yourself as an outsider in the eyes
>> of people who are at the core of the Perl community.
>
>I strongly disagree. It shows you are a free thinking individual who
>doesn't just conform because they are told to.
>
>
>> Charity and politeness dictate that you should be informed of this;
>> you have been.
>
>And I started out by politely arguing that such claims didn't make sense
>and that there wasn't anything inherently wrong with it.
>
>
>
>> No, there's nothing technically wrong with PERL, expanded as you
>> describe.
>
>Agreed.
>
>
>> Practically, it marks people who use it as either clueless
>> novices, who haven't yet encountered the FAQ, or as argumentative
>> twits, who have encountered the FAQ and choose to argue usage instead
>> of doing something more productive with everyone's time.
>
>So are you saying that if one chooses to use the words of Larry Wall
>himself, they are clueless and a twit, all because an FAQ someone wrote
>says otherwise? Do you mean to tell me an FAQ cannot be wrong? Come on,
>you know better than that.
>
>
>> the shibboleth serves a very useful purpose; it allows me to dismiss
>> you
>
>It's a shame that you do not want to be more flexible in the ideals you
>believe in.
>
>
>> (and, incidentally, your "cousin,"
>
>If you must know, Way is my first cousin and we grew up together so
>we're practically brothers. He lost his parent's when he was 3 and we've
>were 7 up together since an we've always been close and yes we do tend
>to think alike. We've had similar experiences and many shared interests,
>including those pertaining to computer science, and so we have similar
>views on many subjects (not all, but many), including the problem of
>inflexibility among you.
Since PERL is not a standard, sanctioned by ANSI, it is not anything but an implemtation.
The difference between PERL, Perl and perl is nothing whatsoever.. period!
sln
------------------------------
Date: Wed, 09 Jul 2008 00:22:40 GMT
From: sln@netherlands.com
Subject: Re: FAQ 1.12 What's the difference between "perl" and "Perl"?
Message-Id: <7318745v3ks44bujbb5fanbvm0h9h3c16b@4ax.com>
On Tue, 08 Jul 2008 23:06:39 GMT, sln@netherlands.com wrote:
>On Tue, 8 Jul 2008 14:45:33 -0700, "Gordon Corbin Etly" <gvinalcde@gmail.com> wrote:
>
>>Charlton Wilbur wrote:
>>>>>>>> "GCE" == Gordon Corbin Etly <gvinalcde@gmail.com> writes:
>>
>>> > Please tell me where it says you cannot write "PERL" to mean
>>> > "Practical Extraction and Report Language" in short? Where is
>>> > it written that this explicitly cannot be done? That's all I
>>> > ask, and no one wants to give a real answer other than
>>> > reiterating the status quo. That is not the same as delivering
>>> > a concrete explaining of why it is wrong, and this is why I
>>> > continue to put forth that there is nothing inherently wrong.
>>
>>> In an abstract sense, there's nothing inherently wrong with writing
>>> PERL. But, as has been explained to you at least a dozen times, this
>>> is a shibboleth that the core of the Perl community uses to
>>> distinguish between people who are in the Perl community and people
>>> who are not.
>>
>>And I've been pointing out to people like yourself that this so called
>>"shibboleth" is flawed. As you point out, there is nothing inherently
>>wrong with writing "PERL", and even more so, it actually proves one has
>>read the words of Larry himself, whether directly or through other
>>sources (including perldoc.)
>>
>>
>>> If you write PERL, you are marking yourself as an outsider in the eyes
>>> of people who are at the core of the Perl community.
>>
>>I strongly disagree. It shows you are a free thinking individual who
>>doesn't just conform because they are told to.
>>
>>
>>> Charity and politeness dictate that you should be informed of this;
>>> you have been.
>>
>>And I started out by politely arguing that such claims didn't make sense
>>and that there wasn't anything inherently wrong with it.
>>
>>
>>
>>> No, there's nothing technically wrong with PERL, expanded as you
>>> describe.
>>
>>Agreed.
>>
>>
>>> Practically, it marks people who use it as either clueless
>>> novices, who haven't yet encountered the FAQ, or as argumentative
>>> twits, who have encountered the FAQ and choose to argue usage instead
>>> of doing something more productive with everyone's time.
>>
>>So are you saying that if one chooses to use the words of Larry Wall
>>himself, they are clueless and a twit, all because an FAQ someone wrote
>>says otherwise? Do you mean to tell me an FAQ cannot be wrong? Come on,
>>you know better than that.
>>
>>
>>> the shibboleth serves a very useful purpose; it allows me to dismiss
>>> you
>>
>>It's a shame that you do not want to be more flexible in the ideals you
>>believe in.
>>
>>
>>> (and, incidentally, your "cousin,"
>>
>>If you must know, Way is my first cousin and we grew up together so
>>we're practically brothers. He lost his parent's when he was 3 and we've
>>were 7 up together since an we've always been close and yes we do tend
>>to think alike. We've had similar experiences and many shared interests,
>>including those pertaining to computer science, and so we have similar
>>views on many subjects (not all, but many), including the problem of
>>inflexibility among you.
>
>
>Since PERL is not a standard, sanctioned by ANSI, it is not anything but an implemtation.
>The difference between PERL, Perl and perl is nothing whatsoever.. period!
>
>sln
There is a uphamism used to represent a distribution, aka perl, with the idealized
mataphor Perl, as is the subject of this FAQ.
sln
------------------------------
Date: Tue, 8 Jul 2008 17:47:36 -0700
From: "Gordon Corbin Etly" <g.seesig@gmail.com>
Subject: Re: FAQ 1.12 What's the difference between "perl" and "Perl"?
Message-Id: <6dig59F2oh7jU1@mid.individual.net>
sln@netherlands.com wrote:
> On Tue, 08 Jul 2008 23:06:39 GMT, sln@netherlands.com wrote:
> > On Tue, 8 Jul 2008 14:45:33 -0700, "Gordon Corbin Etly" wrote:
> > > Charlton Wilbur wrote:
> > > > Practically, it marks people who use it as either clueless
> > > > novices, who haven't yet encountered the FAQ, or as
> > > > argumentative
> > > > twits, who have encountered the FAQ and choose to argue usage
> > > > instead of doing something more productive with everyone's time.
> > > So are you saying that if one chooses to use the words of Larry
> > > Wall
> > > himself, they are clueless and a twit, all because an FAQ someone
> > > wrote says otherwise? Do you mean to tell me an FAQ cannot be
> > > wrong? Come on, you know better than that.
> > PERL is not a standard, sanctioned by ANSI, it is not anything
> > but an implemtation. The difference between PERL, Perl and perl is
> > nothing whatsoever.. period!
>
> There is a uphamism used to represent a distribution, aka perl, with
> the idealized mataphor Perl, as is the subject of this FAQ.
True. And at the same time, you have a description, which comes from
Larry Wall, the creator, and also appears in the official documentation,
"Practical Extraction and Report Language", so writing PERL should be
taken to signify you mean to write "Practical Extraction and Report
Language", just as writing something like IIRC or FWIW or YMMV or some
such is short other phases. Notice that when most people write such
shorts, they too are typically written in upper casing. So I truly full
heartedly do not understand this obsession some people have with simply
writing PERL. If Larry Wall said it and used it, why force a taboo of
writing it in short hand. It just makes no sense.
--
Gordon C. Etly
Email: perl -e "print q{}.reverse(q{moc.liamg@ylte.nodrog})"
------------------------------
Date: Wed, 09 Jul 2008 01:06:42 GMT
From: sln@netherlands.com
Subject: Re: FAQ 1.12 What's the difference between "perl" and "Perl"?
Message-Id: <kk3874998r06gfj8rocvb1o1ald5krnmjc@4ax.com>
On Tue, 8 Jul 2008 17:47:36 -0700, "Gordon Corbin Etly" <g.seesig@gmail.com> wrote:
>sln@netherlands.com wrote:
>> On Tue, 08 Jul 2008 23:06:39 GMT, sln@netherlands.com wrote:
>> > On Tue, 8 Jul 2008 14:45:33 -0700, "Gordon Corbin Etly" wrote:
>> > > Charlton Wilbur wrote:
>
>> > > > Practically, it marks people who use it as either clueless
>> > > > novices, who haven't yet encountered the FAQ, or as
>> > > > argumentative
>> > > > twits, who have encountered the FAQ and choose to argue usage
>> > > > instead of doing something more productive with everyone's time.
>
>> > > So are you saying that if one chooses to use the words of Larry
>> > > Wall
>> > > himself, they are clueless and a twit, all because an FAQ someone
>> > > wrote says otherwise? Do you mean to tell me an FAQ cannot be
>> > > wrong? Come on, you know better than that.
>
>> > PERL is not a standard, sanctioned by ANSI, it is not anything
>> > but an implemtation. The difference between PERL, Perl and perl is
>> > nothing whatsoever.. period!
>>
>> There is a uphamism used to represent a distribution, aka perl, with
>> the idealized mataphor Perl, as is the subject of this FAQ.
>
>True. And at the same time, you have a description, which comes from
>Larry Wall, the creator,
I don't think this guy is the CREATOR, there is only one.
> If Larry Wall said it and used it, why force a taboo of
>writing it in short hand. It just makes no sense.
Again, there is only one GOD, God or god...
sln
------------------------------
Date: Tue, 8 Jul 2008 21:52:48 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: FAQ 1.12 What's the difference between "perl" and "Perl"?
Message-Id: <slrng78a00.nnl.tadmc@tadmc30.sbcglobal.net>
Waylen Gumbal <wgumgfy@gmail.com> wrote:
> 2) So what is wrong with writing either of those expansions
> as "PERL" for short?
Because people will think less of you.
Telling people that they should not think less of those who
write PERL will not change their minds.
Seeing people who write PERL and who also know something about
Perl programming might change their minds.
Or, conversely, not seeing people who write PERL display a lack
of Perl programming skill might change that.
You cannot affect what people think "by decree".
They will make their own observations, and form their opinions from those.
If you want folks to stop thinking less of those who write PERL,
then consider how you might be able to influence what they observe.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Tue, 08 Jul 2008 23:38:47 GMT
From: sln@netherlands.com
Subject: Re: help with regular expression
Message-Id: <8ft774t813c6o1s2ood5pljatvcndtkndf@4ax.com>
On Tue, 8 Jul 2008 11:31:47 -0700 (PDT), doug <douglass_davis@earthlink.net> wrote:
>
>I am making a page to do a search.
>
>The syntax is, you may group words with double quotes.
>
>You may also add a + to signify a word must be present, or a - to
>signify it shouldn't be present. Each "phrase" is separated by spaces
>or commas.
>
That is a search criteria, you are using Perl meta characters to define your
needs, and they don't match.
Its all good though. If, for example, you define your own parser to process
the commands that are your private criteria. For example, if passed as a
string to a function that would parse it and apply a regex to another
string (file).
>So for example, all of these would be valid and can be combined by
>separating them with spaces:
>
>+"red blue"
>+orange
>purple
>-green
>"yellow red"
>
>Is there a way to split this or match this using a regular expression?
In essence, it would have to be parsed, based on rules, and a regex constructed
then applied to the object. There are a few ways to do this. Alot of or's.
By and large, the more content parsed will result in longer processing time.
It can be done in a single regex or within a loop, processing each individual.
The difference is, if you have to process individuals, you will still need
a case test on a single regex.
If however, you just want to qualify the object, a single regex for the combined
individuals is fine.
The advantage of constucting regex based on rules is that you can easily add
more control characters dynamically.
sln
------------------------------
Date: Tue, 8 Jul 2008 22:22:42 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: help with regular expression
Message-Id: <slrng78bo2.nnl.tadmc@tadmc30.sbcglobal.net>
doug <douglass_davis@earthlink.net> wrote:
>
> I am making a page to do a search.
>
> The syntax is, you may group words with double quotes.
What is your definition of a "word"?
I will assume \w+ is a "word".
> You may also add a + to signify a word must be present, or a - to
> signify it shouldn't be present. Each "phrase" is separated by spaces
> or commas.
>
> So for example, all of these would be valid and can be combined by
> separating them with spaces:
>
> +"red blue"
> +orange
> purple
> -green
> "yellow red"
>
> Is there a way to split this or match this using a regular expression?
----------------------------------
#!/usr/bin/perl
use warnings;
use strict;
$_ = '+"red blue" +orange purple -green "yellow red"';
my @phrases = /([+-]?(?:"[^"]*"|\w+))/g; # written more prettily below
print "$_\n" for @phrases;
----------------------------------
Also works even if they are NOT separated by spaces:
----------------------------------
#!/usr/bin/perl
use warnings;
use strict;
$_ = '+"red blue"+orange purple-green"yellow red"';
my @phrases = /([+-]? # optional sign
(?: # groups together either...
"[^"]*" # ... a quoted string
| # or
\w+ # a word
)
)/gx; # eXtended regular expressions are wonderful
print "$_\n" for @phrases;
----------------------------------
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Wed, 09 Jul 2008 02:46:32 GMT
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: Perl/Tk and Tk 8.5
Message-Id: <cEVck.190159$TT4.70634@attbi_s22>
[Cross-posted to comp.lang.perl.tk with follow-ups set to go there.]
Steve wrote:
> Is there any word on when the enhancements in Tk 8.5 (Tiles, themes,
> better-looking widgets) will be made available in the Perl/Tk port? I
> know that ActiveState has made some of this available for awhile in the
> "Tkx" module, but I'm interested in cross-platform support and am
> wondering when 8.5 will be incorporated in the base "Tk" port module.
Dunno. As Nick Ing-Simmons has passed away I don't know if there will
even be an 8.5 version of Perl/Tk. Slaven Rezic has been doing some
maintenance patches but I haven't had the impression that he (or anyone
else) is interested in doing continued development.
Personally, I've started using Tkx. That's partially because as of 5.10
ActiveState includes Tkx by default but no longer includes Perl/Tk. It's
also partially because I'm horribly sick of the Motif-style and really
wanted the native look available via tiles.
The transition hasn't been too painful -- Tkx is more similar to Perl/Tk
than I had expected. My main beef with it is a lack of good
documentation. Tkx is a thin layer over Tcl and you have to go to the
Tcl docs for almost everything. It can be a little challenging to
translate Tcl (which I don't know) into what you should do in Perl.
Sometimes even the Tcl documentation is sorely lacking.
I'm not terribly optimistic about the long-term prospects for Tkx,
though. Switching from Perl/Tk has been bearable but I can't imagine
trying to start with Tkx. ActiveState needs to put more into
documentation if they want it to catch on. They might not care, though,
as long as they can use it for their own tools (like PPM).
Isn't Tkx cross-platform? I've not tried it but I would expect it to be.
-mjc
------------------------------
Date: Tue, 8 Jul 2008 20:20:03 -0700 (PDT)
From: "++imanshu" <himanshu.garg@gmail.com>
Subject: Pugs versus Perl 6 on Parrot
Message-Id: <596987ef-125b-41c0-8e22-327d25139529@e39g2000hsf.googlegroups.com>
Hi,
Is it correct that there are two parallel(competing?) lines of
development for Perl6. One on Parrot and the other in Pugs? Or have I
got it all wrong.
Thanks,
HG
------------------------------
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 1703
***************************************