[12088] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5688 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 16 16:07:14 1999

Date: Sun, 16 May 99 13:00:19 -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           Sun, 16 May 1999     Volume: 8 Number: 5688

Today's topics:
    Re: ANNOUNCE: DocNav 0.02 - Navigating the Perl Documen (Peter Rowell)
    Re: Baffled... uninitialized value at (eval 2) line 1. (Tad McClellan)
    Re: Baffled... uninitialized value at (eval 2) line 1. <gellyfish@gellyfish.com>
    Re: Can someone tell me why this 'require' wont work (Larry Rosler)
        can't install PDL-2.0 with perl 5.005_56 (markus)
    Re: FAQ 4.40: How can I tell whether a list or array co (Larry Rosler)
        Is Perl suitable for this? phild@sancerre.demon.co.uk
    Re: man pages and FAQs: why posted? <tchrist@mox.perl.com>
        Newbie: HTTP_HOST / Redirect? (Joe)
    Re: open, read,then print a file <dgris@moiraine.dimensional.com>
    Re: Perl "constructors" <gellyfish@gellyfish.com>
    Re: Perl "constructors" (Ilya Zakharevich)
    Re: Perl "constructors" chris+usenet@netmonger.net
    Re: Perl "constructors" chris+usenet@netmonger.net
    Re: Perl "constructors" armchair@my-dejanews.com
    Re: Perl "constructors" armchair@my-dejanews.com
        perl script to check balanced (), {}, [], begin/end, et (Michael Friendly)
    Re: PERLFUNC: lock - get a thread lock on a variable, s (Larry Rosler)
    Re: print to STDOUT and a file at the same time? <stampes@xilinx.com>
        regular expression ? tvn007@my-dejanews.com
    Re: regular expression ? <swarren@www.wwwdotorg.org>
    Re: Saving regularly a web page ajs@ajs.com
        Sorting of array of hashes. (Charles R. Thompson)
    Re: TROLL ALERT (Re: Perl "constructors") armchair@my-dejanews.com
    Re: Where can i download a complete perl reference? (Michel Dalle)
    Re: Where can i download a complete perl reference? <swarren@www.wwwdotorg.org>
    Re: Where can i download a complete perl reference? <gellyfish@gellyfish.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 16 May 1999 12:22:05 -0700
From: thirdeye@sonic.net (Peter Rowell)
Subject: Re: ANNOUNCE: DocNav 0.02 - Navigating the Perl Documentation
Message-Id: <7hn5st$7ll@bolt.sonic.net>

I hate following up my own posts :-(

In article <7hkdgh$c3g@bolt.sonic.net>,
Peter Rowell <thirdeye@sonic.net> wrote:
>
>Download either file and unpack it in the desired parent directory.
>It will unpack into a new subdirectory named "docnav".
>
>    http://www.thirdeye.com/~thirdeye/docnav/docnav.zip
>    http://www.thirdeye.com/~thirdeye/docnav/docnav.tar.gz

I was wondering why there were zero comments (good, bad or otherwise).
Then I checked the links and ... I forgot that the filenames had the
rev number in them.  Sigh.

The above links now work OR you can download from the following:
    http://www.thirdeye.com/~thirdeye/docnav/docnav-0_02.zip
    http://www.thirdeye.com/~thirdeye/docnav/docnav-0_02.tar.gz


    This time for sure! :-)
    Peter
    peter@thirdeye.com


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

Date: Sun, 16 May 1999 09:26:06 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Baffled... uninitialized value at (eval 2) line 1.
Message-Id: <e1hmh7.ja6.ln@magna.metronet.com>

