[11713] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5313 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 6 18:27:29 1999

Date: Tue, 6 Apr 99 15:00:22 -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           Tue, 6 Apr 1999     Volume: 8 Number: 5313

Today's topics:
    Re: "chmod g+s" and $0 Problem <gellyfish@gellyfish.com>
    Re: $1 is not changed after second search (Bruce R Miller)
    Re: chmod - setting permissions with perl? <gary@gbg.netmegs.com>
    Re: chmod - setting permissions with perl? (brian d foy)
    Re: chmod - setting permissions with perl? (brian d foy)
        Email to multiple recipients yong321@yahoo.com
        Hash help <john.christena@tivoli.com>
        How to passively read serial port (Jere Julian - Personal Account)
    Re: Is there any "Perl Editor "? Help <gellyfish@gellyfish.com>
    Re: is there any ceiling function in perl? <droby@copyright.com>
    Re: leap year? (Tramm Hudson)
    Re: leap year? (Larry Rosler)
    Re: leap year? (Abigail)
    Re: Lisp influences on Perl, Perl as an AI language <jonathan@meanwhile.freeserve.co.uk>
    Re: PERL 5.0 IIS NT - problems <john.christena@tivoli.com>
        Perl as a first programming language - suitability, goo <jonathan@meanwhile.freeserve.co.uk>
        Perl Mongers: Beware of CTI Personnel Group (brian d foy)
    Re: Perl Question for generating HTML trimbleman@hotmail.com
        perldoc formatting (Kesey)
    Re: perldoc formatting (Ilya Zakharevich)
        Perlshop error #6 (EME888)
    Re: Pershop Question <gellyfish@gellyfish.com>
    Re: Recursion in Perl (Larry Rosler)
    Re: Recursion in Perl <ron.dilley@ada.com>
    Re: Recursion in Perl (Abigail)
    Re: Recursion in Perl <gellyfish@gellyfish.com>
    Re: Regular Expression (Greg Bacon)
    Re: Regular Expression <stampes@xilinx.com>
    Re: setting env variables, sourcing, etc. (Greg Bacon)
    Re: Signals Question <zim@ou.edu>
    Re: switch statement? (Abigail)
        Typeglobs broken by threaded perl??? (Bruce R Miller)
    Re: Typeglobs broken by threaded perl??? (Ilya Zakharevich)
    Re: Which text editor should I use <gellyfish@gellyfish.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 6 Apr 1999 21:38:52 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: "chmod g+s" and $0 Problem
Message-Id: <7edutc$29j$1@gellyfish.btinternet.com>

On Tue, 06 Apr 1999 16:44:17 +0200 Nabil Edelbi wrote:
> I got the following Problem: Just look at the following 5 Steps...
> 
<snip>
> i.e. when I change the SETUID flag of the skript the perl variable $0
> gives the name of a device file but not the skript-name as usual!!
> 
> Maybe a bug?

No its a security feature as described in the perlsec manpage.

/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: 6 Apr 1999 20:12:53 GMT
From: miller@altaira.cam.nist.gov (Bruce R Miller)
Subject: Re: $1 is not changed after second search
Message-Id: <7edps5$d61$1@news.nist.gov>

In article <1dpqrnb.j95b1h1n14x8gN@p89.tc3.state.ma.tiac.com>,
	rjk@linguist.dartmouth.edu (Ronald J Kimball) writes:
>Karsten Patzwaldt <kpa@gmx.net> wrote:
[...]
>>  $starttime=str2time($1); print "Startzeit: $1\n";
>>  until($log[$i] =~ /([A-Z][a-z]{2} {1,2}[0-9]{1,2} [0-9:]{8}) snerf \
>> pppd\[[0-9]{1,5}\]: Connection terminated./) { $i++; print "Endzeit: $1\n"; }
>>    $endtime=str2time($1);
>>    $time+=$endtime-$starttime;
>>  }
[...]
>
>You print $1 each time the second match fails.  As documented, $1 et al.
>are only set by a _succcesful_ match.  

Yes, but his until loop terminates with a successful match, so $1 should have
been set when he's assigning $endtime.

The scope of $1 "extends to the end of the enclosing block... or to the next 
successful pattern match"
I suspect the problem is that the until(...){} is implicitly defining a block?
(around the whole until... not just the body block); after all, a while can 
be labeled, have a next, etc, so its rather block-like.
Is this correct?

---
OTOH, I'm wondering exactly what is meant by `successful match'.  A problem 
I'm having is with code like this:

$_ = "%foo2";
/(\w)?(foo\d)/ && print "$1 & $2\n";   ****

Under perl 5.004_01 I get
 & foo2
but under 5.005_03 I get
 f & foo2
ie $1 was set by a successful (partial) match, but NOT undef'd when perl
BACKTRACKED to complete the match.

Is 5.004 correct in undef'ing it, or is 5.005 correct in leaving it alone until it
"successfully matches" _even_ the subexpression?


****
 Yes, I know this is a better pattern /(\w?)(foo\d)/ ... and it works too!
-- 
--
bruce.miller@nist.gov
http://math.nist.gov/~BMiller/



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

