[6417] in Perl-Users-Digest
Perl-Users Digest, Issue: 42 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar  3 18:39:48 1997
Date: Mon, 3 Mar 97 15:00:26 -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           Mon, 3 Mar 1997     Volume: 8 Number: 42
Today's topics:
     Re: [Q] Extract a regex ("John Dallman")
     Re: [Q] Perl in win3.11? (Ilya Zakharevich)
     Re: `FILNAME` accesses floppy drive before current driv <merlyn@stonehenge.com>
     Re: Beginner - simple problem (Bob Wilkinson)
     Re: Beginner Perl/CGI (Craig S. Riter)
     Re: can $_ be dissociated from its contents? (Ilya Zakharevich)
     Re: Converting date "serial number" back to a "normal"  (Michael Fuhr)
     Re: Going from adequate to expert Perl <murali@internix.com>
     Re: How can I get colored screen text using perl5? <rra@cs.stanford.edu>
     Re: How to flush in perl. <nachtigall@edcserver1.cr.usgs.gov>
     How to make perl scripts appear locally on the browser herryh@xs4all.nl
     Re: How to spam - legitimately <merlyn@stonehenge.com>
     Re: Interview With The Internet's Wise Guys Of Perl - W (Abigail)
     Re: IP Address to Host Name code WANTED (Michael Fuhr)
     Load Balancing in PERL <steve@prilnari.com>
     looking for undump (D. Cameron Mauch)
     Re: looking for undump (Nathan V. Patwardhan)
     passing hidden input from cgi to perl script <futurecard@netstorage.com>
     Perl filehandling nrao@achilles.net
     Re: Perl for Win3.11 <nachtigall@edcserver1.cr.usgs.gov>
     Re: Perl on NT 4.0 - HOW? <owen,singleton@dial.pipex.com>
     pod2html generates incorrect html <udeupct@sco.lexis-nexis.com>
     Re: pod2html generates incorrect html <eryq@enteract.com>
     Re: Programming Perl, ftp site, question <rootbeer@teleport.com>
     Re: Programming Perl, ftp site, question (Martin Cohen)
     Public domain DES and other crypto code in Perl? (Aviel Rubin)
     Q:  Problem with Perl 4.036 running under HP-UX (Leonard I Goodman)
     Re: redirecting STDERR <rra@cs.stanford.edu>
     Re: seek and tell <nachtigall@edcserver1.cr.usgs.gov>
     Re: Sort to my brain explodes (Andrew M. Langmead)
     system() question (a hand full of hair) <bartolonem@med.ge.com>
     Re: The fabulous pink camel (or red, if you prefer that (Jeffrey)
     Re: Trying to understand regex's (Jeffrey)
     URL-Updates using Win32::Internet? <mkruse@shamu.netexpress.net>
     Re: Validating data using // <mcontois@sig.bsh.com>
     writing to file (mv)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 3 Mar 1997 21:20:20 GMT
From: jgd@cix.compulink.co.uk ("John Dallman")
Subject: Re: [Q] Extract a regex
Message-Id: <E6HKLx.3wE@cix.compulink.co.uk>
Vegard Bakke <vegardb@knoll.hibu.no> wrote:
> I would like to "move" the matching pattern from a regex in
> a string to a new variable.
> 
> Lets use the three first random cahacters as an example ( /^.{3}/ ).
> $OrgStr="1234567890";
> $NewStr="";
> In this example I would like the result to be:
> $OrgStr="4567890";
> $NewStr="123";
> 
> This is just an example. I after a solution that does this with
> any regex. (Not only /^.{3}/.)
Well, try:
if( ($OrgStr =~ /^.{3}/) == 1)  # Check there was only one match
{
        $NewStr = $&;
        $OrgStr = $` . $';
}
If you don't check that there was only one match, the concepts of $` and 
$' become more complicated, though $+ might help.
See the Perl man pages on special variables, 
John Dallman, jgd@cix.co.uk. A micro-FAQ on things I keep getting asked: 
#!perl is at ftp://.../CPAN/ports/msdos/tips-tricks/hbp_403.zip, BigPerl 
for MS-DOS can be found in CPAN via http://www.perl.com, Perl for NT/Win 
95 can be found at http://www.activeware.com, with an excellent FAQ file 
at http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html and 
no, I don't have the slightest idea what's wrong with your CGI script.
------------------------------
Date: 3 Mar 1997 21:16:31 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: [Q] Perl in win3.11?
Message-Id: <5fff3f$of0$2@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ric Harwood
<ric@discoveryinternational.com>],
who wrote in article <331a2c0b.10087964@news.demon.co.uk>:
> Still struggling. Some things make sense and seem to happen according
> to plan, but others leave me bewildered.
> >Go to the c:\perl\bin directory and use emxbind to extract the a.out
> >module from perl_.exe, something like:
> >
> >        emx emxbind.exe -x perl_.exe perl.out
> >
> >Use emxbind to bind the a.out module with the emxl.exe stub:
> >
> >        emx emxbind.exe emxl.exe perl.out perl.exe
> >
> >Assuming that worked, you can now delete the following files:
> 
> All seemed to go well.
Note that it should be enough to put rsx.exe on your path, and run
perl_.exe. The best way should be to bind rsx.exe (or is it csx.exe in
newest RSX?) to perl_.exe.
> When I try to run perl5003.exe I just get:
Do not. Run either perl_, or the executable you created above.
Do not forget to get
	a) Newest rsx (5.10) (I got it from LEO) - long-file-names on W95;
	b) sh_dos.zip from 
		ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2
	   - backticks and pipes working
	c) set PERL_SH_DIR to directory part of sh.exe WITH FORWARD
	   SLASHES. 