Charles R. Thompson (design@raincloud-studios.com) wrote:
: I've never encountered this error before and it's confusing me because it 
: doesn't seem to point me to anything helpful... 


   The warning is from the first line of the second eval()
   in your program.

   Somewhere, whether in your code or the code of a module that
   you are using, you are doing eval()s (or equivalent, such as s///e).


: I'm using -w and strict, 
: the first line in my script is the path to perl. I've gone through my 
: script over and over.. I cannot find a variable that I haven't declared 
: with or initialized without a 0 or ''. This is the *only* error generated 
: in my script.

: What exactly does this error mean, and where should I begin looking to 
: understand what is generating it?


   Chase eval() calls.

   This is one of the few times where I might turn to the perl
   debugger rather than my usual low-tech approach of adding
   print statements :-)


: Use of uninitialized value at (eval 2) line 1.


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


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

Date: 16 May 1999 20:16:47 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Baffled... uninitialized value at (eval 2) line 1.
Message-Id: <7hn93f$40p$1@gellyfish.btinternet.com>

On Sun, 16 May 1999 17:58:07 GMT Charles R. Thompson wrote:
> I've never encountered this error before and it's confusing me because it 
> doesn't seem to point me to anything helpful... I'm using -w and strict, 
> the first line in my script is the path to perl. I've gone through my 
> script over and over.. I cannot find a variable that I haven't declared 
> with or initialized without a 0 or ''. This is the *only* error generated 
> in my script.
> 
> What exactly does this error mean, and where should I begin looking to 


I'd look at your input data first ....

/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>


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

Date: Sun, 16 May 1999 12:19:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Can someone tell me why this 'require' wont work
Message-Id: <MPG.11a8ba039a17798e989a7b@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <e61wgH8n#GA.52@cpmsnbbsa05> on Sun, 16 May 1999 13:29:40 -
0400, Mike <mike-carter@email.msn.com> says...
> 
> New code that does not work
> 
> $url_path = $ENV{SERVER_NAME};   #get the url
> $url_path =~ s/ //;   #remove any spaces, probably not necessary
> $url_path = "'/disk02/$url_path/htdocs/cgi-bin/shop.cfg'";  #create the
               ^                                         ^
Those single-quotes are not part of the pathname.  Kill them!

> require string
> require $url_path;
> 
> 
> old code that did work
> 
> require '/disk02/zenmuzik.com/htdocs/cgi-bin/shop.cfg';

The single-quotes are not part of this pathname either.  They just 
delimit the string, which the double-quotes do in the new code above.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 16 May 1999 19:26:31 GMT
From: drbrain@ziemlich.org (markus)
Subject: can't install PDL-2.0 with perl 5.005_56
Message-Id: <slrn7ju6v7.jso.drbrain@josefine.ben.tuwien.ac.at>

	Upon compiling i get the folowing errors :

egcc -c  -D_REENTRANT -Dbool=char -DHAS_BOOL -I/usr/local/include -O6
-DVERSION=\"2.0\" -DXS_VERSION=\"2.0\" -fpic
-I/home/mfischer/perl5.005_56/lib/5.00556/i686-linux-thread-multi/CORE
-DPDL_PTHREAD Core.c
Core.xs: In function `XS_PDL_get_trans':
Core.xs:111: `sv_undef' undeclared (first use in this function)
Core.xs:111: (Each undeclared identifier is reported only once
Core.xs:111: for each function it appears in.)
Core.xs: In function `XS_PDL_upd_data':
Core.xs:622: `na' undeclared (first use in this function)
make[2]: *** [Core.o] Error 1

	I compiled perl5 with threading and egcc. Any hints what to do would
be very appreciated.

sincerly,
	Markus


-- 
(0-    OpenSource
//\    join the revolution                            drbrain@gegen.kindersex.de
v_/_                                           http://drbrain.gegen.kindersex.de
                       gib Krieg, Rassismus und Gewalt gegen Kinder keine Chance


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

Date: Sun, 16 May 1999 12:26:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 4.40: How can I tell whether a list or array contains a certain element?
Message-Id: <MPG.11a8bbc73060bce989a7c@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <373f009a@cs.colorado.edu> on 16 May 1999 11:30:02 -0700, Tom 
Christiansen <perlfaq-suggestions@perl.com> says...
 ... 
>         @blues = qw/azure cerulean teal turquoise lapis-lazuli/;
>         undef %is_blue;
>         for (@blues) { $is_blue{$_} = 1 }
 ...
> 
>         @primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31);
>         undef @is_tiny_prime;
>         for (@primes) { $is_tiny_prime[$_] = 1; }

