[12092] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5692 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 17 03:07:14 1999

Date: Mon, 17 May 99 00:00:21 -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           Mon, 17 May 1999     Volume: 8 Number: 5692

Today's topics:
    Re: /usr/bin/perl vs /usr/local/bin/perl <mpersico@erols.com>
    Re: /usr/bin/perl vs /usr/local/bin/perl (Tim Smith)
    Re: Anyone know what's wrong? <ken@forum.swarthmore.edu>
        get date (Raymond Ip)
    Re: get date (Tad McClellan)
    Re: get date <aghaeim@genesis.co.nz>
    Re: Hash arrays armchair@my-dejanews.com
        how to perform other program input in Perl ? <gump_xu@sc.mcel.mot.com>
    Re: linkmanager database (brian d foy)
    Re: MacPerl (brian d foy)
    Re: opportunity in Boston-based internet start-up (brian d foy)
        Oracle...Perl...IIS <chetan_gautam@hotmail.com>
    Re: Perl "constructors" armchair@my-dejanews.com
    Re: Perl "constructors" (Sam Holden)
    Re: Perl "constructors" (Alan Curry)
    Re: Perl "constructors" <rra@stanford.edu>
    Re: Perl "constructors" <rra@stanford.edu>
    Re: Perl "constructors" (Arjun Ray)
    Re: perl script to check balanced (), {}, [], begin/end (Damian Conway)
    Re: Single Thread CGI (brian d foy)
    Re: Strange file reading problem <dlent1@uic.edu>
    Re: The Sendmail Program (brian d foy)
    Re: Using Apple's Sherlock plugins from perl (brian d foy)
        What does "qw" mean ? <ken@atlas.net.tw>
    Re: What does "qw" mean ? <ebohlman@netcom.com>
    Re: What does "qw" mean ? (Jim Britain)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 17 May 1999 00:25:48 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: /usr/bin/perl vs /usr/local/bin/perl
Message-Id: <373F9A4C.73AAC637@erols.com>

Or why not
#!/usr/bin/env perl -w

Then, as long as you have a proper PATH set, you'll never have to modify
it again.
Unless the script ends up on a brain-dead system...
You know what I mean.

Jonathan Stowe wrote:
> 
> On Sat, 15 May 1999 01:36:44 GMT Matthew Bafford wrote:
> >
> > perl -i -pe 's{^#!/usr/bin/perl}{#!/usr/local/bin/perl}' *.plx
> >
> 
> Except you left off the '-w' from the substitution ;-}
> 
> /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>

-- 
Matthew O. Persico
http://www.erols.com/mpersico
http://www.digistar.com/bzip2


------------------------------

Date: 16 May 1999 22:06:56 -0700
From: tzs@halcyon.com (Tim Smith)
Subject: Re: /usr/bin/perl vs /usr/local/bin/perl
Message-Id: <7ho85g$8eg$1@52-a-usw.rb1.blv.nwnexus.net>

What *should* happen is for everyone to make a "/interpreter" directory, and
in that directory put symbolic links to perl, bash, awk, and any other programs
people commony use with #!.  Scripts should then be distributed starting with
#!/interpreter/perl or #!/interpreter/bash or whatever.

--Tim Smith


------------------------------

Date: Mon, 17 May 1999 01:25:27 -0500
From: Ken Williams <ken@forum.swarthmore.edu>
Subject: Re: Anyone know what's wrong?
Message-Id: <170519990125271246%ken@forum.swarthmore.edu>

In article <7hk22i$sao$2@justice.csc.cuhk.edu.hk>, Austin Ming
<austin95002887@yahoo.com> wrote:
>I can not use the following perl codes to open, read and print all the files 
>in a directory.
>
>Anyone know what's wrong?
>or any better method to do ?
>
> 
>
>#!/usr/bin/perl
>print "Content-type: text/html\n\n";
>
>$basedir = "/progra~1/sambar41/cgi-bin/";
>@files = ('*.*');


The above line is the problem.  Check out the glob() function for a
drop-in fix.  Or better yet, check out the opendir() and readdir()
functions for a hint of a better & more common method.