Ilya
------------------------------
Date: 03 Mar 1997 15:58:15 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: dbenhur@egames.com
Subject: Re: `FILNAME` accesses floppy drive before current drive
Message-Id: <8cn2skk2go.fsf@gadget.cscaper.com>
>>>>> "Devin" == Devin Ben-Hur <dbenhur@egames.com> writes:
Devin> But, the next question is why, oh, why are you doing:
>> print `type poll.dat`;
Devin> instead of:
Devin>   open(FILE,"poll.dat") or die(...);
Devin>   print <FILE>;
Devin> and avoiding the extra shell execution?
Or even:
	use File::Copy;
	copy "poll.dat", *STDOUT;
:-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 546 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
-- 
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@ora.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
------------------------------
Date: Mon, 03 Mar 1997 14:24:07 -0500
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Beginner - simple problem
Message-Id: <b.wilkinson-0303971424070001@ip57-york.pindar.co.uk>
In article <5fedfo$vv@m1.cs.man.ac.uk>, turnerm@cs.man.ac.uk wrote:
> Hi,
> 
> I am a newcomer to perl and as much I am enjoying using perl I have a
little problem.  In my program I need the directory path.  I am trying to
use the UNIX pwd command from perl, using the system() command, and trying
to put the result into a variable $original_dir.  I have tried things like
> 
> 
> 
> system("pwd >$original_dir");
> 
> system("(pwd; >$original_dir &");
> 
> 
> 
> 
> without any success.
> 
> Can anybody help please.
> 
> Cheers,
> 
> Mark Turner....
Try using the module "Cwd". Available from all good CPAN stores.
Bob
-- 
All is flux, nothing is still; nothing endures but change
- Heraclitus
------------------------------
Date: Mon, 03 Mar 1997 18:43:56 GMT
From: criter@lucent.com (Craig S. Riter)
Subject: Re: Beginner Perl/CGI
Message-Id: <331b1ab3.16352688@nntp.cb.lucent.com>
You have a coding error.  When you run it from the command line the
message you got was an error in your program.  It will not work from
the command line or as a CGI program until you fix that.
You can check the syntax of a message with
%perl -c script.pl
This will check your syntax and make sure it is compilable.
You may want to post your source if you can see the problem.
Craig
criter@riter.com
On Sun, 02 Mar 1997 22:53:52 -0500, Mark Schwartz <fortune@in.net>
wrote:
>See attachment.
______________________________________________________________________
Craig S. Riter         criter@riter.com         criter@povpartners.com
www.riter.com                           PGP key available upon request
It infuriates me to be wrong when I know I'm right.           -Moliere
------------------------------
Date: 3 Mar 1997 21:07:13 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: can $_ be dissociated from its contents?
Message-Id: <5ffei1$of0$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Rahul Dhesi
<c.c.eiftj@66.usenet.us.com>],
who wrote in article <5f7tm3$6rv@samba.rahul.net>:
> Support $_ holds a big (1-meg) string.  We want to push a copy of this
> string onto @::ARRAY and then reuse $_ for other purposes.
In perl-speak, you want to steal the (char*) part of a Perl
variable. There is no support for this in current Perl, and I see no
need for it.
Note that the current perl will not even steal the contents of
temporaries (unless mortal), and 5.004 will not as well (as bad?).  (I
hope my patch for this is going to be in 5.005.)
> One possible application of the above optimization is to efficiently
> implement the following:
> 
>      while (<STDIN>) {
>         print $_;
>         push(@::ARRAY, $_);
> 	scalar(@::ARRAY) > 10 && shift(@::ARRAY);
>      }
> 
> Which copies STDIN to STDOUT and also saves the last 10 lines in memory.
> It's nice to not copy all data twice.
Why not use 
	while (defined ($ARRAY[@ARRAY] = <STDIN>))
instead? <> is optimized to directly set its "argument" (whether $_ or
not).
Ilya
------------------------------
Date: 3 Mar 1997 13:28:49 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Converting date "serial number" back to a "normal" date
Message-Id: <5ffca1$ej4@nova.dimensional.com>
In article <01bc22fe$6d64ee60$011618cb@caesar.bit.net.au>, "Andrew
Pollock" <apollock@bit.net.au> wrote:
>> I am trying to convert the output of a /bin/date +%j back into a normal
>> date. I understand that this value is not the Julian date in the manner of
>> speaking that the Date modules I have looked at from CPAN are talking
>> about. Is there any easy way of doing this?
>> 
>> Eg. date +%j = 056, 56 = Feb 25, 1997.
Here's an example using Date::Manip.  It always assumes your day
is in the current year:
    #!/usr/local/bin/perl -w
    use Date::Manip;
    $j = 56;
    $date = &DateCalc("1 Jan", "+" . ($j - 1) . " days");
    print &UnixDate($date, "%b %e, %Y\n");
Here's the output:
    Feb 25, 1997
Hope this helps.
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Mon, 3 Mar 1997 20:31:41 GMT
From: Murali Donthireddy <murali@internix.com>
Subject: Re: Going from adequate to expert Perl
Message-Id: <331B352D.5AA@internix.com>
You are half way there, by 
 - recognizing that there is a difference between you and the best.
 - and wanting to get better.