How boring.  :-)  Why not write this one as:

          @istiny_prime[@primes] = (1) x @primes;

Give 'slices' a chance!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Sun, 16 May 1999 19:27:30 GMT
From: phild@sancerre.demon.co.uk
Subject: Is Perl suitable for this?
Message-Id: <7hn670$47j$1@nnrp1.deja.com>

Hi,

Before I go and learn Perl I was wondering whether anyone could tell me
whether it is suitable for the application I need to write. I'm not
particularly knowledgable about web-programming, but I am a programmer.

The application I want to make is to nagivate a tree structure to an
eventual leaf. On the screen, at the top level, will be the root nodes
and, as you click one, it brings up that category's children. As you
progress down the tree the categories will help you to 'zoom in' on
what you want to select and, finally, it will lead to the leaf. On
choosing a leaf, a 'search engine' will look through a list of leaves
and their associated possibilities and display a list of links. The
leaves and links will be stored in a 'database' where a leaf can be
associated with a link.

I would like this application to be dynamic in the way that I can
update text files and it will produce different categories etc..

I have seen this what is basically this application up and running on
the 'net somewhere, but I can't remember where, and don't know what
they programmed it in. Might it have been Perl, do you think?

Thanks in advance,


Phil

P.S I'd prefer direct email, if that's OK. CC the group, of course, if
you want to. Thanks.


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


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

Date: 16 May 1999 12:03:16 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: man pages and FAQs: why posted?
Message-Id: <373f0864@cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Rick Delaney <rick.delaney@home.com> writes:
:As Larry said, it is appreciated.  Is there something we (the clpm
:community) can do to help you out?  

Yes: simply mail as well as post.

--tom
-- 
If you want your program to be readable, consider supplying the argument.
            --Larry Wall in the perl man page 


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

Date: Sun, 16 May 1999 10:45:38 -0800
From: Joa@inc.com (Joe)
Subject: Newbie: HTTP_HOST / Redirect?
Message-Id: <Joa-1605991045390001@haines-du-01-05.seaknet-dom.alaska.edu>

Hello,

I'm trying to create a simple script to check the HTTP_HOST and load the
appropriate web page.  (I have several different domains pointing to the
same server.)  The following script should work according to my minimal
understanding of Perl, but regardless of what HTTP_HOST equals, it always
loads http://aksell.com.  Can anyone tell me what I'm doing wrong?

################## Redirect.cgi Begin ####################
#!/usr/bin/perl

$domain=$ENV{'HTTP_HOST'};

print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>..</TITLE>";

if (($domain=="aksell.com") || ($domain=="www.aksell.com")) { print "<META
HTTP-EQUIV=\"refresh\"
CONTENT=\"0;url=http://www.aksell.com/index.html\">"; }

elsif (($domain=="alaskanweb.net") || ($domain=="www.alaskanweb.net")) {
print "<META HTTP-EQUIV=\"refresh\"
CONTENT=\"0;url=http://www.alaskanweb.net/index.html\">"; }

#else DEFAULT

print "</HEAD>";
print "<BODY></BODY></HTML>";
################## Redirect.cgi End ######################


*NOTE* - please send me a copy of your reply via email, as my news server
is unreliable at best.

                                                      -Jeremy
                                                   jeremy@alaskanweb.net
                                                   http://alaskanweb.net/

{}{}{} Posted via Uncensored-News.Com, http://www.uncensored-news.com {}{}{}
{}{}{}{} Only $7.95 A Month, - The Worlds Uncensored News Source {}{}{}{}


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

Date: 16 May 1999 13:32:21 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: open, read,then print a file
Message-Id: <m34slc24l6.fsf@moiraine.dimensional.com>

armchair@my-dejanews.com writes:

> In article <7hj78o$atj$2@justice.csc.cuhk.edu.hk>,
>   austin95002887@yahoo.com (Austin Ming) wrote:
> >
> > How to open, read,then print a text.txt file to the browser in current
> > dierectory ?
> >
> >
<snip code that doesn't solve the requested problem>

I don't think so.  What you posted doesn't satisfy the
request at all.  If you are going to waste your time
handing out code to people who don't read the docs the
least you can do is give them the right code.  Keeps
them from coming back and bothering us with dumb question
in the future.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
`There are no stupid questions, just stupid people.'
    South Park


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

Date: 16 May 1999 13:31:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl "constructors"
Message-Id: <7hmhbv$3s4$1@gellyfish.btinternet.com>

On 16 May 1999 07:47:30 GMT Sam Holden wrote:
> 
> Too much topmind exposure on my part I guess...
> 

Actually I think that it might *be* topmind - all the signs are there:

the quoting of the signatures,  the determined persistence to maintain
a poinless thread, the desire to shoe-horn Perl into some other languages
straight jacket, the anonymity ...

I want to see his 'manifesto'.

/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>


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

Date: 16 May 1999 18:51:13 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl "constructors"
Message-Id: <7hn431$5vl$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Russ Allbery 
<rra@stanford.edu>],
who wrote in article <yld8011he1.fsf@windlord.stanford.edu>:
> > 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.

Ilya


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

Date: 16 May 1999 19:22:30 GMT
From: chris+usenet@netmonger.net
Subject: Re: Perl "constructors"
Message-Id: <7hn5tm$8on$1@schenectady.netmonger.net>


In article <yllnep1kdh.fsf@windlord.stanford.edu>,
Russ Allbery  <rra@stanford.edu> wrote:
> Er, why on earth would you write it that way in Perl?
> 
> sub first_line {
>    my $filename = shift;
>    open (FILE, $filename) or return undef;
>    return <FILE>;
> }
> print first_line ('filename');
> 
> That will return the first line of the given file, undef on failure to
> open the file, and the empty string if the file is empty.  You'll find
> that all of the possible cases are well-defined.  If you want to know why
> the file couldn't be opened, the reason will be in $!.

Unfortunately, you just gave a pretty decent example of how easy it is
to make certain mistakes in Perl.  That sub does not do what you think
it does.  You're calling it in list context, so <> will read the whole
file.

And just to be nitpicky about context, "return;" is preferred over
"return undef;" since in the event you _do_ call it in a list context,
you usually want it to return the list equivalent of "false" rather
than the one-element (undef).

Further, while Tom will undoubtedly disagree, it personally makes me
nervous to see someone open(FILE, $filename), since $filename could
end up having ">" at the front or something.  Considering that you're
immediately reading the first line, an explicit open-for-read might be
better.

Oh, and the global FILE..

Well, anyway.  I happen to think Perl is just great, and rarely use
anything else (for any size project), but much the same way that C
makes it really easy to overflow buffers and chase null pointers, Perl
comes with its own set of gotchas.  Mr. Armchair would do better to
whine about those than the things which Perl actually does right.
-- 
	    Christopher Masto <chris+usenet@netmonger.net>
	Director of Operations, NetMonger Communications, Inc.

		     "Behold the Power of Cheese"


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

Date: 16 May 1999 19:26:21 GMT
From: chris+usenet@netmonger.net
Subject: Re: Perl "constructors"
Message-Id: <7hn64t$91c$1@schenectady.netmonger.net>


In article <MPG.11a882953134d43c989a77@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
> >                       Let me change the spec to say that I want an error
> > returned if stat() reveals that the file is less than 800 bytes. And, as
> > we have standardized here at our hypothetical programming shop that all
> > functions which do not receive parameters that are expected, must return
> > the value 10.
> 
>   sub first_line {
>       my ($hash_ref, $array_ref) = @_;
>       my $filename = $hash_ref->{filename} or return 10; # FALSE param

Until you have a directory full of numbered files and you want to
open "0".

>       open FILE, $filename or return -$!;                # -errno
>       -s FILE < 800 and return 42;                    # What you will.
>       $array_ref->[0] = <FILE>;
>       return 0;                                          # Success!!!
>    }
>    print $array[0] unless first_line('filename') != 0;

'filename' is a hash reference?
-- 
	    Christopher Masto <chris+usenet@netmonger.net>
	Director of Operations, NetMonger Communications, Inc.

		     "Behold the Power of Cheese"


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

Date: Sun, 16 May 1999 19:28:53 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hn69k$481$1@nnrp1.deja.com>

In article <slrn7jte10.fth.sholden@pgrad.cs.usyd.edu.au>,
  sholden@cs.usyd.edu.au wrote:
> On Sun, 16 May 1999 11:48:38 GMT, armchair@my-dejanews.com wrote:
> >In article <slrn7jsu0h.72t.sholden@pgrad.cs.usyd.edu.au>,
ally would return an int, not a value of undef, which is
pretty
> >scary as it makes my variables disappear.
> > my $scalar = 0; my $scalar = my_sub();     print $scalar;
> > (W) An undefined value was used as if it were already defined.
> > It was interpreted as a "" or a 0, but maybe it was a mistake.
> > To suppress this warning assign an initial value to your variables
>
> But your not meant to print the error indicator, your just meant to
test
> it with if or || or or or unless, etc (I couldn't resist those ors).

I personally prefer to return 0 on success and multiple non-zero codes
for various errors (ala the C and Unix libraries). Doing that I can not
write:

my_func() || die "";

But I could do:

if ( $return_code = my_func() )  { fatal_error( $return_code ); }

But since Perl has some kind of exception handling via die and
if(somevar) I would actually prefer to use that in most cases - I think.
I have never used exceptions on a productional basis in C++ as the
powers that be in our shop are against them having heard back in the
dawn of C++ that they cause slow and bloated code. <argh>


>
> >
> >And by your definition below, return 0; returns false in the land of
> >Perl, just as much as undef does.
>
> Unless used like so :
>
> my @array = my_sub();

if ( $array[0] )
{
  print "something is rotten in Denmark\n";
}

> I noticed you not liking some parts of perl. If I felt that way about
> programming languages I wouldn't use perl. You obviously still would.
> That's fine poeple aren't the same after all. I don't use a language
> becuase it is popular or valuable. I learn them out of some need or
> interest. I learnt perl since it was all I had available many
> years ago
> for a job I was doing. I liked it and stuck with it. I learnt
> ASP a year
> ago since it was all I had available for a job I was doing. I didn't
> like it. I left the job.

>From my limited experience looking for jobs, it appears that in
order to get hired for most of the them, one has to say that they know
how to program in the language/use the tools that a company is using
(and it has to appear on the resume just to get past HR departments).
This doesn't have to be the actual case, as they rarely even come close
to a thorough testing of your ability and knowledge in the interview
process, but you do need to know enough to get by the interview and
handle the first days on the job till you say "Gee, from all those hours
on that last Fortran project I was on, I seem to have forgotten most of
the Perl used to know so well. Can you remind me again what all those
dollar signs mean?".  (Hence the Teach Yourself X in 14 hours/21 days
books) But they don't actually want knowledge or training, it is
supposed to be on the job experience. Hence people's references (aka
friends) have to say "Why yes he was is one of the best of us,  I mean
my best, Cobol, er, make that Java programmers that we have here in our,
I mean my shop floor processing group, oops, not enough coffee I
suppose, we are actually the Web based on-line sales catalog and
shopping cart software group."

Regarding your ASP job, unless it is some kind of a lateral transfer or
hiring by people familiar to you, I haven't heard people getting jobs by
walking up and saying "Don't know ASP, but I am a very competent
programmer and willing to learn". There would have to be an ASP/Sybase
thing and they hired the person for great Sybase knowledge.

And people are different. I would never find a language that I couldn't
criticize or make suggestions for enhancements to, nor would my comments
be the sign of hatred or duress as you try to suggest. Not every one can
fall in love with a language - but not everyone needs to in order to
use it.


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


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

Date: Sun, 16 May 1999 19:32:58 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hn6ha$4aa$1@nnrp1.deja.com>

In article <m1pv41uk8b.fsf@halfdome.holdit.com>,
  merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "armchair" == armchair  <armchair@my-dejanews.com> writes:
>
> armchair> And just what is happneing in your "constructor". If we to
> armchair> look at the last few lines, what, other than "bless $rSelf,
> armchair> $sClass;" would we see?  Again, I will repeat myself - if
> armchair> you look at Perl discussions of objects they say a
> armchair> "constructor" returns a reference to the object. Are you
> armchair> know suggesting that constructors should also return scalar
> armchair> number and/or strings in the case of errors?
>
> In Perl, it's traditional for a so-called "constructor" to return a
> blessed reference, or undef in the case of failure.  And it's up to
> the invoker to verify that, usually aborting if undef is returned.
>
> What's so freaking hard to get about THAT?  <sigh>

The hard part is not in understanding what you just said, it was in
getting people to say it. I would say a constructor returns a reference
so how can you check a status and they would say:

"Wrong."   or they might say
"You have such a deep misunderstanding of everything that Larry Wall
ever set out to do that it is best that you pack your bags and go to
hell."

Etc.

>
> If you don't get that, just wait until you get to autovivification. :)
>
> print "Just another Perl hacker,"
>
> --
> Name: Randal L. Schwartz / Stonehenge Consulting Services
(503)777-0095
> Keywords: Perl training, UNIX[tm] consulting, video production,
skiing, flying
> Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger
merlyn@teleport.com)
> Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
> Quote: "I'm telling you, if I could have five lines in my .sig, I
would!" -- me
>


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


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

Date: 16 May 1999 19:46:47 GMT
From: friendly@hotspur.psych.yorku.ca (Michael Friendly)
Subject: perl script to check balanced (), {}, [], begin/end, etc
Message-Id: <7hn7b7$oeb$1@sunburst.ccs.yorku.ca>

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.


--
Michael Friendly     Email: friendly@yorku.ca (NeXTmail OK)
Psychology Dept
York University      Voice: 416 736-5115  Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA


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

Date: Sun, 16 May 1999 12:12:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PERLFUNC: lock - get a thread lock on a variable, subroutine, or method
Message-Id: <MPG.11a8b85df1391c33989a7a@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <373ee745@cs.colorado.edu> on 16 May 1999 09:41:57 -0700, Tom 
Christiansen <perlfaq-suggestions@perl.com> says...
> (This excerpt is from the perlfunc manpage, part of the standard set of
> documentation included with every valid Perl distribution--like the one on
> your own system.  See also http://language.perl.com/newdocs/pod/perlfunc.html
> or http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfunc.html
> if your negligent system adminstrator has been remiss in his duties.)
> 
> NAME
>     lock - get a thread lock on a variable, subroutine, or method
> 
> SYNOPSIS
>     lock *THING*
> 
> DESCRIPTION
>     The the lock manpage function places an advisory lock on a
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>     variable, subroutine, or referenced object contained in *THING*
>     until the lock goes out of scope. This is only a built-in function
                                                ^^^^
The 'only' is misplaced, but that's rather picky.  The other is just 
garbled.

>     if your version of Perl was built with threading enabled, and if
>     you've said `use Threads'. Otherwise a user-defined function by
>     this name will be called. See the Thread manpage.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 13 May 1999 15:17:18 GMT
From: Jeff Stampes <stampes@xilinx.com>
Subject: Re: print to STDOUT and a file at the same time?
Message-Id: <7heqdu$9r1@courier.xilinx.com>