>
>chdir($basedir);
>
>foreach $x (@files) {
>      open(FILE,"$x") || die "Couldn't open $x for reading.\n";
>      while(<FILE>){ print ; }
>        }
>}
>
>close(FILE);


------------------------------

Date: 17 May 1999 04:01:42 GMT
From: rwmip@glink.net.hk (Raymond Ip)
Subject: get date
Message-Id: <7ho4b6$rr2$1@unix2.glink.net.hk>

How do I get the current date and use it as a filename ??

eg 990517.log


Thanks and Best Regards


Raymond Ip


------------------------------

Date: Sun, 16 May 1999 19:18:02 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: get date
Message-Id: <anjnh7.rm6.ln@magna.metronet.com>

Raymond Ip (rwmip@glink.net.hk) wrote:

: How do I get the current date and use it as a filename ??

: eg 990517.log


   perldoc -f localtime


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Mon, 17 May 1999 17:22:00 +1200
From: Me <aghaeim@genesis.co.nz>
Subject: Re: get date
Message-Id: <373FA778.27052C70@genesis.co.nz>

Raymond Ip wrote:
> 
> How do I get the current date and use it as a filename ??
> 
> eg 990517.log
> 
> Thanks and Best Regards
> 
> Raymond Ip

you can use localtime() eg.

($sec,$min,$hr,$mday,$mon,$yr,$wday,$yday,$isdat)=localtime(time);
 ....
-- 

---------------------------------------------------------------------
Protect privacy, boycott Intel PIII: http://www.bigbrotherinside.org
---------------------------------------------------------------------


------------------------------

Date: Mon, 17 May 1999 03:45:07 GMT
From: armchair@my-dejanews.com
Subject: Re: Hash arrays
Message-Id: <7ho3c4$n10$1@nnrp1.deja.com>

In article <ic4mh7.b26.ln@magna.metronet.com>,
  tadmc@metronet.com (Tad McClellan) wrote:
> armchair@my-dejanews.com wrote:
>
> ---------------------
> #!/usr/bin/perl -w
> use strict;
> use Benchmark;
>
> my %hash;
>
> @hash{0 .. 100} = (1) x 100;
> timethese 2_000_000, { 100 => q{$num_elements = keys(%hash)}, };
>
> @hash{0 .. 100000} = (1) x 100000;
> timethese 2_000_000, { 100000 => q{$num_elements = keys(%hash)}, };
> ---------------------
>
> output:
>
> Benchmark: timing 2000000 iterations of 100...
>        100:  2 wallclock secs ( 1.77 usr +  0.00 sys =  1.77 CPU)
> Benchmark: timing 2000000 iterations of 100000...
>     100000:  2 wallclock secs ( 1.76 usr +  0.00 sys =  1.76 CPU)
>
>    Ten minutes of coding, and it is readily apparent that it
>    does not create an intermediate array. No source code reading
>    needed.

Thanks for the code. For some reason when I run it on a FreeBSD 3.0
system of unknown real memory I get:

Benchmark: timing 2000000 iterations of 100...
       100:  6 wallclock secs ( 3.34 usr +  0.00 sys =  3.34 CPU)
Out of memory!


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


------------------------------

Date: Mon, 17 May 1999 11:41:19 +0800
From: "Gump Xu" <gump_xu@sc.mcel.mot.com>
Subject: how to perform other program input in Perl ?
Message-Id: <7ho2tv$i7a$1@schbbs.mot.com>

Hi,
  Here is the scenario: (on SunOS 5.5)

I have a Perl program named "parser".
The "parser" will invoke another program named "setup".
The "setup" will prompt user to input a username.

I want the "parser" to input the username instead of a person via keyboard.
But I don't know how to do it via Perl.

Anyone can help me? please reply or cc to my email address:
a14203@email.mot.com

thanks,
---
Gump







------------------------------

Date: Mon, 17 May 1999 00:51:50 -0400
From: brian@pm.org (brian d foy)
Subject: Re: linkmanager database
Message-Id: <brian-ya02408000R1705990051500001@news.panix.com>

In article <7hl02e$o0t$1@nnrp1.deja.com>, mikes3790@my-dejanews.com posted:

> question: I want to write a linkmanager to manage
> links by topic, like yahoo. I want to be able
> to retrieve links in a hierarchal fashion like
> yahoo.
> 
> I'll be using MySQL. All i wanted was advice on
> the database scheme.