I feel like you sometimes. OTOH, I see some people who don't
think they need to learn any more, but I feel like a master compared
to them.
I think part of the reason the "masters" are so good is that they
have stong knowledge in areas not strictly Perl:
like Programming language theory, Operating systems, UNIX etc.
I won't pretend to give you "advice", but something to think about:
Have you subconciously(or not so subconsciously) glossed over
parts of the Perl manpages(i have) because they were too difficult
to understand? 
If the answer is no
	I would say you are an expert already. Most Perl
	programmers don't understand everything in the manpages
else
	You can work on the pieces you don't understand.
	But this might take you deep into subjects of OS & languages,
	which was my earlier point
I would like to see some comments from the experts like
Randall & Tom on this.
Murali
Just another Perl wannabe,
Peter Scott wrote:
> 
> This might sound familiar to a number of people out there.
> I've been programming Perl for a few years now and can do a pretty
> good job.  I know lots of shortcuts that Perl provides rather than
> simply writing C-, or Fortran-, or Pascal-type code translated into
> Perl.  Nevertheless, there are times when I look at code fragments
> written by masters and think, I'm not even on the same planet.
> 
> So what does one do to make the transition?  Is there any better way
> than just poring over CPAN and trying to understand the code?  Even if
> not, whose code should I look at, which provides examples of good coding
> along with sufficient comments to understand why particular choices were
> made?
> 
> --
> This is news.  This is your      |  Peter Scott, NASA/JPL/Caltech
> brain on news.  Any questions?   |  (Peter.J.Scott@jpl.nasa.gov)
> 
> Disclaimer:  These comments are the personal opinions of the author, and
> have not been adopted, authorized, ratified, or approved by JPL.
------------------------------
Date: 03 Mar 1997 10:46:57 -0800
From: Russ Allbery <rra@cs.stanford.edu>
To: revjack@radix.net
Subject: Re: How can I get colored screen text using perl5?
Message-Id: <qumg1ycq0da.fsf@cyclone.stanford.edu>
[ Posted and mailed. ]
revjack@radix net <(revjack@radix.net)> writes:
> I've searched the perl man pages, the FAQ at
> ftp://uiarchive.cso.uiuc.edu, and the camel book, to no avail. Can
> anyone tell me how to change the text color when I output to the screen
> under unix SunOS5? I am hoping to do this with escape codes like in
> other languages.
Grab my Term::ANSIColor module from either CPAN (modules/by-module/Term)
or from ftp.eyrie.org in /pub/software/modules.  It will handle everything
for you, has a fairly clean interface, and has a few additional helpful
features that should make handling color a bit easier.
It's not that hard to just do it yourself, but it requires remembering all
the escape sequences, and there's no need when I do that for you.  :)
-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: Mon, 3 Mar 1997 22:02:08 GMT
From: Neal Nachtigall <nachtigall@edcserver1.cr.usgs.gov>
To: Bhasker Allam <abr@wasp>
Subject: Re: How to flush in perl.
Message-Id: <331B4A60.97A@edcserver1.cr.usgs.gov>
Bhasker Allam wrote:
> Is there a way in perl to force the output of print to
> to go the screen or file immediately. I want something
> like flush(STDOUT). Thanks in advance.
See pretty much any perl documentation for perl special variables:
(grabbed from perl man)
$OUTPUT_AUTOFLUSH 
     $| If set to nonzero, forces a flush after every write or print on
the currently selected output channel. Default is 0. Note that STDOUT
will typically
     be line buffered if output is to the terminal and block buffered
otherwise. Setting this variable is useful primarily when you are
outputting to a pipe,
     such as when you are running a Perl script under rsh and want to
see the output as it's happening. This has no effect on input buffering.
     (Mnemonic: when you want your pipes to be piping hot.) 
--
Neal L. Nachtigall * nealnach@dlgef.cr.usgs.gov 
Hughes STX (EROS Data Center)
No wonder nobody comes here--it's too crowded. -Yogi Berra
------------------------------
Date: Mon, 03 Mar 1997 20:07:15 GMT
From: herryh@xs4all.nl
Subject: How to make perl scripts appear locally on the browser
Message-Id: <331c2f41.8322468@news.xs4all.nl>
Hi,
I have a problem getting my perl-scripts to output to my browser.
presently I test my scripts by copying them to the perl\bin dir. and
run
perl myfile.pl > myfile.html
and then have my browser read myfile.html.
But what I really want is having my browser read the perl script
directly. But all that happens is a unreadably quick appearing
and disappearing dos-box saying Bad Command or Filename.
I want the same output as when I run it manually at the dosprompt
and I want the output being directed to my browser.
I installed O'reilly's Website, Netscape 3.01 and Win32 Perl.
Please help me!!!
thank in advance
Herry
------------------------------
Date: 03 Mar 1997 15:51:41 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: carroll@tjc.com (Terry Carroll)
Subject: Re: How to spam - legitimately
Message-Id: <8cu3msk2rm.fsf@gadget.cscaper.com>
>>>>> "Terry" == Terry Carroll <carroll@tjc.com> writes:
Terry> The example you're trying to give here is not of the same type.  "An
Terry> email" fills a gap in the English language.  It provides a noun for a
Terry> concept that otherwise wouldn't have one.
Funny, I find "some email" or "a piece of email" to be satisfactory.
"an email" sounds strange.  Very strange.  To my native ears.
That's because I hear "email" as derived from "mail".  I've heard
"some mail" and "a piece of mail", but never "a mail".  Ugh.  A native
speaker of American english would *never* say that.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 546 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
-- 
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@ora.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
------------------------------
Date: Mon, 3 Mar 1997 18:43:49 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: Interview With The Internet's Wise Guys Of Perl - Web Week
Message-Id: <E6HDD1.IoI@nonexistent.com>
On 3 Mar 1997 06:07:30 GMT, Mike Heins wrote in comp.lang.perl.misc:
++ 
++ Direct link, by the way, is:
++ 
++ 	http://webreview.com/97/02/28/feature/index.html
++ 
But that's still the framed version. For the real text, without the
annoying frame with animated ads, go to:
        http://webreview.com/97/02/28/feature/index2.html