bing-du@tamu.edu wrote:
: How to use 'print' statement to output to STDOUT and a file at the SAME
: TIME?

perldoc perlfaq5

     How do I dup() a filehandle in Perl?

     If you check the open entry in the perlfunc manpage, you'll
     see that several of the ways to call open() should do the
     trick.  For example:

         open(LOG, ">>/tmp/logfile");
         open(STDERR, ">&LOG");

     Or even with a literal numeric descriptor:

        $fd = $ENV{MHCONTEXTFD};
        open(MHCONTEXT, "<&=$fd");   # like fdopen(3S)

     Error checking has been left as an exercise for the reader.
 
-- 
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Sun, 16 May 1999 19:03:25 GMT
From: tvn007@my-dejanews.com
Subject: regular expression ?
Message-Id: <7hn4pt$35l$1@nnrp1.deja.com>

Hi,

Quick question on Regular expression:

Here is a problem and my solution:

$line[3] =~ s/0/L/g;
$line[3] =~ s/1/H/g;
$line[3] =~ s/x/X/g;

Question:

How can I combine the three lines above into one perl statement ?

Thanks for your help,


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


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

Date: Sun, 16 May 1999 19:42:30 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: regular expression ?
Message-Id: <GcF%2.733$fx5.627@news.rdc1.sfba.home.com>