Date: 6 Apr 1999 16:03:16 -0500
From: "Gary" <gary@gbg.netmegs.com>
Subject: Re: chmod - setting permissions with perl?
Message-Id: <370a6884@discussions>


You are doing it right.  For the script to be able
to chmod the file, it has to have write permission
for the directory in which the file resides.
I am sure your www-directory has a 755 permission.
for this to work, you would need a 777 permission on that directory.
I wouldn't recommend doing that.  I would move the files
that might need their permiss. changed to a separate
directory with write permission.
I am sure there is another way to do this, but I
encountered the very same problem.

Gary

tadmc@metronet.com (Tad McClellan) wrote:
>Tim Lotz (tim@pixelfilm.de) wrote:>
>: i'm trying to change the permissions from a file in my www-directory
>: from 0600 to 0755.
>
>: chmod(0755, '../test.jpg');
>: print "done";
>
>: it doesn't work.
>: does anybody knows why?
>
>
>   Perl (and the OS) probably knows why.
>
>   Ask them to tell you:
>
>      chmod(0755, '../test.jpg') || die "could not chmod()   $!";
>                                                             ^^
>                                                             ^^
>   Then have a look in your server logs (or wherever STDERR goes
>   in your environment)
>
>
>: my book says, that this is the way to do it. does it lie:)?
>
>
>   If it lets you omit checking the return values from calls
>   that talk to the OS, then it is profoundly sub-optimal.
>
>
>   What book is it?
>
>
>--
>    Tad McClellan                          SGML Consulting
>    tadmc@metronet.com                     Perl programming
>    Fort Worth, Texas



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

Date: Tue, 06 Apr 1999 16:17:56 -0400
From: brian@pm.org (brian d foy)
Subject: Re: chmod - setting permissions with perl?
Message-Id: <brian-ya02408000R0604991617560001@news.panix.com>

In article <370A1759.98445EAD@ccrsDotnrcandOtgc.ca>, Tom Kralidis <tom.kralidis@ccrsDotnrcandOtgc.ca> posted:

> You can try 
> 
> system("chmod 755 ../test/jpg");
> 
> File permissions, AFAIK, are 3 digits (owner, group, public)
> 

of course, it would be better to use the perl chmod() function,
or just program in sh directly.

-- 
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: Tue, 06 Apr 1999 16:19:27 -0400
From: brian@pm.org (brian d foy)
Subject: Re: chmod - setting permissions with perl?
Message-Id: <brian-ya02408000R0604991619270001@news.panix.com>

In article <370A592F.1076C27F@mail.cor.epa.gov>, "David L. Cassell" <cassell@mail.cor.epa.gov> posted:

> Tom Kralidis wrote:
> > 
> > You can try
> > 
> > system("chmod 755 ../test/jpg");
> 
> Well, you can *try* it, but you might not like the results.
> Perl will read 755 as decimal, not octal.  Put the '0' back
> in front of the '755' and Perl (and you) will be happier.

chmod doesn't care - remember that *that* chmod isn't Perl ;)

-- 
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: Tue, 06 Apr 1999 20:37:10 GMT
From: yong321@yahoo.com
Subject: Email to multiple recipients
Message-Id: <7edr9l$hu1$1@nnrp1.dejanews.com>