it might be worth reading a bit on database table design and
thinking through what you want to do with the data.  it's not
really a Perl thing though.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


------------------------------

Date: Mon, 17 May 1999 01:02:10 -0400
From: brian@pm.org (brian d foy)
Subject: Re: MacPerl
Message-Id: <brian-ya02408000R1705990102100001@news.panix.com>

In article <bsharvyNOSPAM-1605991617510001@dynip132.efn.org>, bsharvyNOSPAM@efn.org posted:

> I recently downloaded MacPerl 5.2. I can't quite figure out what you can,
> and cannot do with it. Could you, in theory, build applications like
> Clarisworks or Quake with it? Is it just for CGI work? If you can make
> full featured mac applictions with it, is there a book telling how?

it's not just for CGI, but i wouldn't build a Quake game with it.

there is a MacPerl book from Prime Time Freeware.  see 
<URL:http://www.macperl.com>

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


------------------------------

Date: Mon, 17 May 1999 00:58:19 -0400
From: brian@pm.org (brian d foy)
Subject: Re: opportunity in Boston-based internet start-up
Message-Id: <brian-ya02408000R1705990058190001@news.panix.com>

In article <373DFE30.6216@ix.netcom.com>, Jerome Catalino <girolamo@ix.netcom.com> posted:

> We are an internet start-up in Boston in need of a web savvy programmer.  

you might try the Boston Perl Mongers:  <URL:http://boston.pm.org>

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


------------------------------

Date: Mon, 17 May 1999 04:57:50 GMT
From: CHETAN <chetan_gautam@hotmail.com>
Subject: Oracle...Perl...IIS
Message-Id: <7ho7ke$pnl$1@nnrp1.deja.com>

Hi all,

  I am a new perl programmer and have setup of Perl and
Oracle installed on Windows NT ......

  I want to connect to Oracle thru Perl and access the
database....

  I have IIS webserver installed on NT also ... and I
dont know shall I configure it also for this..

  Any suggestions in this regard will be appreciated..

Chetan


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


------------------------------

Date: Mon, 17 May 1999 04:53:07 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7ho7bj$pkj$1@nnrp1.deja.com>

In article <yl675szafm.fsf@windlord.stanford.edu>,
  Russ Allbery <rra@stanford.edu> wrote:
> armchair <armchair@my-dejanews.com> writes:
>
> > An object in Perl can only contain one reference.
>
> No, I'm sorry, this simply isn't true.
>
> In Perl, an object *is* a reference.  It can *contain* anything you
> please, including as many references as you want to put
> in it, provided
> that it's a reference to an appropriate data structure.
> I realize that
> you're still very confused about this, but please stop
> repeating something
> that's utterly incorrect until you understand what people are
> trying to tell you.

Actually I don't think I am confused about it. This has to be a
semantical disagreement. I've made several objects, and some of which
have contained other objects as member data. And in each object, I only
have a reference, or as you put it - each one is a reference - but in
either case, it only refers to one thing. I have ONE reference pointing
to ONE data type. I can't bless two references, I can bless and return
one and only one (correct me is I am wrong). My reference can't point to
two data types, it can point to one and only one. At the highest level
of an object, there is only ONE thing. If you want to say the object is
the reference, not that an object contains a reference, then "inside",
the object/reference we only have one thing - the singular data type
that the reference refers to (or maybe it would be the address of the
datatype). So your object member data is then either a hash, an array or
a scalar. Sure you can put stuff inside them, lots of stuff, but that is
"inside them", not "alongside them". So you can have "lower levels" or
"multidimensions"  in your object, i.e. it can "be/refer to" a hash at
the top level, and then that hash can be references to hashes which
contain references to arrays. But at the top level, I can't have two
hashes referred to, or two scalars or two anything. The top level is
just one thing. A reference, or if you want to say the object is the
reference, then the top level of what an object contains is one thing -
whatever data structure the reference refers to. Or do you consider the
top level to be the items of the hash (or array) that is being pointed
to?

Question - if my program is:

#!/usr/bin/perl -w
@array = (1,2,3);
print @array;
exit;