and
        http://webreview.com/97/02/28/feature/perl.html
Abigail
------------------------------
Date: 3 Mar 1997 13:11:36 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: IP Address to Host Name code WANTED
Message-Id: <5ffb9o$dpe@nova.dimensional.com>
Jim Anderson  <jander@ml.com> writes:
>use Socket;
>($name) = gethostbyaddr pack('C4', split/\./, $ENV{REMOTE_HOST}), AF_INET;
I prefer this:
    $name = gethostbyaddr(inet_aton($ENV{REMOTE_ADDR}), AF_INET);
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Mon, 03 Mar 1997 16:25:52 -0600
From: Steve Wells <steve@prilnari.com>
Subject: Load Balancing in PERL
Message-Id: <331B4FF0.64EA@prilnari.com>
OPERATING SYSTEM: BSDI
PERL VER: 5.003 with EMBED + suidperl security patch
We need to send out a large number of emails, I'm not condoning this
action
just stating a fact.  While discussing this with some friends we talked
about
the best ways to make use of the server.  I must admit that I have not
looked into
sendmail enough (I'm waiting for the O'Reilly book to arrive).  One
person
recommended that if we could watch the server load as we called sendmail
we
could  have our PERL script decide whether to send another email or wait
for the load to go down.
I thought that would be great for a number of different programs we
could put
together until I thought about what this really entails.  I could use
commands like
'uptime' or 'top' and parse them but is that really the way to do this?
On my linux
system I have a /proc directory that holds that type of information but
at work
we are using a BSDI system and it doesn't have one.
Even if we don't find that we should do this with sendmail is this
something we could/should do with PERL for other programs?  You can't
really tell the server
load with a program running on the server... but we don't need to be too
exact here.
Any Suggestions greatly appreciated -- Better ones in proportion...
TIA,
STEVE
--
no sig is good sig
------------------------------
Date: 3 Mar 1997 21:40:33 GMT
From: cam@ecl.wustl.edu (D. Cameron Mauch)
Subject: looking for undump
Message-Id: <5ffggh$6n8@oldfart.ecl.wustl.edu>
Hello all.  Has any written an undump program sometime this decade?
Especially one I might be able to compile under Sun Solaris?  Thanks!
--
D. Cameron Mauch		   Unix Systems Administrator
				   Engineering Computer Laboratory