(I posted this message to the perl.modules group but didn't get real help.)

The Net::SMTP documentation says I can call the to() method this way

$smtp->to("a\@b.com,c\@d.com");

But our mail server (see endnote) says malformed email address. I try sending
a mail using Microsoft Outlook to "a@b.com,c@d.com" (quotes not included), it
says the same words but adds that if you use commas to separate multiple
recipients, use semicolons instead. Indeed it works in Outlook if I use ";".
But it still doesn't work in my Perl script, which works fine with single
recipient.

Thanks for help.

Yong
Email:yong321@yahoo.com
_________
Note: I can telnet to its port 25 and get

220 vixon15.isource.com InterScan VirusWall NT ESMTP 3.0 (build 7/31/1998)
ready  at Thu, 01 Apr 1999 15:38:21 -0600

and I can use usual SMTP commands. But the complaint in Outlook when using ","
says "Microsoft Exchange does not recognize commas...". Is it an Exchange
server or a SMTP server? Or it shouldn't make any difference.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 06 Apr 1999 13:02:43 -0500
From: John Christena <john.christena@tivoli.com>
Subject: Hash help
Message-Id: <370A4C43.83EB9336@tivoli.com>

Hello.  I have a hash that contains several scalar variables.  I want to
reference members of this hash and have the value of the scalar
interpreted.  Is this possible?

Such as:

$varname="list"
$hashname{$varname}=?

I would like the hash to point to the variable $varname and be
recognized as that variable with the value of $varname.  Any hints are
appreciated..  Thx.

Please respond to john.christena@tivoli.com



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

Date: 6 Apr 1999 20:15:57 GMT
From: julianje@mercury.interpath.com (Jere Julian - Personal Account)
Subject: How to passively read serial port
Message-Id: <7edq1t$1n2$1@gaddy.interpath.net>

I am trying to log info from a Telco PBX over a serial port.  The  PBX i
sending fixed-length records to me via an RS-232 cable which I can read
fine with 'cu -l/dev/cur5 -s9600' but what I really need is to log these
to be parsed later.  Using: Perl5, Linux, Rocketport 8-port card.

Tried many variations of :
#!/bin/perl
open(PORT, "</dev/cur5");
open(LOG, ">mylogfile"):
$| = 1;
while($_=<PORT>) {
  print LOG $_;
}
close LOG;
close PORT;
exit;

The PBX keeps disabling the port due to "invalid characters".  Its a NorTel 
Meridian Option 11.  What kills me is that it works fine with cu or minicom.

Any help or suggestions would be much appreciated.  I think I've looked 
everywhere.

Thank you,
-Jere Julian
Network Administrator, LADD Upholstery
mailto:jjulian@laddnet.com


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

Date: 6 Apr 1999 19:37:43 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is there any "Perl Editor "? Help
Message-Id: <7ednq7$273$1@gellyfish.btinternet.com>

On Tue, 06 Apr 1999 18:34:09 GMT t_alter@hotmail.com wrote:
> Hi All;
> 
> I am learning Perl. I am wasting too much time to write the page layout in
> html. I wanted to know if there is any Perl Editor like Visual InterDev is for
> ASP?
> 

Your question seems to imply that HTML is somehow associated with Perl.
It is not.  The HTML text is simply just another bunch of data to be output
as far as Perl is concerned.  

If you are looking for a programmers editor that will ease the production
of Perl code the you should look at:

http://reference.perl.com/query.cgi?editors

before the usual boring thread about peoples favourite editors starts.

As far as the HTML goes I would suggest that you use whatever method you
have used in the past and cut and paste the text into a 'here' document
in your Perl program.

/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: Tue, 06 Apr 1999 16:17:08 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: is there any ceiling function in perl?
Message-Id: <7edc1u$4hv$1@nnrp1.dejanews.com>

In article <7e5jov$sgj$1@nnrp1.dejanews.com>,
  Don Roby <droby@copyright.com> wrote:
> In article <7e5c36$353$1@news.swissonline.ch>,
>   "Samuel Kilchenmann" <skilchen@swissonline.ch> wrote:
> > Larry Rosler schrieb in Nachricht ...
> > >In article <7e4b6v$t41$1@nnrp1.dejanews.com> on Sat, 03 Apr 1999
> > >06:07:31 GMT, agniora@usa.net <agniora@usa.net >says...
> > >> does anyone know if theres any ceiling function in perl that would round
> > up
> > >> decimal numbers to the integer.
> > >
> > >perlfaq4:  "Does Perl have a round() function? What about ceil() and
> > >floor()? Trig functions?"
> > >
> > >But it seems easy enough just to write:
> > >
> > >sub ceil { ($_[0] != int $_[0]) + int $_[0] }
> > >
> > Except that the result is wrong for negative numbers ...
> > what about:
> > sub myceil  { $_[0] > 0 ? int($_[0] + 1) : int($_[0]) }
> > sub myfloor { $_[0] > 0 ? int($_[0]) : int($_[0] - 1) }
> >
>
> Or, in line with Larry's idea of using the boolean values:
>
> sub myceil { ($_[0] != int $_[0]) - ($_[0] < 0) + int $_[0] }
> sub myfloor { int $_[0] - ($_[0]<0) }
>
> which is certainly more fun.  ;-)
>

But unfortunately is wrong for integers, as was Samuel's.

Dejanews has been acting up the last couple days, so I can't see right now
whether anyone else pointed this out.  Larry corrected Samuel's error in
gedanken, which mine continued, but I'll correct my own with a continuation of
the fun.

sub myceil  { int($_[0]) + ($_[0] != int($_[0])) * (1 - ($_[0] < 0)) }
sub myfloor { int($_[0]) - ($_[0] != int($_[0])) * ($_[0] < 0) }

which has gone beyond fun to complete silliness.

I also did a benchmark.  POSIX wins, which doesn't surprise me a bit, and
Larry's corrected version beats mine, which is also unsurprising.  I didn't
make and benchmark a corrected version of Samuel's, but I assume it would work
out similarly to Larry's.  Multiplication by booleans is not efficient.

--
Don Roby

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 6 Apr 1999 14:11:29 -0600
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: leap year?
Message-Id: <7edpph$f9o@llama.swcp.com>

In article <370A64D9.D74E83AB@mail.cor.epa.gov>,
David L. Cassell <cassell@mail.cor.epa.gov> wrote:
> Actually, this is a FAQ.. just not in Perl.  But it's in the
> comp.lang.c FAQ if that's any help.
> 
> Just check:
> year divisble by 4?  then yes
>   year divisible by 100?  then no
>     year divisible by 400?  then yes

I guess I'll have to cancel all of my appointments for 29 Feb 2000
then since 2000 is divisible by 100.  No, wait!  2000 is divisible by
four, as is 2100.  So I'll have to get ready for 29 Feb 2100.
Dang it!  Where is my calendar?

Just for reference, the comp.lang.c faq available at

	ftp://rtfm.mit.edu/pub/faqs/C-faq/faq