Would you say my program contains 1 variable, or 3?

and if I changed the 2nd line to @array = (); would it have 1 or 0?


>
> > You were making a point that Perl has advantages over C++
> > by doing it
> > this way, and I was pointing out that in C++ you can do
> > it exactly like Perl.
>
> No, you can't.  You cannot create a blessed array in C++, for example.
> You can create an object with a bunch of overloaded operators
> that mostly,
> but not entirely, acts like an array except for the stuff that
> you forgot,
> but that's not the same thing.

In Perl a "blessed array" would be an object that contains/is a
reference to an array, correct? Why do you think that a C++ object
cannot contain an array as it's member data? The C++ object is the
reference and the array is what it contains, the data it refers to. I
don't see why you think it's different. I can say in Perl

push (@$my_object,1);    or $my_object->Push(1);
assumes method Push

but in C++ I can just as easily say (with the array member being public)

push (my_object.array,1);  or my_object.Push(1);
  assumes non-member function push and  member function Push

>
> > Create only one member variable, and have it be a
> > pointer (ala Perl) and
> > then have it point to a simple or complex data
> > structure. Name the
> > pointer "self", and then all the code that you look at
> > in the member
> > function referring to member data will look like
> > self->xxx, just like
> > Perl, only without the $.
>
> This is nonsense.  Perl passes its object pointer to its methods in
> precisely the same way that C++ does.  It just doesn't
> automagically put
> it in a variable named "this" for you; you can do that yourself
> or not as you choose.

Huh? The above remarks by me were in response to "in C++ you can't
easily tell the member data from the local or parameter data in long
methods whereas Perl by forcing you to dereference a reference to get to
the data makes it clear". And I said you can use m_ for member data, or
alternatively, have your class only contain a pointer that points to a
data structure, ala Perl. This pointer is member data, not the this
pointer. If we named that pointer, self, for instance, then in our
member functions (methods) all of the data of the object would stand out
ala Perl because we would have to refer to it as self->something.


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


------------------------------

Date: 17 May 1999 05:02:22 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl "constructors"
Message-Id: <slrn7jv8mu.epe.sholden@pgrad.cs.usyd.edu.au>

On Sun, 16 May 1999 20:55:53 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted and a courtesy copy sent.]
>
>In article <slrn7jud9q.3ab.sholden@pgrad.cs.usyd.edu.au> on 16 May 1999 
>21:14:34 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> says...
>> 
>> $return_code = my_func() && die $return_code;
>
>I'm afraid not, Sam.  Nothing gets assigned to $return_code if my_func() 
>returns a true value, because of the precedences.  You should write:
>
>  $return_code = my_func() and die $return_code;
>
>Several people have been skating around that problem in this thread, 
>using '||' instead of 'or'.  The ice finally cracked under you.  :-)

The sad thing is I actually had lots of doubts when I wrote it and
wrapped it in brackets for a second, and then strangely enough thought
it would work without them. When I test things they work forst time, when
I don't they fail. One day I'll go an entire 24 hour period without
making a huge error in a public forum - not today though ;)

Oh well maybe I'll just run and hide under the table...

-- 
Sam

So I did some research. On the Web, of course. Big mistake...
	--Larry Wall


------------------------------

Date: Mon, 17 May 1999 05:22:13 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Perl "constructors"
Message-Id: <9IN%2.8246$LP2.166257@news6.ispnews.com>

In article <ylbtfkzar3.fsf@windlord.stanford.edu>,
Russ Allbery  <rra@stanford.edu> wrote:
>Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
>> Russ Allbery <rra@stanford.edu> writes:
>>> Someone else wrote:

I'm the "Someone else"

