[12079] in Perl-Users-Digest
Perl-Users Digest, Issue: 5679 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 16 02:07:15 1999
Date: Sat, 15 May 99 23:00:16 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 15 May 1999 Volume: 8 Number: 5679
Today's topics:
Re: Hash arrays (Sam Holden)
Re: Hash arrays (Sam Holden)
Re: Hash arrays (Sam Holden)
Re: Hash arrays (Sam Holden)
How to use local variables in the package? <harris_m@yahoo.com>
Re: MS-HTML must die! (Ran)
Re: My script runs on win32, it won't run on Unix (Robert Watkins)
need elegant way to deal hand of cards in Perl <rjberman@mindspring.com>
opportunity in Boston-based internet start-up <girolamo@ix.netcom.com>
opportunity in Boston-based internet start-up <girolamo@ix.netcom.com>
Passing NULL pointer to Win32::API function (Diego Barros)
Re: Perl "constructors" (Arved Sandstrom)
Re: Perl "constructors" (Ilya Zakharevich)
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl "constructors" armchair@my-dejanews.com
Re: Perl "constructors" (Sam Holden)
Re: standard array and associative array (Larry Rosler)
Re: TROLL ALERT (Re: Perl "constructors") (Arved Sandstrom)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 May 1999 04:09:50 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Hash arrays
Message-Id: <slrn7jsh8e.49a.sholden@pgrad.cs.usyd.edu.au>
On Sat, 15 May 1999 11:27:18 GMT, armchair@my-dejanews.com wrote:
>In article <slrn7jpvfq.871.sholden@pgrad.cs.usyd.edu.au>,
> sholden@cs.usyd.edu.au wrote:
>> On Sat, 15 May 1999 04:02:06 GMT, armchair@my-dejanews.com wrote:
>> >In article <7hh47d$14q$1@nnrp1.deja.com>,
>> > John Porter <jdporter@min.net> wrote:
>> >> In article <7hh0nm$uqm$1@nnrp1.deja.com>,
>> >> armchair@my-dejanews.com wrote:
>> >> > How do I find out the number of elements in a hash array?
>> >> > Thanks
>> >>
>> >> perldoc perlfaq4: How can I know how many entries are in a hash?
>> >
>> >Can you add a function (a complement to exists() ) that does it? Then
>I
>> >can read about it in the part of books that talk about associative
>> >arrays, or better yet, in perlfunc.
>>
>> It's in perlfunc you idiot...
>>
>> =item keys HASH
>>
>> Returns a list consisting of all the keys of the named hash. (In a
>> scalar context, returns the number of keys.)
>>
>
>Thanks Sam. My "manual" is "Perl From the Ground Up" by Michael
>McMillan, and it leaves off the (In a scalar context, returns the
>number of keys).
The fact that you don't use the official manual that comes with perl
is not my problem. You mentioned perlfunc and claimed that adding
this stupid entries() function would mean that people could read
about it in perlfun. Since it is already documented in the perlfunc
documentation for keys that seems a little stupid me.
>But I probably would not have understood the "scalar
>context" part without an example. I certainly hope that my $scalar =
>@array; and my $scalar = keys(%hash) just return some internal count and
>especially in the case of the second one, do not actually do an
>intermediate step of creating an anonymous array.
So you would look in perldata to see what this scalar context thing is
all about. And it would explain it to you. If your still stuck you
would think, this must be a FAQ. And then you would have your example.
I don't care what you would hope keys in a scalar context does. I care
what it does. And I know what it does.
>
>
>> RTFM. RTFM. RTFM, in fact even better, go and learn python. Your brain
>is
>> not large enough to cope with perl.
>
>So true Sam, very small brain. But nature balances things out and I'm
>very large elsewhere. Is that why you guys seem so testy - jealousy?
I;m not jealous you can be assured of that. I just think you'd like python
much more, since it gives you much less freedom, and you seem to be scared
of freedom in a programming context.
--
Sam
Perl is the Cliff Notes of Unix.
--Larry Wall
------------------------------
Date: 16 May 1999 04:12:04 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Hash arrays
Message-Id: <slrn7jshck.49a.sholden@pgrad.cs.usyd.edu.au>
On Sat, 15 May 1999 11:29:47 GMT, armchair@my-dejanews.com wrote:
>In article <373c1e04@cs.colorado.edu>,
> tchrist@mox.perl.com (Tom Christiansen) wrote:
>> [courtesy cc of this posting sent to cited author via email]
>>
>> In comp.lang.perl.misc, armchair@my-dejanews.com writes:
>> :How do I find out the number of elements in a hash array?
>>
>> By reading or grepping the manpages, just like the rest of us. What
>part
>> of the standard Perl documentation included with each and every Perl
>> distribution did you happen to find less than clear on this matter?
>
>At the crime of repeating myself, I have been reading "Perl From the
>Ground Up" and "Teach Yourself Perl in 21 Days" and did not see any
>examples of discussion of how to get the number of items in a hash in
>their sections on hashes. I hope you can find it in your heart to
>forgive me for not looking at FAQ4, where the answer is most easily
>found.
Nope. Simple usenet politeness is to check the FAQ before posting.
It's true in every newsgroup. The FAQ exists for a reason. If you can't
find it in the FAq, then at least do a quick search at that place your
posting from to find your answer.
--
Sam
Fifty years of programming language research, and we end up with C++ ???
--Richard A. O'Keefe
------------------------------
Date: 16 May 1999 04:17:15 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Hash arrays
Message-Id: <slrn7jshmb.49a.sholden@pgrad.cs.usyd.edu.au>
On Sat, 15 May 1999 11:40:28 GMT, armchair@my-dejanews.com wrote:
>In article <ylwvya6ddk.fsf@windlord.stanford.edu>,
> Russ Allbery <rra@stanford.edu> wrote:
>> armchair <armchair@my-dejanews.com> writes:
>>
>> > Thanks. It seems a bit much, as all I really want to do is check to
>see
>> > if the hash has elements:
>>
>> Then test that. "if (%hash)".
>
>I believe I thanked you elsewhere for this tidbit.
>
>>
>> > Do they have a place to post requested enhancements to Perl?
>>
>> It's usually better to learn Perl first.
>
>I would definitely have to study real hard and long to find out that a
>hash name inside an if test returns 0 if the has is empty.
Other people read the manual that comes with perl before they start
asking other people questions. Now lets see I want to know how id
a hash has any elements in it... where would I find that. Probably
in perldata - the documentation of perl data types... Oh look ten seconds
later I see this on my screen :
If you evaluate a hash in a scalar context, it returns a
value that is true if and only if the hash contains any
key/value pairs.
Learn how to read, it will help your programming a lot.
>
>So you want a 20 year word processor user telling Corel how to make
>WordPerfect easier to use and not someone trying it for the first time?
No. The instructions are in the manual. You didn't bother reading the
manual. After you have read the manual feel free to make suggestions for
how it can be improved - that's what bug reports are for.
--
Sam
You can blame it all on the internet. I do...
--Larry Wall
------------------------------
Date: 16 May 1999 04:20:08 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Hash arrays
Message-Id: <slrn7jshro.49a.sholden@pgrad.cs.usyd.edu.au>
armchair@my-dejanews.com wrote:
>
>As long as $num_elements = keys(%hash) doesn't create a temporary
>intermediate array, I guess I am happy, as that syntax is no more
>confusing than $num_elements = @array;
So do some research and find out what it does. Or do you need to be
spoon fed everything...
--
Sam
In case you hadn't noticed, Perl is not big on originality.
--Larry Wall
------------------------------
Date: Sun, 16 May 1999 22:24:52 -0700
From: "Harris_M" <harris_m@yahoo.com>
Subject: How to use local variables in the package?
Message-Id: <7hlktr$bpt@sjx-ixn1.ix.netcom.com>
How do I define and access local variables in a package?
In the following example I want to create local variable in function doSave
shown as line -
$this->{$val} = $num;
Function doSave() is used by fun1() with in the package and will not be used
by
anyone declaring object examp.
Is there any way to define a local variable to this package which can hold
values
and can be used by member function like doGet() shown in the example below?
Thank you.
Harris
---------------------------------------------------------
Example -
#
# filename - examp.pm
#
package new;
sub new {
bless { } ; # create empty hash
}
sub fun1 {
my( $this, $key1 ,$var2) = @_ ;
doSave($key1,$var2);
}
sub doSave
my ($var, $num ) = @_;
print $var, "\n";
$this->{$var} = $num; # $var is $key1 and $num is $var2 from fun1
above
}
sub doGet {
my ($this,$myKey) = @_ ;
return $this->{$myKey};
}
1;
#end of package
------------------------------
Date: 16 May 1999 04:06:06 GMT
From: ran@netgate.net (Ran)
Subject: Re: MS-HTML must die!
Message-Id: <7hlg7e$eek$2@remarQ.com>
In <7hdff7$kfi@dfw-ixnews9.ix.netcom.com>, jhertzli@ix.netcom.com (Joseph Hertzlinger) writes:
>Microsoft apparently designs browsers
>that can be used with sites designed by the clueless.
Considering that that's their primary market, they pretty much have to.
Ran
------------------------------
Date: Sun, 16 May 1999 03:00:25 GMT
From: r-watkins@worldnet.att.net (Robert Watkins)
Subject: Re: My script runs on win32, it won't run on Unix
Message-Id: <7hlcco$57k$1@bgtnsc01.worldnet.att.net>
In article <7hks1s$lk9$1@nnrp1.deja.com>, lazersa@my-dejanews.com wrote:
>Hi,
>I have written a perl script based on a tutorial which I downloaded, in
>this tutorial, the author suggested i use win32 (Activeperl) to debug my
>perl scripts. The script runs without any glitches on a windows-based
>system. When I try it on a unix server, it just returns an error message
>- I do not have access to the log files, so i can't get any more
>information than that.
>
>Does anyone have any ideas as to why it won't run, or is there any Url
>where i can see the dfferences(or how to modify a script for unix)?
>
>Thanx
>
>Warren
>
My first guess would be that you either have not got the correct shebang on
the first line (#!/usr/bin/perl, or whatever the path to your Perl executable
is -- and you should probably have the -w and -T flags on for good measure),
or you don't have permission on the Unix box to run scripts (have you also
made sure your script is executable -- chmod 755 <yourscript> -- ?).
You might also try using
use CGI::Carp qw/fatalsToBrowser/;
so that error messages get sent to the browser itself, to help with debugging
(although the above issues have to be resolved before the thing can even
compile).
-- Robert
---------------------------------------------------
Robert Watkins
r-watkinsNO@SPAMworldnet.att.net
---------------------------------------------------
"These Perls of thought in Persian Gulfs were bred,
Each softly lucent as a rounded moon;"
-- James Russell Lowell
In a Copy of Omar Khayyam
------------------------------
Date: Sun, 16 May 1999 00:58:22 -0500
From: Bob Berman <rjberman@mindspring.com>
Subject: need elegant way to deal hand of cards in Perl
Message-Id: <373DCB34.E6C27B24@icehouse.com>
I'm trying to come up with a Perl routine to distribute data round robin into an
arbitrary number of "buckets". Like dealing a hand of cards when people are
coming and going from the table. I currently create an array of "n" empty array
refs and then iterate over that in a while loop and insert into each anon. array
in turn. It just seems kind of "brute" force to me. Does any one know of any
more Perlish type of way I could do this? This is purely for my own interest.
Thanks.
------------------------------
Date: Sat, 15 May 1999 23:07:28 +0000
From: Jerome Catalino <girolamo@ix.netcom.com>
Subject: opportunity in Boston-based internet start-up
Message-Id: <373DFE30.6216@ix.netcom.com>
We are an internet start-up in Boston in need of a web savvy programmer.
If you think you would be interested in working in a start-up for
equity and have the skills needed please contact me. We need someone to
operate a secure server incorporating digital signature protocols to
support credit card transactions. This person would also need to be
versed in web graphics (rotating gifs, etc.) and the general operations
of a commercial website.
Thank you for your time in reading this message.
------------------------------
Date: Sat, 15 May 1999 23:13:13 +0000
From: Jerome Catalino <girolamo@ix.netcom.com>
Subject: opportunity in Boston-based internet start-up
Message-Id: <373DFF89.4894@ix.netcom.com>
We are an internet start-up in Boston in need of a web savvy programmer.
If you think you would be interested in working in a start-up for
equity and have the skills needed please contact me. We need someone to
operate a secure server incorporating digital signature protocols to
support credit card transactions. This person would also need to be
versed in web graphics (rotating gifs, etc.) and the general operations
of a commercial website.
Thank you for your time in reading this message.
------------------------------
Date: Sun, 16 May 1999 05:48:51 GMT
From: alien@netspace.net.au (Diego Barros)
Subject: Passing NULL pointer to Win32::API function
Message-Id: <373e5b81.14291610@news.netspace.net.au>
I am trying to empty my recycle bin by using the SHEmptyRecycleBin()
function using Win32::API. How do I pass a NULL pointer parameter to
this function (the second parameter)? According to the docs for
SHEmptyRecycleBin() if it is NULL or an empty string then it will
empty all contents of the recycle bin. But in the code below setting
$null to an empty string ($null = "") does not work.
Regards,
Diego Barros
use Win32::API;
$SHEmptyRecycleBin = new Win32::API( "shell32", "SHEmptyRecycleBin", [
N, P, N ], N );
$null = ???;
$SHEmptyRecycleBin->Call( 0, $null, 0 );
$SHEmptyRecycleBin = undef;
------------------------------
Date: Sun, 16 May 1999 01:56:46 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: Perl "constructors"
Message-Id: <Arved_37-1605990156460001@dyip-106.chebucto.ns.ca>
In article <slrn7js8nd.d4q.sholden@pgrad.cs.usyd.edu.au>,
sholden@cs.usyd.edu.au wrote:
>
> It's documented in perlfaq8 which you should have read before posting, but
> you are obviously too stupid.
>
Hey, Sam, this is out of line. How about some basic human and also
professional courtesy?
Arved
------------------------------
Date: 16 May 1999 05:12:30 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl "constructors"
Message-Id: <7hlk3u$qlt$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Russ Allbery
<rra@stanford.edu>],
who wrote in article <ylpv414z0p.fsf@windlord.stanford.edu>:
> @->$record{array} would be more consistent, but I'm not sure if that's
> doable in the parser, and the use of the arrow there is a bit counter-
> intuitive.
I think this means
"Number of the last parenth matched in the last successful REx in
the scope is more or equal to $record{array}"
Ilya
------------------------------
Date: Sun, 16 May 1999 05:24:53 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hlkr4$4vt$1@nnrp1.deja.com>
In article <f9ljh7.gp4.ln@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> armchair@my-dejanews.com wrote:
> : In article <7uc%2.10345$L4.363390@news2.rdc1.on.home.com>,
> : andrew-johnson@home.com wrote:
>
> : > What makes you think that is what perl is doing?
>
> : Because the book I have - "Perl From the Ground Up" in it's built-in
> : function reference says that keys "returns all the keys for the Hash
> : named". It does not mention "scalar context" as some right honorable
> : fellow was nice enough to point out that the perlfunc does inside of
> : parenthese after stating the above regarding returning all the keys.
>
> Problems with a book are problems with the book, not with Perl.
>
> If you have problems with a book, contact someone connected
> with producing the book.
>
> The only reference that matters are the docs that come with perl.
>
> If you find a problem there, then mention it here.
>
> If you find a problem elsewhere then mention it elsewhere.
I think you need a hobby Tad.
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Sun, 16 May 1999 05:23:32 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hlkoj$4vk$1@nnrp1.deja.com>
In article <7hk10r$220$1@gellyfish.btinternet.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On Sat, 15 May 1999 13:16:43 GMT armchair@my-dejanews.com wrote:
> > In article <373d5fd9@cs.colorado.edu>,
> > tchrist@mox.perl.com (Tom Christiansen) wrote:
> >> In comp.lang.perl.misc, armchair@my-dejanews.com writes:
> >> :You cannot connect() with a
> >> :constructor and get a status code back from the connect() - you
get a
> >> :reference to the object just created whether your connection has
been
> >> :successful or not. This problem exists in C++ as well.
> >>
> >> You're wrong. That's not the way it works in Perl.
> >
> > Oh, and how does it work in Perl.
> > I have only seen examples where a Perl constructor returns a
reference
> > to a blessed variable which is a reference. Hence the syntax
> >
> > my $new_object = MyClass->Connect();
> >
> > if Connect() (your constructor) fails, we end up with a reference to
a
> > object that has not connected. With no idea that it failed at this
> > point.
> >
>
> Er. Of course one has an idea.
>
> my $new_object = MyClass->Connect() || die "Couldnt connect - ";
And just what is happneing in your "constructor". If we to look at the
last few lines, what, other than "bless $rSelf, $sClass;" would we see?
Again, I will repeat myself - if you look at Perl discussions of objects
they say a "constructor" returns a reference to the object. Are you know
suggesting that constructors should also return scalar number and/or
strings in the case of errors?
>
> Or whatever behaviour one might consider appropriate - if you had even
> spent a few seconds looking at Perl code you would have known this.
I am not sure what I should have known in a few seconds of Perl code
examination. Should I have known their is the unusual < > || < >
construct. And if, without the "if" that you would have in English. Or
should I have known that when you personally construct objects, you
don't always return a reference to the object you were supposed to
construct? (which is what I asked the other fellow, and he declined to
answer)
>
> But of course it is a prerequisite of the troll that they have no
> knowledge of the subject which they set upon.
But of course it is a prerequisite of a bigot that when anyone dares
query their religiously held beliefs that they resort to ad hominem
attacks.
>
> >
> > It appears that understanding Perl is a binary event. But the
question
> > is, what is <plonked>?
> >
>
> You have gained special status in the kill-files and filters of the
> majority of the frequent posters to this group meaning that your
> trolling will not be seen by those people.
After reading their pious, smug and condescending responses, I find it
a little bit difficult to fathom that you are suggesting that as a
negative.
>
> I do hope that everyone will follow suit.
I do hope that you will follow suit.
>
> *plonk*
Thanks
>
> /J\
> --
> Jonathan Stowe <jns@gellyfish.com>
> Some of your questions answered:
> <URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
> Hastings:
<URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
>
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Sun, 16 May 1999 05:26:22 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hlktt$58j$1@nnrp1.deja.com>
In article <slrn7js8rb.d4q.sholden@pgrad.cs.usyd.edu.au>,
sholden@cs.usyd.edu.au wrote:
> On Sat, 15 May 1999 12:42:58 GMT, armchair@my-dejanews.com wrote:
> >
> >Because the book I have - "Perl From the Ground Up" in it's built-in
> >function reference says that keys "returns all the keys for the Hash
> >named". It does not mention "scalar context" as some right honorable
> >fellow was nice enough to point out that the perlfunc does inside of
> >parenthese after stating the above regarding returning all the keys.
>
> So the book is wrong. Throw it out and buy 'Programming Python'.
I've got it! I was all pumped to learn Python until I saw that it had
the same thing I didn't like about Perl - a variable can hold either a
string or a number at any time.
>
> --
> Sam
>
> Many modern computer languages aspire to be minimalistic. They either
> succeed in being minimalistic, in which case they're relatively
useless,
> or they don't succeed in being truly minimalistic, in which case you
can
> actually solve real problems with them. --Larry Wall
>
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: 16 May 1999 05:46:35 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl "constructors"
Message-Id: <slrn7jsmtr.kl2.sholden@pgrad.cs.usyd.edu.au>
On Sun, 16 May 1999 05:26:22 GMT, armchair@my-dejanews.com wrote:
>In article <slrn7js8rb.d4q.sholden@pgrad.cs.usyd.edu.au>,
> sholden@cs.usyd.edu.au wrote:
>> On Sat, 15 May 1999 12:42:58 GMT, armchair@my-dejanews.com wrote:
>> >
>> >Because the book I have - "Perl From the Ground Up" in it's built-in
>> >function reference says that keys "returns all the keys for the Hash
>> >named". It does not mention "scalar context" as some right honorable
>> >fellow was nice enough to point out that the perlfunc does inside of
>> >parenthese after stating the above regarding returning all the keys.
>>
>> So the book is wrong. Throw it out and buy 'Programming Python'.
>
>I've got it! I was all pumped to learn Python until I saw that it had
>the same thing I didn't like about Perl - a variable can hold either a
>string or a number at any time.
I realise I've been rude and all that since you were driving me
mad. But in all seriousness if you don't like that a variable can
hold a string or a number and change during execution, then perl
probably isn't for you. The loosely typed nature of perl is considered
a feature, since it has some advantages, it won't change so if you
really can't stand it then use a different language. Python is
slightly stronger typed than perl, since it doesn't magically convert
things from strings to numbers and back all by itself...
--
Sam
Many modern computer languages aspire to be minimalistic. They either
succeed in being minimalistic, in which case they're relatively useless,
or they don't succeed in being truly minimalistic, in which case you can
actually solve real problems with them. --Larry Wall
------------------------------
Date: Sat, 15 May 1999 22:54:26 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: standard array and associative array
Message-Id: <MPG.11a7fd6b773bdf5a989a73@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7hkl6h$h2q$1@nnrp1.deja.com> on Sat, 15 May 1999 20:24:51
GMT, bing-du@tamu.edu <bing-du@tamu.edu> says...
> I need to write a sub routine that is able to handle both standard array
> and associative array.
>
> If the parameter passed in is a standard array, then convert it to some
> sort of associative array first and then continue processing. If the
> parameter passed in is already an associative array, then skip
> the conversion step and continue processing.
>
> My question is how to use if, while or whatever to differentiate a
> standard array from an associative array at the beginning of the sub
> routine?
The direct answer to your question is that you cannot in general
distinguish an array argument from a hash argument from within a
subroutine. An array is passed as a list comprising its elements in
sequence; a hash is passed as a list comprising its keys and values as
alternating pairs, in an arbitrary sequence.
That is why the code of mine that Michel Dalle quoted relies on
aggregates being passed by reference, not by value. From the reference,
you can determine the type of the aggregate.
The most effective way to convert an array to a hash is by means of a
hash slice.
my %hash;
@hash{@array} = (); # All values undefined.
@hash{@array} = ("") x @array; # All values null strings.
@hash{@array} = @array; # All values the same as the keys.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 16 May 1999 01:49:04 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: TROLL ALERT (Re: Perl "constructors")
Message-Id: <Arved_37-1605990149040001@dyip-106.chebucto.ns.ca>
In article <926819646.853143@thrush.omix.com>, zenin@bawdycaste.org wrote:
> Arved Sandstrom <Arved_37@chebucto.ns.ca> wrote:
> >snip<
> : But a fixed name for an object constructor ('new') is a feature of C++ and
> : Java, for example. Why should Perl be defiantly different?
>
> Following the same logic, why should it be the same?
>
Russ Allbery makes a good point that the "real" constructor is bless().
But there is a popular identification of the method wrapper as being the
constructor. So, in a sense, it *is* a constructor. And it's ensconced in
the Perl Cookbook, for example. So why not regard the method as such even
though the contained function is really the beast?
It should be the same just because it throws people off when you write
something like
$new_aberration = Text::Aberration->psychedelic(@args);
There's no sense in the method name that you just created an object.
> : More to the point, what's wrong with having a discussion over the issue?
>
> When it really is an "issue" we'll discuss it.
>
Well, I think it's an issue. Even if it only comes up as a line item to be
dismissed it's still an issue.
> : Just to put my 1.5 CAN cents on the table, I like the ability to call a
> : constructor anything, because sometimes "new" is not intuitive. But that's
> : just me.
>
> Welcome. You'll do well in Perl.
Yeah, well, I've been doing Perl since '94. So I happen to think that I'm
doing OK with this particular language, but I may be biased. :-)
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5679
**************************************