states in Q20.32 (Is 2000 a leap year?):

	year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)

So now someone has to ask how to write a version of this
test in Perl...

> [Note first make sure to add 1900 to the $year variable if it
>  is coming from the C struct tm or from localtime() .]

Now that is good advice.  The FAQ for cl.c states that C does not
have any year 2000 problems, but poorly written C programs might.

Tramm
-- 
  o   hudson@swcp.com                 tbhudso@cs.sandia.gov   O___|   
 /|\  http://www.swcp.com/~hudson/          H 505.266.59.96   /\  \_  
 <<   KC5RNF @ N5YYF.NM.AMPR.ORG            W 505.284.24.32   \ \/\_\  
  0                                                            U \_  | 


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

Date: Tue, 6 Apr 1999 13:41:07 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: leap year?
Message-Id: <MPG.11741141f0111f1098984c@nntp.hpl.hp.com>

In article <370A64D9.D74E83AB@mail.cor.epa.gov> on Tue, 06 Apr 1999 
12:47:37 -0700, David L. Cassell <cassell@mail.cor.epa.gov> says...
> du_bing@my-dejanews.com wrote: 
> > How to judge if the current year is a leap year or not in Perl?  There should
> > be a formula.  Unfortunately I forgot.
 ... 
> Actually, this is a FAQ.. just not in Perl.  But it's in the
> comp.lang.c FAQ if that's any help.
> 
> Just check:
> year divisble by 4?  then yes
>   year divisible by 100?  then no
>     year divisible by 400?  then yes

Those three checks are in the wrong order.  But reversing the order is 
less efficient than doing them in that order, but with more elaborate 
logic than 'yes' if the first test succeeds.

However, your submission won for me a private bet I made that at least 
one person would publish the three-mods approach.

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


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

Date: 6 Apr 1999 21:28:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: leap year?
Message-Id: <7edu93$m7t$1@client2.news.psi.net>