<tvn007@my-dejanews.com> wrote in message
news:7hn4pt$35l$1@nnrp1.deja.com...
> Here is a problem and my solution:
>
> $line[3] =~ s/0/L/g;
> $line[3] =~ s/1/H/g;
> $line[3] =~ s/x/X/g;
>
> Question:
>
> How can I combine the three lines above into one perl statement ?

Well, you should execute:

    perldoc perlop

and search for 'tr/'

It'll tell you all about it...

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: Sun, 16 May 1999 19:28:40 GMT
From: ajs@ajs.com
Subject: Re: Saving regularly a web page
Message-Id: <7hn697$47v$1@nnrp1.deja.com>

In article <373E9583.9956C6B5@csi.com>,
  Isaac Keslassy <amig@csi.com> wrote:

> In fact, I know them both. My problem is to launch them regularly (eg
> each hour) on my windows system, without manual intervention. Is it
> possible to do that with perl ?

Ah, Windows scheduling. Windows 98 Plus comes with a scheduler. There
are various ports of cron that you could search for.

Out of curiosity, why not run an OS that comes with a scheduler by
default (e.g. Linux, *BSD, etc)?

-AJS


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


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

Date: Sun, 16 May 1999 19:58:41 GMT
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Sorting of array of hashes.
Message-Id: <MPG.11a8eed9283edc1d9896cd@news>