cam@ecl.wustl.edu		   School of Engineering and Applied Science
http://www.ecl.wustl.edu/~cam/	   Washington University in St. Louis
------------------------------
Date: 3 Mar 1997 22:29:42 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: looking for undump
Message-Id: <5ffjcm$1gu@fridge-nf0.shore.net>
D. Cameron Mauch (cam@ecl.wustl.edu) wrote:
: Hello all.  Has any written an undump program sometime this decade?
: Especially one I might be able to compile under Sun Solaris?  Thanks!
SUN OS 4 - maybe.  Solaris, no, or probably not.  I suspect that you'd
be better off with the Perl compiler that's in Alpha.  ;-)
--
Nathan V. Patwardhan
nvp@shore.net
"What is your quest?"
------------------------------
Date: Mon, 03 Mar 1997 15:32:29 -0500
From: John Cervini <futurecard@netstorage.com>
Subject: passing hidden input from cgi to perl script
Message-Id: <331B355D.54EC@netstorage.com>
I want to pass the date to a perl script.  I thought about doing it like
this:
(html cgi form)
<input type="hidden" name="date" value="$today">
Of course I would declare the variable $today=`/bin/date +%m/%d/%Y`
in the perl.  This does not work.  I get the literal "$today" as a
result.
What is the proper way to do this using the 'hidden' input.
------------------------------
Date: Mon, 03 Mar 1997 13:33:22 -0600
From: nrao@achilles.net
Subject: Perl filehandling
Message-Id: <857416804.16179@dejanews.com>
I'm trying to do some very simple Perl filehandling -- basically just
opening a file, writing to it and then closing it using these lines of
code:
#!/bin/perl
open(F,">>testfile");
print F "This line goes to the file.\n";
close(F);
This doesn't work. I assume I am making some small sytax error. The file
executes and doesn't display any errors, however, it does not append to
testfile. It doesn't even open the file. Can anyone help me out with
this??
Thanx,
Nithin.
-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
------------------------------
Date: Mon, 3 Mar 1997 21:18:38 GMT
From: Neal Nachtigall <nachtigall@edcserver1.cr.usgs.gov>
To: Ying Hu <Y_Hu@fccc.edu>
Subject: Re: Perl for Win3.11
Message-Id: <331B402E.3774@edcserver1.cr.usgs.gov>
Ying Hu wrote:
> Where is the Perl for Window3.11 ?
Try:  http://www.cs.ruu.nl/~piet/perl5dos.html
--
Neal L. Nachtigall * nealnach@dlgef.cr.usgs.gov 
Hughes STX (EROS Data Center)
No wonder nobody comes here--it's too crowded. -Yogi Berra
------------------------------
Date: 3 Mar 1997 22:47:16 GMT
From: "Owen Singleton" <owen,singleton@dial.pipex.com>
Subject: Re: Perl on NT 4.0 - HOW?
Message-Id: <01bc2823$dc51dc50$0ef282c1@ozalu01>
I have had a similar, although not exactly the same, problem.  I'm using
Perl 5 (build 101 I think) on NT 4.0 workstation and Peer Web Services.  I
can get a web browser to run to execute the script but only if is in MS
Explorer.  Netscape wants to download the script and try to run it on the
client!  I haven't invested much time on this but it had puzzled me.
I think we're probably a bit off focus for this newsgroup.
------------------------------
Date: 03 Mar 1997 14:12:50 -0500
From: Caleb Deupree <udeupct@sco.lexis-nexis.com>
Subject: pod2html generates incorrect html
Message-Id: <rl1n2skg571.fsf@sco.lexis-nexis.com>
The web pages generated by pod2html (version 1.15, tested with perl
5.002, but the problem is still in the 5.003 source, sun4-solaris),
contain <CENTER> tags inside the HEAD element.  This is forbidden by the
HTML 3.2 spec, and some browsers (specifically Emacs W3) report these
pages as untitled.  I've mentioned this on the w3-beta mailing list, and
the developers there feel strongly that since this HTML is invalid,
there is no correct interpretation, and that therefore it is ok for the
browser to ignore the rest of the HEAD element and report the page
untitled.
I see in the source that the CENTER tags are omitted if $NO_NS is set,
but I can't figure out how to set this variable from the command
line.  I can make a private copy of the source, but that seems like
cheating (although I will do it if there's no other alternative).
If I were to make a private copy, this would be my patch:
*** pod2html.old	Tue Sep 17 14:28:24 1996
--- pod2html	Mon Mar  3 13:54:50 1997
***************
*** 85,93 ****
  	if ($count) {              # give us a html and rcs header
  	    open(HTML,">$html") || die "can't create $html: $ERRNO";
  	    print HTML '<!-- $Id$ -->',"\n",'<HTML><HEAD>',"\n";
- 	    print HTML "<CENTER>" unless $NO_NS;
  	    print HTML "<TITLE>$pod</TITLE>\n</HEAD>\n<BODY>";
! 	    print HTML "</CENTER>" unless $NO_NS;
  	}
  	for ($i = 0; $i <= $#all; $i++) {       # decide what to do with each chunk
  	    $all[$i] =~ /^(\w+)\s*(.*)\n?([^\0]*)$/ ;
--- 85,92 ----
  	if ($count) {              # give us a html and rcs header
  	    open(HTML,">$html") || die "can't create $html: $ERRNO";
  	    print HTML '<!-- $Id$ -->',"\n",'<HTML><HEAD>',"\n";
  	    print HTML "<TITLE>$pod</TITLE>\n</HEAD>\n<BODY>";
! 	    print HTML "<H1><CENTER>$pod</CENTER></H1>\n";
  	}
  	for ($i = 0; $i <= $#all; $i++) {       # decide what to do with each chunk
  	    $all[$i] =~ /^(\w+)\s*(.*)\n?([^\0]*)$/ ;
Does anyone have a better suggestion?  Or can anyone tell me how to set
$NO_NS from the command line?
TIA.
------------------------------
Date: Mon, 03 Mar 1997 15:15:47 -0600
From: Eryq <eryq@enteract.com>
To: Caleb Deupree <udeupct@sco.lexis-nexis.com>
Subject: Re: pod2html generates incorrect html
Message-Id: <331B3F83.214E4288@enteract.com>
Although it's not a solution to your problem, I'm in the middle
of developing a new "pod2coolhtml" utility.  Extremely-raw
and incomplete Alpha code, as well as samples of output,
available at:
	http://www.enteract.com/~eryq/CPAN/Pod
	http://www.enteract.com/~eryq/CPAN/Pod/Alpha     	
Let me know what you think.
-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |__ 
           |___/    |___/ UNIX-FM: more talk ; less yacc yacc yacc
------------------------------
Date: Mon, 3 Mar 1997 11:16:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Gregory Sherman <gjs@ucla.edu>
Subject: Re: Programming Perl, ftp site, question
Message-Id: <Pine.GSO.3.95q.970303111010.24000H-100000@kelly.teleport.com>
On Mon, 3 Mar 1997, Gregory Sherman wrote:
> The book "Programming Perl" mentions ftp sites where example 
> code from the text is available, but the code isn't there.  Anyone
> know where it can be found?
You must be using the old Camel. I heartily encourage you to get the new
one. But the sources you want should be on CPAN, in the /scripts/nutshell
directory. They may not work with current versions of Perl without some
tweaking, though.
    http://www.perl.com/CPAN/
    http://www.perl.org/CPAN/
>    Second, I would like to know what this line from page 27
> is supposed to do:  $string =~ s/(\W)/\\$1/g;
Yep, that's the old Camel! That line takes any non-word characters ('\W') 
in $string, and replaces them with a backslash ('\\') and the character
itself ('$1'). That is, it puts a backslash before every special character
in $string. That's something that had to be written so often that there's
a good shortcut for it in current versions of Perl: the quotemeta function
and the related \Q operator. 
Hope this helps!
-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/
------------------------------
Date: 3 Mar 97 20:56:51 GMT
From: mcohen@river.iro.org (Martin Cohen)
Subject: Re: Programming Perl, ftp site, question
Message-Id: <9702011554287254@FrontierTech.COM>
In message <331AEEFC.548B@ucla.edu>, gjs@ucla.edu (Gregory Sherman) writes:
-The book "Programming Perl" mentions ftp sites where example 
-code from the text is available, but the code isn't there.  Anyone
-know where it can be found?
I don't know.
-   Second, I would like to know what this line from page 27
-is supposed to do:  $string =~ s/(\W)/\\$1/g;
This will put a backslash in from of every non-alphanumeric
character.  The purpose is to escape stuff that might confuse
an interpreter like perl or a shell in its input.
Martin Cohen, AMSAA-North, Custom House Rm 800
Philadelphia, PA 19106-2976 (215) 597-8377 DSN 444-3808
mcohen@arl.mil
------------------------------
Date: 3 Mar 1997 19:12:35 GMT
From: rubin@quip.eecs.umich.edu (Aviel Rubin)
Subject: Public domain DES and other crypto code in Perl?
Message-Id: <5ff7r3$cmi$1@news.eecs.umich.edu>
Is there a public domain implementation of DES, MD5 and other crypto
algorithms? I have seen ones that are C modules that people can link
into their programs. One problem with such schemes is that usually they
are installed in a central place by a system administrator, so the entire
security of the system relies on trusting that you are linking to the
right functions.
We would like to be able to have a self-contained program where each
user has all of the code, including the crypto, locally. So, are
there any packages WRITTEN IN PERL for DES, etc.?
Avi
------------------------------
Date: Mon, 3 Mar 1997 21:08:10 GMT
From: lig@world.std.com (Leonard I Goodman)
Subject: Q:  Problem with Perl 4.036 running under HP-UX
Message-Id: <E6HK1n.Juy@world.std.com>
We have just installed Perl 4.036 onto an HP-712, 
running HP-UX 10.2.  We tried running the test
suite which is part of the Perl delivery and ran
into a problem with the test t/comp/cpp.t
This test has the following source:
#!./perl -P
open(CONFIG,"../config.sh") || die;
while (<CONFIG>) {
    if (/^cppstdin/) {
	if (/^cppstdin='(.*cppstdin)'/ && ! -e $1) {
	    print "1..0\n";
	    exit; 		# Can't test till after install, alas.
	}
	last;
    }
}
close CONFIG;
print "1..3\n";
#this is a comment
#define MESS "ok 1\n"
print MESS;
#If you capitalize, it's a comment.
#ifdef MESS
	print "ok 2\n";
#else
	print "not ok 2\n";
#endif
open(TRY,">Comp.cpp.tmp") || die "Can't open temp perl file.";
($prog = <<'END') =~ s/X//g;
X$ok = "not ok 3\n";
X#include "Comp.cpp.inc"
X#ifdef OK
X$ok = OK;
X#endif
Xprint $ok;
END
print TRY $prog;
close TRY;
open(TRY,">Comp.cpp.inc") || (die "Can't open temp include file.");
print TRY '#define OK "ok 3\n"' . "\n";
close TRY;
$pwd=`pwd`;
$pwd =~ s/\n//;
$x = `./perl -P Comp.cpp.tmp`;
print $x;
unlink "Comp.cpp.tmp", "Comp.cpp.inc";
*******  end of listing   ******
There are syntax errors reported at the line
  print TRY $prog;
(message is "syntax error, next token 'print ' ") 
and at the line
  $x = `./perl -P Comp.cpp.tmp`;
(message is "syntax error, next token '$x' ")
When running this test on a Sun Sparc with 
Solaris 2.5, these is no problem.  We will be
updating to Perl 5.xx, but we are using Perl 4.
for now.  Any help would be appreciated.
Len
------------------------------
Date: 03 Mar 1997 11:42:40 -0800
From: Russ Allbery <rra@cs.stanford.edu>
To: Daniel Fox <dfox@pobox.com>
Subject: Re: redirecting STDERR
Message-Id: <qum9144pxsf.fsf@cyclone.stanford.edu>
[ Posted and mailed. ]
Daniel Fox <dfox@pobox.com> writes:
> Is there a way to do something like
>	$var = `/usr/bin/program`;
> but have STDERR and STDOUT put into $var?
$var = `/usr/bin/program 2>&1`;
-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: Mon, 3 Mar 1997 22:34:57 GMT
From: Neal Nachtigall <nachtigall@edcserver1.cr.usgs.gov>
To: Brian Menke <bmenke@wasco.synopsys.com>
Subject: Re: seek and tell
Message-Id: <331B5211.7FEA@edcserver1.cr.usgs.gov>
Brian Menke wrote:
> I think the seek and tell functions are the way to go... but I just
> don't get how to use them. Anyone know (Besides Randal or Tom that is :-)?
The tell and seek functions return the current file position of a
filehandle and sets the filehandle to a specific position respectively.
They do not offer a means of accessing a specific file position based
on some flag or string as you would need.  The following is how
tell and seek would apply to your problem:
open (FILEH, "test.html") || die "$!\n";
while(<FILEH>)
{
  $fpos = tell(FILEH) if ($_ =~ /\<body\>/);
}
seek (FILEH,$fpos,SEEK_SET);
close(FILEH);
which really doesn't gain you much in your case. A more probable 
solution in your case may be:
open (FILEH,"test.html") || die ...;
@lines = <FILEH>;
close(FILEH);
open (FILEH, ">test.html") || die ...;
foreach $line (@lines)
{
  print FILEH $line;
  print FILEH "Here is some more text\n" if($line =~ /\<body\>/);
}
close (FILEH);
or open test.html for read and a second for write then rename second
to the first.
HTH,
--
Neal L. Nachtigall * nealnach@dlgef.cr.usgs.gov 
Hughes STX (EROS Data Center)
No wonder nobody comes here--it's too crowded. -Yogi Berra
------------------------------
Date: Mon, 3 Mar 1997 22:06:02 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Sort to my brain explodes
Message-Id: <E6HMq2.FD1@world.std.com>
David Richardson <davidr@netscape.com> writes:
>I am having a problem sorting a multi-dimensional array by one of it's
>values.I have checked out the camel books and online Perl Faq but I am
>still so confused. Let me start by telling you what I am trying to do. I
>am opening up a dbm file via a hash array. At that point I am checking
>for a particular value in a field and push that info. to a
>multi-dimensional array. I want to sort the info by a value contained in
>the multi-demensional array. I tried a number of ways of sorting the
>info but no luck. The value I want to sort by would be $cool[$i]->[11]
Each element of @cool is a reference to an array. So each time the
sort subroutine gets executed it will be passed two elements out of
@cool as variables $a and $b. You want the sort subroutine to compare
the array pointed to by $a and $b and return info depending on an
element.
@sorted = sort { $a->[11] <=> $b->[11] } @cool;
-- 
Andrew Langmead
------------------------------
Date: Mon, 03 Mar 1997 14:24:11 -0600
From: Mike Bartolone 5-4266 <bartolonem@med.ge.com>
Subject: system() question (a hand full of hair)
Message-Id: <331B336B.2781@med.ge.com>
Ok, this one just gave me a hand full of hair (as in I'm
pulling it out). It can't go on much longer..I don't have that
much hair left!
I have a perl script that creates some support files for
another program and then is supposed to run that other program. 
The support files are being created perfectly..we tested them
by having the perl script create them, and then running the
other program manually. Next step, is a mundane system call like
this:
system("program1 args");
Then the program exits (we expect it to exit here..its not dieing)
program1 seems to execute, but the output file it produces is
empty. I have tried the following:
$COMMAND="program1 args";
print "$COMMAND \n";
system("$COMMAND");
The print statement says $COMMAND is correct. I cut and paste
the output from the print statement to the command line and the
output file is fine.
I have tried using syscall() and get the same result. I have
tried 
system(program1 args);
system("program1 args");
system('program1 args');
and tried syscall() in place of system() in each of the above
examples. I even tried this:
open(CMD_FILE,">program1.sh");
print CMD_FILE "#! /bin/sh\n";
print CMD_FILE "program1 args\n";
close(CMD_FILE);
chmod(0777,"program1.sh");
system(./program1.sh);	
and
system("./program1.sh");
I still get the empty file. If, when the perl script exits, I
run ./program1.sh, the output file is produced as expected!
Any clues what cold be going wrong?
For reference, I am stuck using perl version 4.0 patch level 36
on an SGI indigo 2 running IRIX 5.3. I can't just change it (corporate
inertia).
HELP!!!!!!!!!!!!!!!!
-- 
bartolonem@med.ge.com       | May you live as long as you want to, 
                            |and may you want to as long as you live.
bartolon@execpc.com         |                     Old Irish Blessing
------------------------------
Date: 03 Mar 1997 19:00:17 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
Subject: Re: The fabulous pink camel (or red, if you prefer that), a review.
Message-Id: <JFRIEDL.97Mar4040017@tubby.nff.ncl.omron.co.jp>
Russ Allbery <rra@cs.stanford.edu> wrote:
|> Tom Grydeland <tom@palver.nospam.eiscat.no> writes:
|> > The eval trick used in the grep-like programs in chapter 6 to avoid
|> > recompiling patterns on each pass; has it been made obsolete by the /o
|> > regexp modifier?
|> 
|> No, not if you want to be able to search for multiple patterns over the
|> course of the program.  Once the /o regex has been compiled, you can't
|> ever change the pattern no matter what, so each execution of that section
|> of code will use the original pattern.  In a lot of cases, that's not what
|> you want and the eval trick is better.
I normally don't feel comfortable[*] bringing up my book in netnews (other
than in my sig), but in this case I think I can...
I wrote _Mastering Regular Expressions_ (O'Reilly) and discuss this issue
at lengh. My badge of honor is that even Tom Christansen gained insight by
reading this section. However, the discussion is short enough that you
could read and absorb all it [this particular dicussion] has to offer while
browsing in the bookstore or library. See pp 268-273. Should be shelved next
to _Programming Perl_.
	Jeffrey
* I'd like to think the book adds value to people using regular expressions
  in any language (including Perl), but would rather the book speak for
  itself than my mentioning it at every opportunity. I'm a computer geek,
  not a businessman, so I feel uncomfortable ``pushing'' my book. 
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
See my Jap<->Eng dictionary at http://www.wg.omron.co.jp/cgi-bin/j-e
O'Reilly's Regular Expression book: http://enterprise.ic.gc.ca/~jfriedl/regex/
------------------------------
Date: 03 Mar 1997 17:42:00 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: tadmc@flash.net (Tad McClellan)
Subject: Re: Trying to understand regex's
Message-Id: <JFRIEDL.97Mar4024200@tubby.nff.ncl.omron.co.jp>
[mail and post]
Tad McClellan <tadmc@flash.net> wrote:
|> : |> > ($first, $middle, $last) = (/\b(\w+)\b\s+\b(.*)\b\s?\b(\w+)\b/);
|> : |> 
|> : |> Looks to me like most (and probably all) of those word breaks (\b)
|> : |> are completely unnecessary.
|> 
|> : FWIW, only the 2nd \b is superfluous. All the others add logic or
|> : efficiency to the expression.
|> 
|> The last one can't be adding logic, there must be a /w followed by
|> a /W (or end of string) even without it.
You're absolutely right. Don't know what I was thinking....
|> So how does it add efficiency?
By discounting non-plausable matches earlier. For example, if a string
beginning with a word can't match at the beginning of the string, the
leading \b causes it to fail right away when the attempt starting before
the 2nd character is attempted. The \b is not needed in this case, since
starting at the 2nd character (inside the word) can't match if it couldn't
match starting at the beginning of the word, but the leading \b causes the
attempt to end right away.
	Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
See my Jap<->Eng dictionary at http://www.wg.omron.co.jp/cgi-bin/j-e
O'Reilly's Regular Expression book: http://enterprise.ic.gc.ca/~jfriedl/regex/
------------------------------
Date: 3 Mar 1997 19:27:51 GMT
From: Matt Kruse <mkruse@shamu.netexpress.net>
Subject: URL-Updates using Win32::Internet?
Message-Id: <5ff8nn$k2p@news1-alterdial.uu.net>
I'm going to write a script to notify me when URL's are updated.  This 
has been done a thousand times before, so if anyone has done it on NT 
using Win32::Internet and would like to share the code it would make my 
life easier.
Thanks!
-- 
Matt Kruse
mkruse@netexpress.net
http://www.netexpress.net/~mkruse/                  http://www.mkstats.com/
---------------------------------------------------------------------------
Unsolicited advertising of any type to this addresss will not be tolerated.
------------------------------
Date: Mon, 03 Mar 1997 14:58:01 -0500
From: Mark Contois <mcontois@sig.bsh.com>
To: Mark Thompson <mwt@cyberg8t.com>
Subject: Re: Validating data using //
Message-Id: <331B2D49.41C6@sig.bsh.com>
Mark Thompson wrote:
> I'm trying to write a password changing program and I need to do
> validation of text that people enter.  Basically, I'm trying to limit
> the user's input to letters and numbers with a minimum of 1 and a
> maximum of 10 characters.
> 
> I tried doing it like this:
> 
> if($oldusername ne /[A-Za-z0-9]{1,10}/)
> {
>      $error += 1;
>      $errormsg[$error] = "$oldusername is not a valid username";
> }
> 
>                          and am not getting the desired results.
That's because the 'ne' operator is looking for a *literal* nonmatch--
in other words, it's trying to match the contents of $oldusername
against the actual string '/[A-Za-z ...', without treating it as a
pattern.
You want the pattern match binding operators =~ and !~ (the latter is
the negated version):
if($oldusername !~ /[A-Za-z0-9]{1,10}/)
In fact, that pattern will match anything *containing* (rather than
consisting solely of) a 1-10 char alphanumeric string.  You probably
want to restrict your pattern to match the entire string with ^ and $,
which are beginning- and end-of-line anchors:
if($oldusername !~ /^[A-Za-z0-9]{1,10}$/)
Finally, I never tire of the opportunity to spread Larry's Trinity of
Programmer Virtues, viz., Laziness, Impatience, and Hubris.  Laziness
in particular says that you should do as much as possible with $_,
the default pattern-match space.  If you stick your old username value
into $_ instead of a named variable, all you have to say is:
unless(/^[A-Za-z0-9]{1,10}$/)
which will make your fingers happy.
> I will also be looking to validate passwords to so that it doesn't
> contain any space type characters (space, /t, /n, etc).
(note that these should be backslashes: \t, \n)
For pattern matches, \s is a character class that will match space,
tab, newline, return, or formfeed.  If you want to be able to match
newlines in your strings, you should use the /s modifier on your regex,
thus:
if(/\s/s)
# (first s is whitespace char class; second is multiline match)
{
  # there's a space in my string, dear Liza, dear Liza
}
Page references in the (blue) camel book:
ne:      87
=~, !~:  81
^, $:    62
$_:      10-597, *passim*   :)
\s:      64-65
//s:     72
Mark
-- 
Mark Contois                 | Actual Windows NT error message:
Strategic Interactive Group  |       "No keyboard found.
Boston, MA                   |        Press F1 to continue."
------------------------------
Date: 3 Mar 1997 21:26:48 GMT
From: nobody@nowhere.com (mv)
Subject: writing to file
Message-Id: <nobody-0303971625160001@pa1dsp20.rsw.infi.net>
I am working on a cgi that takes the info from a form and writes it to a file.
open (guestfile, ">> guest.txt");
How do I have it write to a file in a different directory?
open (guestfile, ">> ../data/guest.txt");
This changes the file name, not the location.
Thanks!!
Monty
montyvan@swfla.infi.net
------------------------------
Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 97)
Message-Id: <null>
Administrivia:
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.
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 42
************************************