>
>>>> If it's possible to implement sleep-and-retry with $^M, please tell me
>>>> how. The real $^M documentation is nonexistent as far as I can
>>>> tell. (perlvar refers to INSTALL, but there's nothing in there)
>
>>> Ilya would probably be the expert on that, but I don't think there's a
>>> way of doing that with that mechanism.
>
>> Why?  What makes it impossible to sleep and retry?  I'm not sure that
>> *re*allocation of $^M is allowed right now, but at least you may try it
>> *once*.  And if it not allowed, anyone interested may allow it spending
>> a couple of minutes.
>
>Aha... it throws an exception.  Sorry, I wasn't reading the documentation
>correctly.  Cool.

I still have no idea what you're talking about. Is there an actual example of
a program that handles an ENOMEM that I can look at? What I'm seeing so far
is some hints that maybe it might be allowed someday, but no real
instructions on how to use it.
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


------------------------------

Date: 16 May 1999 23:33:09 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl "constructors"
Message-Id: <ylaev4xl22.fsf@windlord.stanford.edu>

armchair <armchair@my-dejanews.com> writes:

> My reference can't point to two data types, it can point to one and only
> one. At the highest level of an object, there is only ONE thing. If you
> want to say the object is the reference, not that an object contains a
> reference, then "inside", the object/reference we only have one thing -
> the singular data type that the reference refers to (or maybe it would
> be the address of the datatype). So your object member data is then
> either a hash, an array or a scalar.

Okay, I see what you're saying.

I submit to you that in this view of the world, all C++ objects are
structs.  A C++ object can only be one struct.  It can't be an int, it
can't be an array, it has to be a struct.  Inside the struct, you can put
whatever you want, but you're stuck with a struct as the data type for
your object.

Does that make more sense and explain where I'm coming from when I argue
that Perl isn't really different than C++ here, *except* in the fact that
you can have arrays and other stuff too?

> In Perl a "blessed array" would be an object that contains/is a
> reference to an array, correct? Why do you think that a C++ object
> cannot contain an array as it's member data?

A C++ object with an array as member data is equivalent to a Perl object
built around a hash, with a hash key that contains an array.  In C++,
you're still stuck with the struct at the outermost level.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


------------------------------

Date: 16 May 1999 23:38:31 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl "constructors"
Message-Id: <yl7lq8xkt4.fsf@windlord.stanford.edu>

Alan Curry <pacman@defiant.cqc.com> writes:

> I still have no idea what you're talking about. Is there an actual
> example of a program that handles an ENOMEM that I can look at? What I'm
> seeing so far is some hints that maybe it might be allowed someday, but
> no real instructions on how to use it.

>From what I can tell from the documentation, which I agree is very sparse,
if you set $^M to be a large enough buffer that Perl can survive on it, an
operation that causes your program to run out of memory will throw an
exception just as if you'd called die().  You can catch that exception
with eval {} and do what you want with it.

I'm sure someone will correct me if I'm reading the documentation wrong.
Hopefully someone will also clarify the documentation.  :)

I think you may also have to compile Perl with a particular option flag in
order to get this behavior.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


------------------------------

Date: 17 May 1999 01:55:12 -0500
From: aray@nmds.com (Arjun Ray)
Subject: Re: Perl "constructors"
Message-Id: <37cfb034.2609401360@news1.newscene.com>

In <7ho7bj$pkj$1@nnrp1.deja.com>, armchair@my-dejanews.com wrote:
| In article <yl675szafm.fsf@windlord.stanford.edu>,
|   Russ Allbery <rra@stanford.edu> wrote:
| > armchair <armchair@my-dejanews.com> writes:
| >
| > > An object in Perl can only contain one reference.
| >
| > No, I'm sorry, this simply isn't true.
| >
| > In Perl, an object *is* a reference.  It can *contain* anything
| > you please, [etc]

Might it have been clearer to say "the referent" rather than "it"?

| This has to be a semantical disagreement.

Possibly. "What is an object?"

For Perl, the perlobj page says quite categorically:

       1.  An object is simply a reference that happens to know
           which class it belongs to.

This is quite distinct from the C++-ish view that an object is an
instantiation of a class definition (in turn a C-struct on steroids.)

| I have ONE reference pointing to ONE data type. 

A *Perl* data type: scalar, array, hash, etc.

| My reference can't point to two data types,

