[26636] in Perl-Users-Digest
Perl-Users Digest, Issue: 8744 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 8 00:05:33 2005
Date: Wed, 7 Dec 2005 21:05:06 -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 Wed, 7 Dec 2005 Volume: 10 Number: 8744
Today's topics:
Re: [Noob] IPC <jurgenex@hotmail.com>
Re: A simple inheritance question. <abigail@abigail.nl>
Re: A simple inheritance question. <abigail@abigail.nl>
Re: javascript to perl converter? <no-spam@new.rr.com>
Removing duplicates with RegExp <NoSPam@NoSpam.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 08 Dec 2005 03:25:32 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: [Noob] IPC
Message-Id: <MINlf.3715$EB3.2529@trnddc09>
noob wrote:
> hi all,
> I'm new in this newsgroup and my english is very poor because I'm
> italian. I'm programming perl for 2 days and I'm still noob.
> My question is: how I can to launch a script that run a group of
> scripts in parallel running and waits until the last script has
> finished?
Quite straightforward if you are familiar with processes:
fork() as many child processes as you need, in each exec() to one of the
scripts that should run in parallel, and then the parent process just waits
until all the children are finished.
For further details please see
perldoc -f fork
perldoc -f exec
perldoc -f wait
jue
------------------------------
Date: 08 Dec 2005 00:01:04 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: A simple inheritance question.
Message-Id: <slrndpettv.ts1.abigail@alexandra.abigail.nl>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCDLXXXI
September MCMXCIII in <URL:news:dn6pql$fl1$1@mamenchi.zrz.TU-Berlin.DE>:
^^ Don Gatlin <invalid@nowhere.com> wrote in comp.lang.perl.misc:
^^ > On Tue, 06 Dec 2005 17:10:48 -0700, Scott Bryce wrote:
^^ >
^^ > > Don Gatlin wrote:
^^ > >> Got to get a book on actual POOP if one exists.
^^ > >
^^ > > Object Oriented Perl by Damian Conway
^^ >
^^ > Found it at Booksamillion online and it is coming. Not many books on Perl
^^ > oop available. Probably not enough room in the warehouses from the fifty
^^ > thousand C++ oop books in stock.
^^
^^ OOP remains a good book, but there are newer developments. Damian's
^^ newest opus _Perl Best Practices_ recommends inside-out objects as the
^^ standard object type. These are not (yet) mentioned in OOP. This may
^^ be relevant because your problem is at least partly related to data
^^ inheritance. Specifically, when and how are attributes (fields) of an
^^ ancestor class initialized?
^^
^^ Common wisdom is that Perl has no data inheritance, but that isn't quite
^^ true. The problem is that Perl doesn't *support* data inheritance in
^^ a meaningful way. If the parent class and the subclass are both hashes,
^^ and if you implement inheritance in the standard way (as in your example),
^^ there is *too much* data inheritance. The attributes of the subclass are
^^ in the same name space as those of the parent, an absurdity in the face of
^^ encapsulation. Inside-out objects give every class its own lexical name
^^ space, that is their fundamental merit.
Data inheritance with inside-out objects is relatively easy, and can be
controlled on an attribute by attribute bases. Instead of declaring your
attribute as:
my %attribute;
use:
our %attribute;
and the attribute is visible from other classes. A subclass can alias
any attributes it wants to inherit (and leave attributes it doesn't
want alone).
^^ You can learn about PBP's introduction to inside-out classes without
^^ (immediately) buying the book. The documentation of the CPAN module
^^ Class::Std is more or less identical to the relevant chapters from PBP.
I'd like to point out that Class::Std is a implementation of inside-out
objects, and IMO, not the best possible one. It loses on flexibility -
it practically forces 'Class::Std' on the entire inheritance tree, and
it makes it hard to do MI. The gain is a bit less typing, and it hides
some of the implementation of inside-out objects that people might find
difficult under the hood. But it gives back an API that may be perceived
as as difficult as what it's hiding.
I'm disliking Class::Std more and more.
Abigail
--
@;=split//=>"Joel, Preach sartre knuth\n";$;=chr 65;%;=map{$;++=>$_}
0,22,13,16,5,14,21,1,23,11,2,7,12,6,8,15,3,19,24,14,10,20,18,17,4,25
;print@;[@;{A..Z}];
------------------------------
Date: 08 Dec 2005 00:12:45 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: A simple inheritance question.
Message-Id: <slrndpeujt.ts1.abigail@alexandra.abigail.nl>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCDLXXXI
September MCMXCIII in <URL:news:dn6qfv$fl1$2@mamenchi.zrz.TU-Berlin.DE>:
%% <xhoster@gmail.com> wrote in comp.lang.perl.misc:
%% > Don Gatlin <DG@nowhere.com> wrote:
%% > > Let me see if I can explain the question in a way to be sensible.
%% > > The code is at the bottom.
%% > >
%% > > I build an Object1 and initalise it with some data with new();
%% > > I make an instance of it
%% >
%% > How can "build"ing it be a different step from making an instance of it?
%%
%% A strong case can be made to keep object creation and -initialization
%% apart in a well-built class. That would make these two different steps,
%% but making an instance would have to come first, "build"ing later.
%%
%% In fact, Class::Std makes this distinction, and the pre-defined name
%% for the initialization method is indeed ->BUILD.
No! It's very important to realize that Class::Std does NOT make this
distinction. Making the distinction is very important - any class that
doesn't (and the vast majority of Perl OO code doesn't) is hard to use in MI.
Now, Class::Std *appears* to make this distinction. However, since BUILD
is called from the constructor, the distinction is only superfluous; it's
nothing more than syntactical sugar.
Since a few years, I've only used inside-out objects to create classes.
And my classes only have a constructor if the class doesn't inherit
from a class that has a constructor. And if the class needs a constructor,
my constructor looks like:
sub new {bless \do {my $var} => shift}
That's all that needs to be present in the constructor - anything else
can't be related to constructing the object, and doesn't belong in a
constructor.
I initialize objects from an initializer, typically called 'init'.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
------------------------------
Date: Thu, 08 Dec 2005 02:51:02 GMT
From: "P. Thompson" <no-spam@new.rr.com>
Subject: Re: javascript to perl converter?
Message-Id: <Pine.LNX.4.63.0512072047080.20910@localhost.localdomain>
On Wed, 7 Dec 2005, John Bokma wrote:
>> B};eval(k("5553585A591C544F44524240514409030454181118110454181118110454
>
> Just replace the eval with something that prints the output of k, and
> presto. Seen this kind of "obfuscating" way too often. Waste of time and
> space, and doesn't work.
>
Yeah replacing document.write or eval with alert does the trick with the
easy ones. The ones which stump me are where there a formula or a nested
set of them applied to the string beyond or in place of JScript.Encode
to make it more of a pain.
---
Lord, protect me from those to whom you speak directly
All salute the new age, and I hope nobody escapes
------------------------------
Date: Wed, 7 Dec 2005 21:48:58 -0500
From: "Daniel Kaplan" <NoSPam@NoSpam.com>
Subject: Removing duplicates with RegExp
Message-Id: <1134010140.314325@nntp.acecape.com>
Hi All,
Was curious, is there a RegExp to remove duplicates? Am trying to remove
duplicate spaces (when they are together) and replace them with one space.
So that:
"This is my example of !"
Becomes:
"This is my example of !"
Thanks ahead.
------------------------------
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 8744
***************************************