I've been reading Chapter 4 in Programming Perl and looking at FAQ4 for 
Data Structures. I can't seem to find any information on sorting nested 
structures of hash keys in an array. I have an index of web pages from a 
site as follows...

@pages is the array containing...
%details which is my hash containing...
'title' =>
'file_name' =>
'create_date' =>
'last_mod' =>

I print the info to a page from a for loop using @pages.

I'm really getting my brain caught in a loop here. I would like to be 
able to sort by date, title or filename values and print the results from 
my for loop in the sorted order of the chosen keyname.

So far it looks pretty pointless to sort on the array itself and doing so 
after a hash sort just reorganizes everything...

How do I go about sorting a nested hash by value then reflecting that 
organization in the array so that iteration in a for loop works like it 
should? I can see how it works from a regular hash... once I try to apply 
it to a nested structure like above I just kinda blank out.

-- 
CT


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

Date: Sun, 16 May 1999 18:20:19 GMT
From: armchair@my-dejanews.com
Subject: Re: TROLL ALERT (Re: Perl "constructors")
Message-Id: <7hn291$1kc$1@nnrp1.deja.com>

In article <Arved_37-1605991304080001@dyip-114.chebucto.ns.ca>,
  Arved_37@chebucto.ns.ca (Arved Sandstrom) wrote:
> In article <7hlneo$6ma$1@nnrp1.deja.com>, armchair@my-dejanews.com
wrote:

> I'm aware that new() in Java and C++ is not the constructor. What I
was
> getting at is more the frequent association of the word 'new' with the
> deed (construction). My main point is that in Perl "new" is not
> a keyword, but by usage it has acquired an identification with object
> construction. I'm suggesting that for many people it isn't clear that
> you don't have to use this specific word.

That's true and I am one of them. I was using "new" assuming I had to,
as all the book examples did, and then I just happened to notice that it
was never mentioned as being required, and I changed it to abc, and sure
enough, it worked. So then, I decided to make a posting on UseNet News
regarding that finding...

>
> I'd disagree a bit about your contention with respect
> to new() in Java.
> The keyword is also used to dynamically allocate arrays.
> I.e., dynamic allocation of memory. So, if it walks
> like a duck...

I haven't programmed a line of Java code, but have read a little, and
it seems like with an object (I can't comment on arrays), they
could just rely on the = sign to see that something is being created:

MyClass a; // declares a reference - deviation from C++ so....
MyClass a = new MyClass(); // instantiates object, fine but....
MyClass a = MyClass();     // seems like this would work just as well.
   // as MyClass() clearly represents a constructor for class MyClass

Perhaps I should go to a Java newsgroup and make a suggestion
regarding "new" in Java, hmmm.....  ;)

>
> Perl "constructors", i.e. the method create() in package My, are
> inherently overloadable. You just pass whatever argument
> list makes sense.
> The same method uses its logic to figure out what to do with
> the argument
> list. In point of fact, this is one reason I'm not too fond of
> C++ or  Java - umpteen constructors to handle every reasonable
> set of construction parameters.


If you handle multiple parameter possibilities in one constructor,
instead of 1 for each possibility, you end up with one function, but
that function has more code in it to adjust and handle the different
possibilities. I prefer the multiple way as it is more modular. And with
function "overloading" (unfortunate term but I haven't got a better one)
someone can add new functions, and not disturb the old code in any way.

But, were you to be forced to code in C++ or Java, you could do it the
"Perl way" as well - just stuff data into an array or map (a C++ STL
version of a hash ) or struct (or another class) and determine what has
been passed in your constructor, just as you would in Perl.

Perl can have
multiple "constructors" as long as they have different names.
Is that being practiced to any great extent?


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


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

Date: Sun, 16 May 1999 18:37:53 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Where can i download a complete perl reference?
Message-Id: <7hn38c$5ho$1@xenon.inbe.net>

In article <unME9N7n#GA.305@cpmsnbbsa05>, "Mike" <mike-carter@email.msn.com> wrote:
>I find plent of online references to perl but is there a windos download
>reference manual?
>

You might start at http://www.perl.com/ and look under "Documentation". There 
you'll find Online Documentation in HTML. You can download the whole stuff
as a *.tar.gz file, and unzip it e.g. with WinZip...

As an alternative, the same documentation is also available as part of the
ActivePerl distribution, that you'll find under "Get the latest version of 
Perl".

You can also find a set of documentation at your nearest CPAN.

Good idea,

Michel.


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

Date: Sun, 16 May 1999 19:40:02 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: Where can i download a complete perl reference?
Message-Id: <maF%2.729$fx5.530@news.rdc1.sfba.home.com>

Mike <mike-carter@email.msn.com> wrote in message
news:unME9N7n#GA.305@cpmsnbbsa05...
> I find plent of online references to perl but is there a windos download
> reference manual?

You could start off by executing the following commands:

    perldoc perl
    perldoc perldoc
    perldoc xxx

where xxx is some entry in the list in `perldoc perl`.

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: 16 May 1999 20:14:14 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Where can i download a complete perl reference?
Message-Id: <7hn8um$40m$1@gellyfish.btinternet.com>

On Sun, 16 May 1999 11:46:36 -0400 Mike wrote:
> I find plent of online references to perl but is there a windos download
> reference manual?
> 

If you downnload and install the ActiveState Perl then you will also
install a bunch of documentation that you will see on your "Start Menu".

/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>


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

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

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