It doesn't need to, when it can point to something which can contain
as many "data types" as you please. (And, as it happens, there's a cat
lurking in the bag here. It's called 'typeglob'.) 

| At the highest level of an object, there is only ONE thing. If you
| want to say the object is the reference, not that an object contains
| a reference, then "inside", the object/reference we only have one
| thing - the singular data type that the reference refers to (or
| maybe it would be the address of the datatype).

It really sounds like you're asking why Perl doesn't have a direct
*syntactic* congruent of structs. It doesn't need them. 

| So your object member data is then either a hash, an array or a
| scalar.

Or any combination, depending on what the object's "native data type"
is (i.e. the data type on dereferencing the reference.)

I think your use of "member data" indicates your (futile) search for a
struct, as only a struct can satisfy your preconception of "object".
Perl has aggregate "data types" such as arrays, hashes, and typeglobs.
Most objects are indeed one of these types "at the top level", simply
because that's all you need to script at Perl's level of abstraction.
Looking for a linear collection of named ints and chars and floats and
the like ('member data') is simply Not Getting It.

| The top level is just one thing. A reference, or if you want to say
| the object is the reference,

It just simply is.

| then the top level of what an object contains is one thing - whatever
| data structure the reference refers to.

Yes, replacing "contains" with "consists of". What exactly is the
difficulty with that?

| Question - if my program is:
| 
| #!/usr/bin/perl -w
| @array = (1,2,3);
| print @array;
| exit;
| 
| Would you say my program contains 1 variable, or 3?

One named variable ('array'.)
 
| and if I changed the 2nd line to @array = (); would it have 1 or 0?

No change.

| > You cannot create a blessed array in C++, for example. You can
| > create an object with a bunch of overloaded operators that mostly,
| > but not entirely, acts like an array except for the stuff that
| > you forgot, but that's not the same thing.
| 
| In Perl a "blessed array" would be an object that contains/is a
| reference to an array, correct?

Correct. That array can subsequently be manipulated as just an array
if you like: that is, all operations which make sense for an array are
still possible regardless of the "objectness". 

| Why do you think that a C++ object cannot contain an array as it's
| member data?

It can, but you can't use the object *syntactically* as you would or
could any garden-variety array, without also defining a whole bunch of
operator overloadings. That was Russ' point.

| The C++ object is the reference

To a *struct*, not an array. In C++, objects are structs necessarily,
because that is the only "top level" mechanism available to aggregate
'member data'.

| and the array is what it contains, the data it refers to. I don't see
| why you think it's different.

Because there's no struct-like data structure intervening, as there is
in C++.



:ar


------------------------------

Date: 17 May 1999 04:29:16 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: perl script to check balanced (), {}, [], begin/end, etc
Message-Id: <7ho5us$7up$1@towncrier.cc.monash.edu.au>

In article <7hn7b7$oeb$1@sunburst.ccs.yorku.ca>,
  friendly@hotspur.psych.yorku.ca (Michael Friendly) wrote:
> Looking for a perl script to read a text file and check for any of a
> series of balanced strings, posibly nested, including character pairs
> like (), {}, [], and strings like begin/end, do/end, etc.

Check out the Text::Balanced module. 

Damian


------------------------------

Date: Mon, 17 May 1999 00:56:55 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Single Thread CGI
Message-Id: <brian-ya02408000R1705990056550001@news.panix.com>

In article <373EB821.2F749232@narfum.org>, Karel Bemelmans <corn@narfum.org> posted:

> I have a MessageBoard written in perl. It's a modification of Matt
> Wright's WWWBoard. The script simple generates html pages and updates a
> msglist.html file where an index is kept of all the messages posted.
> Posting and reading works fine, but when 2 users try to post at the same
> time, things get screwed up with the msglist.html file and the counter
> of a new message.
> 
> I tried to fix those problems by making use of a lock file that is set
> when the script starts and released when it's finished, but that didn't
> help.

that's only one of teh problems that need to be fixed before that 
script will do what it promises.

why jump through hoops to keep using a badly-coded and broken script? 
once you solve that problem, there will be another, then another, and
so on.

find something that works.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


------------------------------

Date: Sun, 16 May 1999 23:09:47 -0500
From: David Lent <dlent1@uic.edu>
Subject: Re: Strange file reading problem
Message-Id: <373F968B.7E9@uic.edu>

I'm using the -w but it's not giving any info. about this problem.  I've noticed something even stranger now. 
 If I use: 
$var=<NEWFILE>;
print "$var";

it prints the First part of the file.

If I use:
print <NEWFILE>;
it prints the Second part of the file.  This is one of the strangest things I've ever seen.  


Jonathan Feinberg wrote:
> 
> David Lent <dlent1@uic.edu> writes:
> 
> > unless(open(NEWFILE, "$adVar.ad")) {
> >       die("$file could not be opened for r");
> >       }
> 
> This is a bit awkward.  The idiom is
> 
>   open(NEWFILE, "$adVar.ad")
>      || die "Can't open $adVar.ad for read: $!\n";
> 

> 
> I don't believe that the code you've shown us is exactly what's in
> your script!  The code, as written, will indeed print the contents of
> the whole file.  What switches are on the shebang line?  Did you
> remember to use -w?
> 
> --
> Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
> http://pobox.com/~jdf


------------------------------

Date: Mon, 17 May 1999 01:01:52 -0400
From: brian@pm.org (brian d foy)
Subject: Re: The Sendmail Program
Message-Id: <brian-ya02408000R1705990101520001@news.panix.com>

In article <373f9337.0@wznews.webzone.net>, "Wassim Metallaoui" <wassimk@iname.com> posted:

> Can anyone tell me what
> 
> open (MAIL, "|$mailprog -t")
> 
> does? I am wondering about the pipe and the -t

see the open() docs (perldoc -f open) to read about the pipe, and
the docs for whatever $mailprog holds to see what -t does. :)

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