Jay Glascoe (jglascoe@giss.nasa.gov) wrote on MMXLIV September MCMXCIII
in <URL:news:370A45E1.4BD00D70@giss.nasa.gov>:
'' [cc'd cited author]
'' 
'' du_bing@my-dejanews.com wrote:
'' > 
'' > How to judge if the current year is a leap year or not in Perl?  There should
'' > be a formula.  Unfortunately I forgot.
'' 
'' use Time::Local;
'' 
'' sub is_a_leap_year {
''     # based upon Abigail's profound idea that a 
''     # year is a is a leap year if, and only if,
''     # February is 29 days long
''     my $year = shift() - 1900;
''     (localtime timelocal 0,0,0,29,1,$year)[4] == 1;
'' }


But that requires another module, and hence slows down your program
due to extra compilation.

   sub is_a_leap_year {

       my $now  = time;
       my $year = (localtime $now) [5];
       my ($yy, $dd, $mm) = $year;

       while ($yy == $year) {
           ($dd, $mm, $yy) = (localtime $now) [3 .. 5];
           return 1 if $dd == 29 && $mm == 1;
           $now += $mm > 1 ? -1 : 1;
       }

       return 0;
   }


Note that this subroutime might be wrong if called a few microseconds
before the new year.



Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: Tue, 6 Apr 1999 22:46:53 +0100
From: "Jonathan" <jonathan@meanwhile.freeserve.co.uk>
Subject: Re: Lisp influences on Perl, Perl as an AI language
Message-Id: <7edvd7$eb$1@news4.svr.pol.co.uk>


David Delikat wrote in message <37091B8D.1CFB@protix.com>...

>as for the second part, I have written some Genetic
>algorythms in perl.  I started to write some logic
>managment stuff ( similar to prolog ) but stopped
>because I am too busy.  I can see it would be very
>powerful for that use.  I think there are some modules
>in the archives too...
>


Genetic programming, like Koza's stuff,  was what I was thinking of. And
Eliza type programs - and it turns out that there's an Eliza in the TPJ
bundled with my ORA kit. The author says he thinks he was the first person
to write a conversational program in Perl and thinks that this is strange.
I'd agree.

Jonathan






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

Date: Tue, 06 Apr 1999 13:05:02 -0500
From: John Christena <john.christena@tivoli.com>
Subject: Re: PERL 5.0 IIS NT - problems
Message-Id: <370A4CCE.5E4F57E0@tivoli.com>

I could be wrong, but it sounds like a permissions issue. Just for a test, set
everyone w/ read access to the inetpub dir(dont leave it this way).  If it
works, its a simple permissions issue.

Mardel Cardoso wrote:

> My friends,
>
> Simple Problems in the NT! Does anybody help me?
> ------------------------------------------------------------------------
>
> I am trying install the Perl 4 in the NT Server with IIS 4.0.
>
> I used the "install.cmd" and every registry is OK!
>
> I put the perl in the directory c:\inetpub\wwwroot\cgi-perl and
> created a virtual directory \cgi-bin. Both has permissions to execute.
>
> In the IIS, in "Default Web Site", "Application Setting" I created a
> configuration
> .pl        c:\inetpub\wwwroot\cgi-perl\execperl.bat. My objetive is execute
> every
> programs using the file directives "execperl.bat". In the execperl.bat has:
>
> @echo off
> perl %PATH_INFO%,%QUERY_STRING%"
> exit
>
> When I use the internet Explorer and execute a program "teste.pl" in the
> cgi-bin I had received the messages:
>
> "HTTP Error 403
> 403.1 Forbidden: Execute Access Forbidden
> This error can be caused if you try to execute a CGI, ISAPI, or other
> executable program from a directory that does not allow programs to be
> executed."
>
> I put the permissions in the directory cgi-perl and cgi-bin.
> What's wrong? Must I put other permissions in other directory?
>
> Does Anybody works with NT and IIS?
>
> Mardel
> guia@tba.com.br



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

Date: Tue, 6 Apr 1999 22:22:38 +0100
From: "Jonathan" <jonathan@meanwhile.freeserve.co.uk>
Subject: Perl as a first programming language - suitability, good books ?
Message-Id: <7edtvp$v10$1@news4.svr.pol.co.uk>

A friend of mine from an arts background is interested in learning to
program, partly from intellectual curiousity and partly for career reasons.
She's extremely smart and a great problem solver, but she's never written a
program in any language. Until recently I didn't know what language to
suggest to her - Basic's too ugly, Pascal is a dead end. And definitely not
C++ (although it's what I do half my work in myself - my other languguage is
Masm, which I felt was *almost* as inappropriate.) I was thinking maybe
you-know-what, but last week I started to learn Perl.

 I finished writing my first production program the other day, a tool that
assembles local chunks of data into a meshed description of 3D data. Now I'm
in love with the language and recommending it to all my C++ programmer
friends. The normal response is "I thought it was just a text manipulation
language." I've found that the most effective response is to tell them that
Perl supports dynamic inheritance - C++ programmers have a lot respect for a
language that has a feature that C++ lacks (with good reason.)

I know that Perl is usually a second or third language, and is mostly used
by hardcore programmers, but I'm sure that Larry Wall didn't mean it that
way and that it doesn't have to be that way. Perl has a lot of great
features for first-timers - notably a long, gentle learning curve. (I think
dynamc inheritance is probably the thing I'll leave until last.) I was
wondering if anyone has any experience of learning Perl as a first language
?

But most important of all, I was wondering if anyone could recommend a Perl
book aimed at people like my friend ? Something that explains what an array
is, what a sort is, even what an interpreter is ? (I'm too far away from her
to make giving lessons easy and she's the sort of person who takes this
stuff better from books.) I know that there's a Perl For Dummies book, but
the reviews at Amazon were lukewarm - in particular it seemed to lack
examples. Once she gets a start she can switch to one of the Learning Perl
books.

I'd be grateful for any suggestions.

Jonathan Coupe




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

Date: Tue, 06 Apr 1999 17:36:55 -0400
From: brian@pm.org (brian d foy)
Subject: Perl Mongers: Beware of CTI Personnel Group
Message-Id: <brian-ya02408000R0604991736550001@news.panix.com>


Perl Mongers is getting popular enough that the situation that i
describe below is becoming less rare.  i've decided that it is not
good.  Perl Mongers already has specific mailing lists for perl jobs,
and even ny-perl-jobs.  as such, i've configured majordomo to not
honor the who command for my lists, and suggest likewise for others.

however, this does not stop the address harvesting programs (even if
they are wet-ware).  i have my telephone number in my email sig, which
is usually a good thing, but not so here.  be careful what information
you give out over Perl Mongers forums (of any kind).


--BEGIN--
[origianlly sent to ny@lists.panix.com in reference to behaviour
on the NY.pm mailing list]

Donna Rubin is a current, but not for long, subscriber to this list.  She
works for the CTI Personnel Group, and as far as I can tell, is trying to
use this list to build up her contact list.

Several minutes ago I received a call from one of CTI's headhunters who
told me that Donna gave my name to him and that she got it through this
list.  When I called CTI to try to speak to someone to complain about
this, CTI refused to speak to me.

In my opinion, as Executive Director of Perl Mongers, this is not cool.
Since they did not wish to speak to me to resolve this problem, the only
thing I can do is warn you that there are unscrupulous people in our midst
and to be careful what information you give out in your messages.

Welocme to the Black List CTI.  You're our first contestant.  May you
fully enjoy the public relations fiasco this will be.
--END--

-- 
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: Tue, 06 Apr 1999 21:08:13 GMT
From: trimbleman@hotmail.com
Subject: Re: Perl Question for generating HTML
Message-Id: <7edt3n$jdr$1@nnrp1.dejanews.com>


> : >    Whitespace is "folded" in the presentation of HTML (it is
> : >    ignored by the browser), so getting things lined up in
> : >    pretty columns is unneeded work, since the browser will
> : >    undo the work anyway.
> : Is this true if you are passing the data into HTML Borders
> : with cells and rows ??
>    I dunno.
>    That is not a Perl question.
>    There is another newsgroup for discussing HTML:
>       comp.infosystems.www.authoring.html
thanks for the group name. i will post there
>    But if whitespace in HTML does matter, I'm still fairly
>    certain you can get what you want without formats.
> : >    print() with a here-doc is handy for outputting a block
> : >    of text, such as the head/tail of the HTML output:
> : > print <<'ENDHTML';
> : > Content-Type: text/html
> : >
> : > <html>
> : > <head>
> : >    <title>My Web Page</title>
> : > </head>
> : > <body>
> : > ENDHTML
> : So this produces the headers portion of each html document ??
>    Type it in.
>    Run it.
>    See what it does.
>    No need to post such questions...
> : then you would use another print <<
> : for the body ??
> : and a third for the ending ??
>    You use what is appropriate for the job.
>    here-docs are just another form of quoting like single/double quotes.
>    Go read about it if you want to know about it.
Where do i read about it ???

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 06 Apr 1999 20:38:53 GMT
From: kesey@globe.ece.utexas.edu (Kesey)
Subject: perldoc formatting
Message-Id: <KESEY.99Apr6153853@globe.ece.utexas.edu>

When I run 'perldoc -f sort', I see all the formatting directives like:

	=item sort SUBNAME LIST
	 
	=item sort BLOCK LIST
	 
	=item sort LIST

	of the array are to be ordered.  (The C<E<lt>=E<gt>> and C<cmp>

However, when I give it the name of a module, like 'perldoc
constant.pm', I see the formatting the way it was intended, with
indented paragraphs and underlines, etc.  Can anyone tell me why the
formatting works in one case but doesn't in the other?  Is that what
it's supposed to do?

Thanks,
John


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

Date: 6 Apr 1999 20:59:54 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: perldoc formatting
Message-Id: <7edska$qv8$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Kesey
<kesey@globe.ece.utexas.edu>],
who wrote in article <KESEY.99Apr6153853@globe.ece.utexas.edu>:
> When I run 'perldoc -f sort', I see all the formatting directives like:
> 
> 	=item sort SUBNAME LIST
> 	 
> 	=item sort BLOCK LIST
> 	 
> 	=item sort LIST
> 
> 	of the array are to be ordered.  (The C<E<lt>=E<gt>> and C<cmp>
> 
> However, when I give it the name of a module, like 'perldoc
> constant.pm', I see the formatting the way it was intended, with
> indented paragraphs and underlines, etc.  Can anyone tell me why the
> formatting works in one case but doesn't in the other?

Because you did not implement it to work the way you want.

However, it is too late for you to jump in and improve it - it was already
done several weeks ago.

Ilya


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

Date: 6 Apr 1999 20:21:35 GMT
From: eme888@aol.com (EME888)
Subject: Perlshop error #6
Message-Id: <19990406162135.13107.00004383@ng-cg1.aol.com>

Hello,
I am an idiot. I set up perlshop on my website. It works pretty well most of
the time. My problem seems to be whenever someone places an order from within
"aol", they get an "invalid transmission error #6" message. If someone can
either tell me how to correct this or where to find the answer or I will pay to
have this corrected if someone is willing. My web address is
www.edps-nj.com
or my e-mail is Randy@edps-nj.com
Or if I invaded the wrong news group for this answer you can tell me to.

By the way, does arpanet still exist or do they maintain an old site just to
frustrate  idiots like me. I can't get a hold of them


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

Date: 6 Apr 1999 21:56:20 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Pershop Question
Message-Id: <7edvu4$29m$1@gellyfish.btinternet.com>

On Mon, 05 Apr 1999 21:08:07 -0400 Arnold Goldman wrote:
> 
> "Invalid Transmission #3 received from: xxx.xxx.xxx.xx If your
> connection was interrupted, you must Enter the shop from the beginning
> again."
> 

That isnt a Perl diagnostic.  I would look in the code of your application
to determine what circumstance would give rise to this message.

/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: Tue, 6 Apr 1999 13:45:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Recursion in Perl
Message-Id: <MPG.1174123b449ccd9098984d@nntp.hpl.hp.com>

In article <370A5993.59E2@protix.com> on Tue, 06 Apr 1999 13:59:31 -
0500, David Delikat <ddelikat@protix.com> says...
> Sameer G. Naik wrote:
> >         Is it possible to have recursion in Perl ?
> >         I want to traverse directory tree recursively.
> >         Or is there any function which would traverse
> >         the given node and return all the filenames
> >         ( like C function FTW ) ?
> 
> HMMM, let me venture a guess...
> 
> perldoc recursive

Um, no.  Bad guess.

C:\>perldoc recursive
No documentation found for "recursive".

C:\>perldoc -q recursive
Found in d:\perl\lib/pod/perlfaq4.pod
  How do I print out or copy a recursive data structure?
 ...

I did manage to find this in perlsub (it is the only use of 'recur'): 

"Subroutines may be called recursively."

I find it simple to re-use the simple recursive directory walk I wrote a 
while ago.  But others prefer File::Find, which is fewer lines of code 
to write and may cover more strange cases (such as circular symlinks).

perldoc File::Find

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


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

Date: Tue, 06 Apr 1999 13:41:32 -0700
From: Ron Dilley <ron.dilley@ada.com>
Subject: Re: Recursion in Perl
Message-Id: <370A717C.63291795@ada.com>

Sameer,

-----
#
# scan dir (re-entrant)
#
sub scan_dir
{
    local( $current_dir ) = @_;
    local( @entries, $entry );
	
    if ( $debug > 3 )
    {
	print "STATUS - Scanning \[$current_dir\]\n";
    }

    push( @dir_stack, 0 );

    opendir( $dir_stack[0], $current_dir );
    @entries = grep( !/^\.\.?$/, readdir( $dir_stack[0] ) );

    foreach $entry ( @entries )
    {
	if ( -l "$current_dir/$entry" )
	{
	    if ( $debug > 5 )
	    {
		print "DEBUG - LINK\t$entry\n";
	    }
	}
	elsif ( -d "$current_dir/$entry" )
	{
	    if ( $debug > 5 )
	    {
	        print "DEBUG - DIR\t$entry\n";
	    }

    	    #
	    # move into new dir and start over
	    #
	    &scan_dir( "$current_dir/$entry" );
	}
	else
	{
	    if ( $debug > 5 )
	    {
		print "DEBUG - \[$current_dir $entry\]\n";
	    }
	}
    }

    closedir( $dir_stack[0] );

    pop( @dir_stack );

    if ( @dir_stack == 0 )
    {
	if ( $debug > 5 )
	{
	    print "DEBUG - At end of starting directory\n";
	}
    }

    return $TRUE;
}
-----

Ron

"Sameer G. Naik" wrote:
> 
> Hello Friends,
> 
>         Is it possible to have recursion in Perl ?
>         I want to traverse directory tree recursively.
>         Or is there any function which would traverse
>         the given node and return all the filenames
>         ( like C function FTW ) ?
> 
> Thanks,
> Sameer G. Naik.
> naik@omsi.com

-- 
+--------------------------------------------------------+
|   Ron Dilley          Sr. UNIX Network Administrator   |
|   ron.dilley@ada.com          Applied Digital Access   |
+--------------------------------------------------------+


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

Date: 6 Apr 1999 21:30:27 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Recursion in Perl
Message-Id: <7edudj$m7t$2@client2.news.psi.net>

Sameer G. Naik (naik@omsi.com) wrote on MMXLIV September MCMXCIII in
<URL:news:370A50A4.B858BD4C@omsi.com>:
<> Hello Friends,
<> 
<> 	Is it possible to have recursion in Perl ?

What happened when you tried?

<> 	I want to traverse directory tree recursively.
<> 	Or is there any function which would traverse
<> 	the given node and return all the filenames
<> 	( like C function FTW ) ?


File::Find



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


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

Date: 6 Apr 1999 21:34:28 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Recursion in Perl
Message-Id: <7edul4$29g$1@gellyfish.btinternet.com>

On Tue, 06 Apr 1999 11:21:24 -0700 Sameer G. Naik wrote:
> Hello Friends,
> 
> 	Is it possible to have recursion in Perl ?
> 	I want to traverse directory tree recursively.
> 	Or is there any function which would traverse
> 	the given node and return all the filenames
> 	( like C function FTW ) ?
> 

You *can* do recursion yes.  But in this case you probably want to use
the module File::Find which is part of the distribution.

/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: 6 Apr 1999 20:12:05 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Regular Expression
Message-Id: <7edpql$5ge$3@info2.uah.edu>

In article <7edlo0$cqf$1@nnrp1.dejanews.com>,
	kelly_d@my-dejanews.com writes:
: I am interested in creating a regular expression for finding words
: that are in CAPTIAL letters in any one line.  All I have succeeded in
: doing is finding 1 captial letter in every line by the use of
: /[A-Z]+/ expression.
: 
: However to get at least one full word I have to type [A-Z][A-Z] etc.

I imagine you're doing something like

    #! /usr/bin/perl -w

    use strict;

    my $str = "This SENTENCE has SOME words in all CAPS.";

    while ($str =~ /([A-Z]+)/g) {
        print "I found `$1'\n";
    }

whose output is

    I found `T'
    I found `SENTENCE'
    I found `SOME'
    I found `CAPS'

Perl's regular expression language contains the metasequence \b that
matches word boundaries.  (Read the perlre manpage for the exact
definition of a word boundary.)  You could take advantage of \b like

    #! /usr/bin/perl -w

    use strict;

    my $str = "This SENTENCE has SOME words in all CAPS.";

    while ($str =~ /\b([A-Z]+)\b/g) {
        print "I found the word `$1'\n";
    }

to see this output

    I found the word `SENTENCE'
    I found the word `SOME'
    I found the word `CAPS'

Keep in mind that the expression [A-Z]+ won't match words like KVLN.
If you're concerned about having a regular expression that works with
the current locale setting, you'll have to wait for someone to implement
POSIX [:isupper:] and friends or do it yourself and submit the patch to
p5p. :-)

Hope this helps,
Greg
-- 
Nothing defines humans better than their willingness to do irrational things
in the pursuit of phenominally unlikely payoffs. 
    -- Scott Adams


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

Date: 6 Apr 1999 19:57:41 GMT
From: Jeff Stampes <stampes@xilinx.com>
Subject: Re: Regular Expression
Message-Id: <7edovl$kh1@courier.xilinx.com>

kelly_d@my-dejanews.com wrote:
: I am interested in creating a regular expression for finding words that are in
: CAPTIAL letters in any one line.  

/\b[A-Z]+\b/

-- 
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: 6 Apr 1999 20:02:07 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: setting env variables, sourcing, etc.
Message-Id: <7edp7v$5ge$2@info2.uah.edu>

In article <370A5349.DBFC7D1C@ccrsdotnrcandotgc.ca>,
	Tom Kralidis <tom.kralidis@ccrsDotnrcandOtgc.ca> writes:
: I have made a script to create a directory structure for day-to-day lab
: operations.  It works fine, however, I tried setting an environment
: variable in one of the directories, and when executing the script, I
: received an error message.  I tried this with a simple 
: 
: system("cd tables;setenv TABLES $cwd");
: 
: and was not successful.

That's because system() starts a child process (a shell) whose
environment goes away when the child exits.  A Unix child process
does not have access to its parent's environment.

Read the perlvar manpage.  It talks about Perl's so-called magic
variables, including one that gives you access to your process's
environment.

Greg
-- 
A great problem of contemporary life is how to control the power of
economic interests which ignore the harmful effects of their applied
science and technology.
    -- Ralph Nader


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

Date: Tue, 06 Apr 1999 16:22:43 -0500
From: "B. Zimmerman" <zim@ou.edu>
Subject: Re: Signals Question
Message-Id: <370A7B23.64041844@ou.edu>

the signal is TSTP, if that helps.

-- 
B. Zimmerman
zim@ou.edu


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

Date: 6 Apr 1999 21:57:27 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: switch statement?
Message-Id: <7ee007$opb$1@client2.news.psi.net>

du_bing@my-dejanews.com (du_bing@my-dejanews.com) wrote on MMXLIV
September MCMXCIII in <URL:news:7ed8rf$1kn$1@nnrp1.dejanews.com>:
$$ 
$$ Does Perl support switch/case statement?

That's discussed in the manual.


Abigail
-- 
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
             "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
             "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'


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

Date: 6 Apr 1999 20:41:44 GMT
From: bruce.miller@nist.gov (Bruce R Miller)
Subject: Typeglobs broken by threaded perl???
Message-Id: <7edri8$d61$2@news.nist.gov>

Consider the following example of passing a typeglob to a function 
(as an ugly way of getting pass by reference)

  $_ = "This is a TEST!";
  $::x = globtest(*_);
  print "\$::x => \"$::x\"\n";
  print "\$_   => \"$_\"\n";

  sub globtest {
      local(*::glob) = @_;
      $::glob =~ s/TEST//;
      $::glob; }

With Perl 5.005_03, compiled with threading enabled (on Irix 6.5), but NOT
using threads in this example, I get:
 $::x => ""
 $_   => "This is a TEST!"
Apparently, it attached $glob to ... nothing?
(There are other variations eg. passing an arg like *::x, or having the sub
parameter by *_, or passing a ref instead of glob ;
some variations `work', some dont)

With an unthreaded perl (5.004_01), I get what I expected:
 $::x => "This is a !"
 $_   => "This is a !"

What's up?

-- 
--
bruce.miller@nist.gov
http://math.nist.gov/~BMiller/



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

Date: 6 Apr 1999 21:02:13 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Typeglobs broken by threaded perl???
Message-Id: <7edsol$r0g$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Bruce R Miller
<bruce.miller@nist.gov>],
who wrote in article <7edri8$d61$2@news.nist.gov>:
> Consider the following example of passing a typeglob to a function 
> (as an ugly way of getting pass by reference)
> 
>   $_ = "This is a TEST!";
>   $::x = globtest(*_);

>   sub globtest {
>       local(*::glob) = @_;

Apparently, you did not try ${'_'} (no, this is not *just* a smiley).
If you would, you would see that $_ is a lexical variable in a
threaded Perl.

Ilya


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

Date: 6 Apr 1999 20:23:18 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Which text editor should I use
Message-Id: <7edqfm$27o$1@gellyfish.btinternet.com>

On 6 Apr 1999 18:55:06 GMT Jordan I. K. McClure wrote:
> gabriel_john_cohen@my-dejanews.com wrote:
> : Hello,
> : 
> : I'm trying to learn PERL on a linux machine.  Which text editor should I use?
> 
> Appleworks.
> 

gellyfish@gellyfish:/home/gellyfish/clpmtest > Appleworks
bash: Appleworks: command not found
gellyfish@gellyfish:/home/gellyfish/clpmtest > appleworks
bash: appleworks: command not found
gellyfish@gellyfish:/home/gellyfish/clpmtest > aworks
bash: aworks: command not found
gellyfish@gellyfish:/home/gellyfish/clpmtest > aw
bash: aw: command not found
gellyfish@gellyfish:/home/gellyfish/clpmtest > 

Nope that doesnt work.

I would refer the original poster to:

http://reference.perl.com/query.cgi?editors

before the usual boring thread starts about peoples editor preferences.

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

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