[10968] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4568 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 6 23:07:17 1999

Date: Wed, 6 Jan 99 20:00:17 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 6 Jan 1999     Volume: 8 Number: 4568

Today's topics:
        c2perl - heard of it? <crack0n@hotmail.com>
    Re: Can't find my way with a map (Tim Gim Yee)
    Re: filename from a filehandle <kprice@cardinal.co.nz>
        Find.pm, FindBin.pm, cwd.pm <ngaugler@ngworld.net>
    Re: How do I create a unique (reproducible) identifier? <staffan@ngb.se>
    Re: If Larry Wall's listening out there.... <andrew@geac.co.nz>
    Re: line continuation; the switch statement <staffan@ngb.se>
    Re: line continuation; the switch statement (Michael Rubenstein)
    Re: line continuation; the switch statement <rick.delaney@home.com>
    Re: line continuation; the switch statement (Larry Rosler)
    Re: line continuation; the switch statement <andrew@geac.co.nz>
    Re: Need CGI database (FirstAGYG)
    Re: OK I give up (After a WEEK!) (Ronald J Kimball)
    Re: Perl and LDAP <ltl@rgsun5.viasystems.com>
    Re: Perl and the Windows April Fools 2001 bug <mds-resource@mediaone.net>
    Re: Perl CD Bookshelf plans <mpersico@erols.com>
        perl find with -local mode ? <kj0@mailcity.com>
    Re: Problem with h2ph? <mpersico@erols.com>
    Re: Short way to do this with a regexp??....Thanks to A <mds-resource@mediaone.net>
        sldfjs <kj0@mailcity.com>
    Re: Solaris 2.6 Perl5.005_02 and h2ph problems for the  <mpersico@erols.com>
        using strict with CGI.pm <bdeitte@blue.weeg.uiowa.edu>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 07 Jan 1999 00:44:35 +0000
From: "Crack On!!" <crack0n@hotmail.com>
Subject: c2perl - heard of it?
Message-Id: <36940373.B5433FC8@compuserve.com>

I've heard of a C to Perl converter. Can anyone point me in the right
direction.

Thanks in advance.

DC
~~~~~
PS: Could you please CC my work address: derek.colley@barclays.co.uk
Thanks



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

Date: Thu, 07 Jan 1999 02:18:17 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: Can't find my way with a map
Message-Id: <36950f06.30763449@news.oz.net>

On Wed, 6 Jan 1999 09:11:05 -0800, lr@hpl.hp.com (Larry Rosler) wrote:

>In article <DR2nTBAvx4k2EwgS@connected.demon.co.uk> on Wed, 6 Jan 1999 
>16:16:47 +0000, Jerry Pank <jerryp.usenet@connected.demon.co.uk> says...
>> I want to use map to remove leading/trailing quotes that may exist in a
>> tab delimited file:
>> 
>> Something along the lines of:
>> 
>>         @data = map { s/^"|"$//g; } split /\t/, $line;
>> 
>> What do I need to change so @data is the result of the s/// rather than
>> the number of matches?
>
>Simpler than you expect.  The 'map' returns the value of the last 
>expression evaluated, so:
>
>          @data = map { s/^"|"$//g; $_ } split /\t/, $line;
>
>I haven't benchmarked it, but judging from the FAQ on trimming spaces 
>front and back, this might be faster (though not as clever):
>
>          @data = map { s/^"//; s/"$//; $_ } split /\t/, $line;

A mapless approach and some benchmarks:

#!/usr/bin/perl -w

use Benchmark;

my $line = join "\t", map qq["$_"], qw[Just another Perl hacker!];

timethese(20000, {
    MAP1    => sub {
        my @data = map { s/^"|"$//g; $_ } split /\t/, $line;
    },
    MAP2    => sub {
        my @data = map { s/^"//; s/"$//; $_ } split /\t/, $line;
    },
    SPLIT   => sub {
        local $_ = $line;
        s/^"//; s/"$//;
        my @data = split /"?\t"?/;
    },
});

Benchmark: timing 20000 iterations of MAP1, MAP2, SPLIT...
      MAP1:  2 wallclock secs ( 1.77 usr +  0.00 sys =  1.77 CPU)
      MAP2:  1 wallclock secs ( 1.44 usr +  0.00 sys =  1.44 CPU)
     SPLIT:  1 wallclock secs ( 0.77 usr +  0.00 sys =  0.77 CPU)


-- 
Tim Gim Yee
http://www.dragonfire.net/~tgy/moogle/
"Kupo! Round and round you go! Moogle!"


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

Date: Thu, 07 Jan 1999 15:03:16 +1300
From: Kelvin Price <kprice@cardinal.co.nz>
Subject: Re: filename from a filehandle
Message-Id: <369415E4.9F02B8CF@cardinal.co.nz>

Martien Verbruggen wrote:
> 
> In article <3693E3FD.5771FE15@inez.gsfc.nasa.gov>,
>         Jeff Cieslak <jcieslak@inez.gsfc.nasa.gov> writes:
> 
> > Is there an easy way to get the filename that is associated with
> > some (currently open) filehandle? I can get the device and inode
> > numbers from the 'stat'
> 
> No. There is no way at all. In fact, an open file does not have to
> have a file name at all anymore. It is perfectly legal to open a file
> for writing, unlink the file name, and then use the open file handle.
> Of course, when your program exits, or you close the file, the OS
> will have no reference to that file's inode anymore, and will
> clean it up.

As a system administrator I would consider that a VERY BAD practice.  If
your code goes nuts and fills the unlinked file with garbage, it is
really difficult to work out what's eating up all the disk space.

To paraphrase a well know footwear manufacturer ... "Don't do it !"


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

Date: Wed, 06 Jan 1999 21:02:29 -0500
From: Nick <ngaugler@ngworld.net>
Subject: Find.pm, FindBin.pm, cwd.pm
Message-Id: <369415B5.F2E793@ngworld.net>

Whenever we try to use Find.pm or Findbin.pm or cwd.pm we receive this
error:
abs_path" is not exported by the Cwd module at
/usr/local/lib/perl5/FindBin.pm
line 77
at /usr/local/lib/perl5/Cwd.pm line 0
"abs_path" is not exported by the Cwd module at
/usr/local/lib/perl5/FindBin.pm
line 77
at /usr/local/lib/perl5/Cwd.pm line 0

or

Undefined subroutine &Cwd::cwd called at
/usr/local/lib/perl5/File/Find.pm line 80.

What could be causing this? How can we fix it?

Nick - ngaugler@ngworld.net



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

Date: Thu, 07 Jan 1999 03:07:01 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: How do I create a unique (reproducible) identifier?
Message-Id: <369416C5.A2C089CD@ngb.se>

In a private post to me, Jeffrey R. Drumm wrote:

>>But how does this work if two processes access the same file at the >>same time (as might _very_ well be the case over the internet). Maybe
>>this was a stupid question.

>Poorly, unless you open the dbm read-only or take the (necessary)
>precaution of locking it when opening with read/write access.

So I guess the question remains... But then again the question is: What
did you really want to do, Jonathan? My guess is that you want to create
a file from something someone posted, and be able to get that
information back from some script when someone sets the same values from
some form. 

Now, honestly, there is no way to do this. X bytes of random information
cannot be represented in less than X bytes. But then again - your
information is hardly random. But how are we to be able to make
something smart out of it, if we don't know how your input looks? Then
it is all random strings to us. 

One thing i can tell you is: if all the name/value pairs come in the
same order all the time, try removing the names.
"field1=value1&field2=value2" could be written shorter "value1&value2".
If the fields have fixed width, you can ommit the '&'. If you have a
field that doesn't contain vital info, remove its value. If you have a
long field, try using just a part of it. 

If your fields don't always come in the same order -- make sure they do. 

If you want to be really smart, and you only have character values, you
could reduce the size of each caracter to 5 bits, and pack them tighter
in that way. If it's all numbers, you can at least do better than ascii.

I think this is all I can think of right now...

Staffan

PS: This problem reminds me of a story generating script. Is that what
it is? You choose from a set of values what you would like should happen
next, and if you don't like your choices, you add another choice...
Anyone should be able to "walk through" the story in any way, and at any
point they should be able to add anything... If this is the case, why
not simply use numbers for each choice? This is also a good solution if
every value in the form in the case above has a limited domain. Define
the domain, use pulldown lists with values set to numbers, and then you
get a rather short filename.


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

Date: Thu, 7 Jan 1999 14:52:48 +1300
From: "Andrew Mayo" <andrew@geac.co.nz>
Subject: Re: If Larry Wall's listening out there....
Message-Id: <7714i3$t4a$1@news.akl.netlink.net.nz>


Dennis Kowalski wrote in message <3693B4FE.32CD@daytonoh.ncr.com>...
>>
>> I use edit.com in my WINDOWS95/NT environment.
>> It gives the line numbers.
>

Nice suggestion. I thought of that but there are two annoyances.

1. It spins in an idle loop while running and sucks all your CPU up (written
for DOS, remember, it polls the keyboard all the time, I think). Annoying if
you leave it running and try to switch to another task.

2. It won't handle long file names (at least, on NT it doesn't). You might
think Microsoft ought to have fixed that but I couldn't possibly comment (as
a colleague of mine is wont to drily remark on occasion).

Unfortunately, I didn't make my point regarding notepad as an editor
clearly.

I got lots of replies along the lines of

"You should use wordsmasher 3000. It even made me a cup of coffee when I
came into work this morning. Why would anyone use notepad?".

but what I really meant when I talked about notepad was that it is standard
kit on all DOS and Windows machines - just as vi is standard on all Unix
boxes - and WordSmasher 3000 won't be. So ideally I'd like just to install
Perl and go for it. Of course, on my own machine I can install my favourite
editor.

So I think on reflection I really still would like the parser to report the
context. Someone said 'but what if the error was 100 lines earlier e.g
mismatched quote'. That's fine, just print the current line. I can quickly
find that with Edit/Find.




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

Date: Thu, 07 Jan 1999 03:19:56 +0100
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: line continuation; the switch statement
Message-Id: <369419CC.7FFD44D0@ngb.se>

Hi!

> foo|bar|pow|splat|dopey|grumpy|sleepy|kirk|picard|scotty|...... etc

You could always do 

if (m/foo|bar|pow|splat|dopey|grumpy|sleepy|kirk/ ||
    m/picard|scotty|data|enterprice/){
	print "Go ahead, make my day!";
}

But I don't know if this is kosher.

> PS: I'd like to do that for print statements too e.g
> print "twas brillig and the slithy toves did gyre and gimble in the wabe.
> All mimsy were the borogroves and the mome raths outgrabe\n";

Ah, but this is easy.

print "twas brillig and the slithy toves did gyre and gimble in the
wabe." .
      "All mimsy were the borogroves and the mome raths outgrabe\n";

Use the concatenation operator (.).

Staffan


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

Date: Thu, 07 Jan 1999 02:34:13 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: line continuation; the switch statement
Message-Id: <36971968.263437032@nntp.ix.netcom.com>

On Thu, 7 Jan 1999 14:33:05 +1300, "Andrew Mayo" <andrew@geac.co.nz>
wrote:

>Ok. I've read the FAQ and browsed through Programming Perl a couple of
>times. I still don't know how to do this:-
>
>start with a simple regex e.g
>
>if (m/a|b/)
>    {
>    do stuff...
>    }
>
>and then after much hacking a|b has grown into several lines of alternatives
>i.e
>
>foo|bar|pow|splat|dopey|grumpy|sleepy|kirk|picard|scotty|...... etc
>
>I cannot figure out how to split this neatly over several lines so as to
>preserve indentation at that point i.e
>
>    {
>    do stuff
>        {
>        more stuff
>         .....
>
>                                            {
>                                            deeply indented more stuff
>                                            if (m/foo|bar|pow........ etc,)
>
>I would like to say
>
>                                            if (m
>                                                    /foo|bar|pow|
>                                                     splat|dopey|grumpy|
>                                                     sleepy|kirk|picard|
>                                                    ....and so on
>
>but if I do this, the newlines and whitespace become part of the pattern. I
>know I could create a string containing this mess but then the assignment
>would *still* have to be on a single line.
>
>How do I split this sort of thing over several lines to preserve readability
>without inserting unwanted whitespace etc.

Look at the /x regular expression modifier (perlre).

>
>PS: I'd like to do that for print statements too e.g
>
>print "twas brillig and the slithy toves did gyre and gimble in the wabe.
>All mimsy were the borogroves and the mome raths outgrabe\n";
>
>How do I split this over multiple lines without whitespace etc. intruding
>yet still having indentation?

One possibility is

	print "twas brillig and the slithy toves did gyre and ",
	      "gimble in the wabe.  All mimsy were the borogoves ",
	      "and the mome raths outgrabe\n";

I've taken the liberty of correcting the spelling of "borogoves" :-)

>
>PPS: unrelated question; I whinged at Perl for not having a switch statement
>and not unreasonably, several people pointed me to both Programming Perl and
>CPAN for examples. I kind of liked this form, from the available choices (it
>maps reasonably well to both ksh and C idioms, though not VB, inasmuch as
>you don't drop through to the next CASE entry in VB, but that's life...):-
>
>SWITCH:
>    {
>    if (conditional1)
>            {
>            do stuff;
>            last SWITCH;
>            }
>
>    if (conditional2)
>            {
>            do other stuff;
>            last SWITCH;
>            }
>    }
>
>BUT.... if there were more than one of these in my program, the second one
>would have to have a different label at the top, not SWITCH. (AFAIK).That
>could get ugly quite quickly. Is there an elegant variant of this type of
>construct which would avoid this problem given that as I understand it
>'last' requires a label here otherwise the interior block scope is the only
>thing exited.

No.  The label is not required.  last exits the innermost loop, not
block (perlsyn).  A bare block is considered a loop, but one as the
statement in an if is not.

--
Michael M Rubenstein


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

Date: Thu, 07 Jan 1999 02:38:35 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: line continuation; the switch statement
Message-Id: <36941FE8.CACC4D06@home.com>

[posted & mailed]

Andrew Mayo wrote:
> 
> I would like to say
> 
>                                             if (m
>                                                     /foo|bar|pow|
>                                                      splat|dopey|grumpy|
>                                                      sleepy|kirk|picard|
>                                                     ....and so on
> 
> but if I do this, the newlines and whitespace become part of the 
> pattern. I know I could create a string containing this mess but then 
> the assignment would *still* have to be on a single line.
> 

Not true, you can use the concatenation operator:

$string = "twas brillig and the slithy toves did gyre and gimble in"
        . " the wabe. All mimsy were the borogroves and the mome
raths"         . " outgrabe\n";

perldoc perlop

And don't forget quotemeta or \Q if you go this route.

> How do I split this sort of thing over several lines to preserve 
> readability without inserting unwanted whitespace etc.

use /x:

if (/foo   |bar  |pow
    |splat |dopey|grumpy
    |sleepy|kirk |picard
    /x) {
 
perldoc perlre

> PS: I'd like to do that for print statements too e.g

Same as for string assignment above, or separate the strings with
commas.  Beware settings of $, in the latter case.

perldoc perlvar

> 
> SWITCH:
>     {
>     if (conditional1)
>             {
>             do stuff;
>             last SWITCH;
>             }
> 
>     if (conditional2)
>             {
>             do other stuff;
>             last SWITCH;
>             }
>     }
> 
> BUT.... if there were more than one of these in my program, the second 
> one would have to have a different label at the top, not SWITCH.

No.  Try it and see.  last and next are not goto.

[...]
> 'last' requires a label here otherwise the interior block scope is the 
> only thing exited.

Yes, but only loop blocks count, meaning you don't count the if blocks.
There is only one loop block in your example so a label is not
necessary.

perldoc perlsyn


-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Wed, 6 Jan 1999 18:42:21 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: line continuation; the switch statement
Message-Id: <MPG.10fdbee56e02c2f598997d@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <7713e3$m9c$1@news.akl.netlink.net.nz> on Thu, 7 Jan 1999 
14:33:05 +1300, Andrew Mayo <andrew@geac.co.nz> says...
 ...
+ I would like to say
+                                             if (m
+                                                  /foo|bar|pow|
+                                                   splat|dopey|grumpy|
+                                                   sleepy|kirk|picard|
+                                                     ....and so on
+ 
+ but if I do this, the newlines and whitespace become part of the 
+ pattern. I know I could create a string containing this mess but then 
+ the assignment would *still* have to be on a single line.
+ 
+ How do I split this sort of thing over several lines to preserve 
+ readability without inserting unwanted whitespace etc.

Look in perlre for the '/x' modifier, which does exactly what you want.

+ PS: I'd like to do that for print statements too e.g
+ 
+ print "twas brillig and the slithy toves did gyre and gimble in the 
wabe.
+ All mimsy were the borogroves and the mome raths outgrabe\n";
+ 
+ How do I split this over multiple lines without whitespace etc.
+ intruding yet still having indentation?

  print "twas brillig and the slithy toves ",
        "did gyre and gimble in the wabe. ",
        "All mimsy were the borogroves ",
        "and the mome raths outgrabe\n";

For uses other than print(), such as assignment, replace the commas by 
the concatenation operator ('.').

+ PPS: unrelated question; I whinged at Perl for not having a switch
+ statement and not unreasonably, several people pointed me to both
+ Programming Perl and CPAN for examples. I kind of liked this form, 
+ from the available choices (it maps reasonably well to both ksh and C 
+ idioms, though not VB, inasmuch as you don't drop through to the next 
+ CASE entry in VB, but that's life...):-
+ 
+ SWITCH:
+     {
+     if (conditional1)
+             {
+             do stuff;
+             last SWITCH;
+             }
+ 
+     if (conditional2)
+             {
+             do other stuff;
+             last SWITCH;
+             }
+     }
+ 
+ BUT.... if there were more than one of these in my program, the second
+ one would have to have a different label at the top, not SWITCH. 
+ (AFAIK).That could get ugly quite quickly. Is there an elegant variant 
+ of this type of construct which would avoid this problem given that as 
+ I understand it 'last' requires a label here otherwise the interior 
+ block scope is the only thing exited.

This works perfectly well without labels.  From perlfunc for 'last':

"If the LABEL is omitted, the command refers to the innermost enclosing 
loop."

The block that is the consequent of the 'if' is not a loop, but a 
surrounding naked block *is* a loop!

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


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

Date: Thu, 7 Jan 1999 16:40:20 +1300
From: "Andrew Mayo" <andrew@geac.co.nz>
Subject: Re: line continuation; the switch statement
Message-Id: <771arj$5hq$1@news.akl.netlink.net.nz>

Thanks for your help. I did not realise the scoping rules here for last (and
I wonder, therefore, whether the example in the FAQ wouldn't be cleaner
without the label, therefore). I sort of thought, being a novice, that if
this was a sample switch statement, written presumably by a non-novice, then
the label must be necessary, else why bother with it?.

Also Programming Perl lists the /x flag as 'use extended regular
expressions' and then doesn't appear to document it further. I assume it
does something quite different, by the sound of things....




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

Date: 7 Jan 1999 03:49:28 GMT
From: firstagyg@aol.com (FirstAGYG)
Subject: Re: Need CGI database
Message-Id: <19990106224928.00803.00009056@ng-fv1.aol.com>

I use a simple database sort of like that myself, for "e-pals." I think i found
it at http://www.cgi-resources.com. I implemented this before i actually
learned perl myself, so i didnt really alter it. Check out that site, you can
find scripts for almost any need.

John




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

Date: Wed, 6 Jan 1999 21:13:46 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: OK I give up (After a WEEK!)
Message-Id: <1dl8a0v.pyjqne180mo7kN@bay2-91.quincy.ziplink.net>

Marc Austin <placeit@easyad.com> wrote:

> Thanks everyone for your help (especially Greg!)  This has to be the most
> helpful newsgroup on the Net!

If people keep telling us this, we're going to start believing it.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 7 Jan 1999 02:35:56 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Perl and LDAP
Message-Id: <7716ic$381$1@rguxd.viasystems.com>

Mike Bryan <mab@hrb.com> wrote:
:>Hello,

:>Excuse my ignorance since I know very little about Perl.
:>That said, my question concerns Perl and LDAP.  Basically, we a Netscape
:>LDAP server that we need to authenticate username and passwords against
:>before a user is allowed onto a select group of web pages (a very simple
:>user validiation).
:>Is this possible in Perl (i.e. Do I need to learn Perl)?

It is certainly possible.  Whether or not you need to learn Perl is a
mostly unrelated question.  If you already know C, you can use the
LDAP API directly (along with whatever API the Netscape server
provides).  Learn Perl because you see the potential (or not).  If
this is a good project to prompt you to learn to use Perl, then go
for it; otherwise, use whatever language you already know and love.
If you do go about learning Perl, I think you will like it.  I am
certainly having fun with it.  

:>Does anybody have any suggestions to where I might look to find scripts
:>that may already do something similiar?  (I have already looked at a lot
:>of LDAP sites such as Netscape and U. of Mich).

I found Net::LDAPapi on CPAN.  I downloaded the README file and read it.
Per the instructions I downloaded the Netscape LDAP library and
installed it.  Then I downloaded and installed Net::LDAPapi using that
library.  It all works very well for me unders Solaris 2.5.1.

HTH

-- 
// Lee.Lindley   | There was a time when I thought that "being right"
// @bigfoot.com  | was everything.  Then I realized that getting along
//    | was more important.  Still, being right is more fun!
//    | And if I'm wrong, somebody will get some joy out of telling me!


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

Date: Wed, 06 Jan 1999 20:34:07 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Perl and the Windows April Fools 2001 bug
Message-Id: <36941D1F.7C6CD75F@mediaone.net>

And, of course, compiled with EGCS on NT:

D:\PERL5\TMP>y2k_dst.plx
Sun Apr  1 16:00:00 2001 (DST)
Sat Apr  7 10:00:00 2001 (DST)
Sun Apr  8 09:00:00 2001 (DST)

D:\PERL5\TMP>perl -v

This is perl, version 5.005_02 built for MSWin32-x86

Copyright 1987-1998, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.


D:\PERL5\TMP>perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 02) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86
    uname=''
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-g -O2 ', gccversion=
    cppflags='-DWIN32'
    ccflags ='-g -O2  -DWIN32   '
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -Ld:\egcs-1.1\lib '
    libpth=d:\egcs-1.1\lib
    libs= -ladvapi32 -luser32 -lnetapi32 -lwsock32 -lmingw32 -lgcc
-lmoldname -lcrtdll -lkernel32
    libc=-lcrtdll, so=dll, useshrplib=yes, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll  -Ld:\egcs-1.1\lib '


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY
  Built under MSWin32
  Compiled at Jan  2 1999 00:19:13
  @INC:
    d:\perl5\5.00502.egcs\lib/MSWin32-x86
    d:\perl5\5.00502.egcs\lib
    d:\perl5\site\5.00502.egcs\lib/MSWin32-x86
    d:\perl5\site\5.00502.egcs\lib
    d:\perl5\site\lib
    .

Matthew Bafford wrote:
> 
> In article <3692E254.4153E3D@tiac.net>, smiths@tiac.net pounded in the
> following:
> => Hello,
> 
> [snip]
> 
> => My question, will Win32 Perl programs also fail on April 1, 2001
> => because the Windows Perl interpreter uses the broken Visual C++
> => localtime() function?  I am was hoping that someone could write
> => a quick test in Perl for this bug and post the results.
> 
> Well, you could directly translate the code in the article, but that's
> messy...
> 
> How about:
> 
> #!/usr/bin/perl -w
> 
> print get_time(0x3AC796D0), "\n";  # Sunday,   April 1, 2001
> print get_time(0x3ACF2B70), "\n";  # Saturday, April 7, 2001
> print get_time(0x3AD06EE0), "\n";  # Sunday,   April 8, 2001
> 
> sub get_time {
>         my $time = shift;
> 
>         $_  =  localtime($time);
>         $_ .= (localtime($time))[8] ? " (DST)" : "";
> }
> __END__
> Sun Apr  1 16:00:00 2001
> Sat Apr  7 10:00:00 2001
> Sun Apr  8 10:00:00 2001 (DST)
> 
> ---
> 
> perl -v :
> 
> This is perl, version 5.005_02 built for MSWin32-x86-object
> 
> Copyright 1987-1998, Larry Wall
> 
> Binary build 508 provided by ActiveState Tool Corp.
> http://www.ActiveState.com
> Built 16:22:15 Dec 22 1998
> ...
> 
> The above produces the correct results with my Linux based Perl, of
> course. :)
> 
> => TIA,
> 
> HTH,
> 
> => Richard
> 
> --Matthew

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


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

Date: Wed, 06 Jan 1999 22:58:43 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Perl CD Bookshelf plans
Message-Id: <369430F3.3C56FE2C@erols.com>

Get the new perl/tk book in there.

Chris Maden wrote:
> 
> Question for the Perl community:
> 
> We're getting ready to put together _The Perl CD Bookshelf_.  Like the
> other O'Reilly CDs, it'll be a bunch of books as HTML files with a
> combined index and search engine.  The current plan is to have five
> books:
> 
> _Advanced Perl Programming_
> _Perl Cookbook_
> _Programming Perl_
> _Perl in a Nutshell_
> _Perl 5 Pocket Reference_
> 
> The question is, would it be useful to also include _Learning Perl_
> and _Learning Perl on Win32 Systems_?  I know that most people on this
> list no longer need these books, but would you have wanted them?
> Would a beginner (as we all once were) be likely to purchase such a
> comprehensive CD?  Would an expert be annoyed at search hits coming up
> in the introductory books?
> 
> Simple yes/no responses should probably be sent directly to me, to
> avoid "me-too"ing.  If you want to discuss it on the list, go ahead (I
> certainly won't stop you), but I'm not sure people will actually care.
> 
> -Chris
>  JAPH; IANA marketing research consultant, but I play one on USENET!
> --
> <!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN">
> <!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN"
> "<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487
> <USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek>

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


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

Date: 7 Jan 1999 03:17:24 GMT
From: kj0 <kj0@mailcity.com>
Subject: perl find with -local mode ?
Message-Id: <771904$ihl@news1.panix.com>



Many versions of the Unix find command (including the one on my
system) recognize the -local option:

  -local     True if the file physically resides on the local system;
             causes the search not to descend into remotely mounted
             filesystems.

Is there any way to tell the perl find command to behave this way?
(find2perl doesn't recognize the -local option).

Thanks,

KJ




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

Date: Wed, 06 Jan 1999 22:54:00 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Problem with h2ph?
Message-Id: <36942FD8.8E0CBEDD@erols.com>

It's a bug. I've set up 5.005_03, maint. relase, trial 1 and although I
didn't have all these problems, the ones I did have go away.

Clay Irving wrote:
> 
> Environment: Solaris 2.6, Perl 5.005.02
> 
> Has anyone bumped into this before? -- I received this error message:
> 
> Bareword found where operator expected at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/sys/feature_tests.ph line 20, near """invalid"
>         (Missing operator before invalid?)
> Bareword found where operator expected at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/sys/feature_tests.ph line 20, near "invalid _FILE_OFFSET_BITS"
>         (Do you need to predeclare invalid?)
> String found where operator expected at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/sys/feature_tests.ph line 20, near "specified"""
> syntax error at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/sys/feature_tests.ph line 20, near """invalid "
> BEGIN failed--compilation aborted at /usr/local/bin/mon line 35.
> 
> Looking at line 20 of feature_tests.ph:
> 
>     15      }
>     16      unless(defined(&_FILE_OFFSET_BITS)) {
>     17          eval 'sub _FILE_OFFSET_BITS () {32;}' unless defined(&_FILE_OFFS
> ET_BITS);
>     18      }
>     19      if((defined(&_FILE_OFFSET_BITS) ? &_FILE_OFFSET_BITS : 0) - 0!= 32 &
> & (defined(&_FILE_OFFSET_BITS) ? &_FILE_OFFSET_BITS : 0) - 0!= 64) {
>     20          die(""invalid _FILE_OFFSET_BITS value specified"");
>     21      }
>     22      if((defined( &_XOPEN_SOURCE)  && (defined(&_XOPEN_SOURCE_EXTENDED) ?
>  &_XOPEN_SOURCE_EXTENDED : 0) - 0== 1)) {
>     23          eval 'sub _XPG4_2 () {1;}' unless defined(&_XPG4_2);
>     24      }
> 
> I changed line 20 to:
> 
>     die("invalid _FILE_OFFSET_BITS value specified");
> 
> and the program now works fine.
> 
> There are other files built built by h2ph that have the same problem:
> 
>    /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
>    -------------------------------------------------
>    aio.ph:     die(""POSIX Asynchronous I/O is not supported in POSIX.1-1990"");
>    libelf.ph:  die(""large files are not supported by libelf"");
>    mqueue.ph:  die(""POSIX Message Passing is not supported in POSIX.1-1990"");
> 
>    /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/sys
>    -----------------------------------------------------
>    isa_defs.ph:   die(""SPARC Versions 8 and 9 are mutually exclusive choices"");
>    isa_defs.ph:   die(""unknown SPARC version"");
>    isa_defs.ph:   die(""ISA not supported"");
>    model.ph:      die(""No DATAMODEL_NATIVE specified"");
>    old_procfs.ph: die(""Cannot use procfs in the large file compilation environment"");
>    procfs.ph:     die(""Cannot use procfs in the large file compilation environment"");
> 
> Is this a bug or a feature? :)
> 
> --
> Clay Irving
> clay@panix.com

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


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

Date: Wed, 06 Jan 1999 21:51:35 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Short way to do this with a regexp??....Thanks to All
Message-Id: <36942F47.7E1D1E44@mediaone.net>

Although, Master Larry always intones, ``TIMTOWTDI'' it is often
enlightening to note the differences between various methods.

In this case, consider substitution with alternation, substitution with
character class and transliteration:

# # # # # # # # # #

use Benchmark;
use vars qw($test);
$test =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ*abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ|abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

timethese (1000000, {
        'alter' => q{
				my $string = $test;
				$string =~ s!(\\|/|:|\*|\?|"|<|>|\|)! !g;
        },
        'class' => q{
				my $string = $test;
				$string =~ s![\\/:*?"<>|]! !g;
        },
        'tr' => q{
				my $string = $test;
				$string =~ tr#\\/:*?"<>|# #;
        },
});

# # # # # # # # # #

D:\PERL5\TMP>subst.plx
Benchmark: timing 1000000 iterations of alter, class, tr...
     alter: 851 wallclock secs (851.04 usr +  0.01 sys = 851.05 CPU)
     class: 43 wallclock secs (41.97 usr +  0.00 sys = 41.97 CPU)
        tr: 12 wallclock secs (10.78 usr +  0.00 sys = 10.78 CPU)

# # # # # # # # # #

Charles Wilt wrote:
> 
> Thanks to all who replied,
> 
> I'm using the tr solution.  But will look at the others mentetioned to
> learn more.

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


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

Date: 7 Jan 1999 02:21:35 GMT
From: kj0 <kj0@mailcity.com>
Subject: sldfjs
Message-Id: <7715nf$hjr@news1.panix.com>




Many versions of the Unix find command (including the one on my
system) recognize the -local option:

  -local     True if the file physically resides on the local system;
             causes the search not to descend into remotely mounted
             filesystems.

Is there any way to tell the perl find command to behave this way?
(find2perl doesn't recognize the -local option).

Thanks,

KJ




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

Date: Wed, 06 Jan 1999 22:34:24 -0500
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Solaris 2.6 Perl5.005_02 and h2ph problems for the aub script
Message-Id: <36942B40.9278F0F5@erols.com>

This is fixed in 5.005_03 maint. release. But it is not offical. It is
the first trial of 5.005_03

"M.J.T. Guy" wrote:
> 
> Lyle Merdan <lyle@visi.com> wrote:
> >I'm having trouble with the aub script. It says that it cannot find the
> >sys/socket.ph.
> 
> I've no idea what the "aub" script is, but sys/socket.ph is ancient
> history.    The proper way to get at socket constants is
> 
>     use Socket;
> 
> Mike Guy

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


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

Date: Wed, 6 Jan 1999 21:27:32 -0600
From: Brian Deitte <bdeitte@blue.weeg.uiowa.edu>
Subject: using strict with CGI.pm
Message-Id: <Pine.A41.3.95.990106210835.43180A-100000@red.weeg.uiowa.edu>

My first clpm message.  Ah, masochism at its best.

I've been writing cgi scripts without 'use strict' since I like using
CGI.pm without the explicit calls to the object.  Is there a way I can use
strict in this contex (that is some way other than adding '$q->' to a
lot of function calls)? It'd make my life a lot less painful. -Brian



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

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

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