------------------------------

Date: Mon, 17 May 1999 00:47:54 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Using Apple's Sherlock plugins from perl
Message-Id: <brian-ya02408000R1705990047540001@news.panix.com>

In article <7hl302$ps2$1@nnrp1.deja.com>, mrowell@my-dejanews.com posted:

> I would like to be able use Apple's Sherlock plugins to conduct searches
> of the major internet search engines from within perl.

see Clinton Wong's Sherlock thingy. Search reference.perl.com for
MacOS 8.5 Sherlock, or see his page for it:

    http://postmaster.net/~clintdw/perlref-sherlock.html

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


------------------------------

Date: 17 May 1999 04:59:27 GMT
From: Ken Hu <ken@atlas.net.tw>
Subject: What does "qw" mean ?
Message-Id: <373FA2CD.4F346EFE@atlas.net.tw>

   Hi :

       As you can see , I am a newbie...

       My question is :

                    use CGI qw(-any) ;

       What does "qw" mean ?? Is it a reserved word of Perl ??

       Thanks a lot !!

                            Ken @ Taipei



------------------------------

Date: Mon, 17 May 1999 06:15:56 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: What does "qw" mean ?
Message-Id: <ebohlmanFBv5EK.G1M@netcom.com>

Ken Hu <ken@atlas.net.tw> wrote:
:        As you can see , I am a newbie...

Perl comes with excellent denewbifying resources.

:        My question is :

:                     use CGI qw(-any) ;

:        What does "qw" mean ?? Is it a reserved word of Perl ??

It's an operator.  Specifically, it's a quoting operator.  Operators are 
documented in the perlop (man page | HTML document | POD file) that came 
with your copy of Perl.  Quoting operators are documented in a subsection 
of perlop called, believe it or not, "quote and quote-like operators."  
You now know where to look.



------------------------------

Date: Mon, 17 May 1999 06:33:05 GMT
From: jbritain@home.com (Jim Britain)
Subject: Re: What does "qw" mean ?
Message-Id: <373fb619.20853868@news>

On 17 May 1999 04:59:27 GMT, Ken Hu <ken@atlas.net.tw> wrote:

>       As you can see , I am a newbie...
>       My question is :
>           use CGI qw(-any) ;
>       What does "qw" mean ?? Is it a reserved word of Perl ??

It is a Perl function classified as an operator.

Generalized quotes for building quoted lists.

instead of ( "one", "two", "three" )

with all the trouble of typing, and getting the quotes and commas
right..

qw( one two three);

not so much trouble with only three items, when the list of items is
20 or thirty, it makes a significant difference.

There are other quote operators -- q() qq() qx() and more..

use; "perldoc perlop".  for a more indepth description.

In addition, the protection provided with qx() is significant (but I
suspect much beyond where you are now).






------------------------------

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 5692
**************************************

home help back first fref pref prev next nref lref last post