[6314] in Perl-Users-Digest
Perl-Users Digest, Issue: 936 Volume: 7
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 12 20:27:30 1997
Date: Wed, 12 Feb 97 17:00:23 -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, 12 Feb 1997 Volume: 7 Number: 936
Today's topics:
Re: ANNOUNCEMENT: Perl documentation and FAQ discontinu (Donald H. Locker)
Appending to the top of a document... ("ubiquitous (Jonathan Eisenman)")
Bug in MakeMaker? (How to add stdc++ to LIBS list?) (Guy Berliner)
Re: Calling html page from perl script????? (Nathan V. Patwardhan)
Re: Can I remove a require? (Joel Earl)
Re: Code refs not first class? (Jason Brazile)
Connecting to Modem with Perl in Win95 (root)
Does Net::FTP modules work under Win32 Perl5 ? <wwu@fis028.fis.lehman.com>
Re: get a string from a line (Dave Thomas)
Getting "return status" from cmd in a rsh call grajek@orasis.com
Re: Getting "return status" from cmd in a rsh call <spicano@ptdcs2.intel.com>
Help with Redirect Script <tom@tomagic.com>
Re: Help <art2mis@apk.net>
Re: Hierarchical Directory Tree <art2mis@apk.net>
Re: how best to share a hash between packages <art2mis@apk.net>
Re: How to tell if Perl is run in debug mode (Boulder SQA)
Re: Normal Distribution Function in Perl (Jon Orwant)
PERL FOR WINDOWS <college@tbaytel.net>
Re: perl in varied environment ("John Dallman")
Re: Perl5/Tk for Win95/NT (john smith)
perldb and NT Emacs <vish@gqc.com>
Re: perldb and NT Emacs (Ilya Zakharevich)
Re: read and write +> at the same time - HOW? <vish@gqc.com>
Re: Recognize Canadian Zipcodes... (Mark Anderson)
Re: regexp help (Jeffrey)
Sorting a Hash of a Hash ? <AFconcr@dia.osis.gov>
Sorting Hash of a Hash...help <AFconcr@dia.osis.gov>
subtle (to me) RE problem <usenet-tag@qz.little-neck.ny.us>
Re: System calls <art2mis@apk.net>
Re: using sendmail (Neil S. Briscoe)
Re: what does this line do? <tchrist@mox.perl.com>
Re: what does this line do? (Ilya Zakharevich)
Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Feb 1997 18:54:31 GMT
From: dhl@mrdog.msl.com (Donald H. Locker)
Subject: Re: ANNOUNCEMENT: Perl documentation and FAQ discontinued
Message-Id: <E5I76w.FwM@mrdog.msl.com>
Thank the gods! I was getting really tired of deleting all those
documentation files after a successful installation. My hard disks
were getting too heavy for the desks! I, for one, am delighted that
this stuff will no longer be the burden that it was. ;) (Was this
perhaps the result of one of those high-intensity meetings that p5p
had during _THE_DEEP_SILENCE_?)
In article <5ddt96$9gh$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>As of the next release of Perl, no documentation or examples will
>be shipped, since no one reads them anyway. Furthermore, the FAQ
>is also discontinued. Please remove copies of any of this documentation
>wherever you may find it, since it's obvious from the postings in this
>group that it has never done a bit of good.
--
Donald.
These opinions were formulated by a trained professional.
DO NOT TRY THIS AT HOME!
At the time, the tone will be ... BEEP!
------------------------------
Date: Wed, 12 Feb 1997 19:15:37 -0500
From: ubiquitous@beachside.com ("ubiquitous (Jonathan Eisenman)")
Subject: Appending to the top of a document...
Message-Id: <199702130125.UAA27917@surf.beachside.com>
...is it possible? I once saw it done (I think it is what they were doing)
with a for statement, but I like to be original, and after all, quoting
Programming Perl, "There's More Than One Way To Do It". In case you are
wondering why, it is for a guestbook script I wrote. I would say all in
all it works pretty well...except for the fact that until I figure this out
it does NOTHING! Thanks for all you guys' help in the past! Email replies
appreciated. Thanks again.
Jon says:
"Start your day off right with a cup of Java and some cookies."
http://home.beachside.com/ubiquitous/
------------------------------
Date: Wed, 12 Feb 1997 22:49:16 GMT
From: berliner@netcom.com (Guy Berliner)
Subject: Bug in MakeMaker? (How to add stdc++ to LIBS list?)
Message-Id: <berlinerE5II24.Mr4@netcom.com>
I need to add -lstdc++ to the 'LIBS' list in WriteMakefile,
But when I run perl Makefile.PL, I get:
/^libstdc++.so.[0-9]+/: nested *?+ in regexp at /usr/lib/perl5/ExtUtils/MM_Unix.
pm line 1887.
and MakeMaker bombs out. I tried various ways to protect my ++ characters,
but to no avail. If I do \x2b, then MakeMaker is ok, but then neither the
shell nor ld know what the hell I'm talking about. Anyone have a good fix?
Guy Berliner
--
Finger berliner@netcom18.netcom.com for pgp key.
------------------------------
Date: 12 Feb 1997 20:51:44 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Calling html page from perl script?????
Message-Id: <5dtah0$s67@fridge-nf0.shore.net>
Charles Norton (Charles@hnnet.demon.co.uk) wrote:
: A number of people have kindly responded with a common suggestion to how
: to solve this problem. The exact code I have used is:
A number of people should have referred you to
comp.infosystems.www.authoring.cgi, where this question has been
answered numerous times. I will refer you to http://www.perl.com/perl/,
and www.dejanews.com to search the Usenet archives.
--
Nathan V. Patwardhan
nvp@shore.net
"Lane, this is pure snow!
Do you have any idea what
the street value of this mountain is?"
--Charles Demar from _Better Off Dead_
------------------------------
Date: 12 Feb 1997 21:16:32 GMT
From: earl@shadowfax.rchland.ibm.com (Joel Earl)
Subject: Re: Can I remove a require?
Message-Id: <EARL.97Feb12151632@shadowfax.rchland.ibm.com>
In article <01bc171c$2c60dd40$5681c392@pc2488.wpcorp.com.au> "Mark Brodziak" <mark.brodziak@wpcorp.com.au> writes:
> I have a require statement in my code. I want to be able to require
> several different control files; each file has a similar structure, named
> ctl, within it. However, I strike a small problem as when I try to
> subsequently require the next control files, it ignores it as there is
> already a require with the same structure within it.
>
> Can I remove my first require before going on to the next control file?
It's not clear (to me, at least) exactly what you're doing here. A 'require'
statement pulls in Perl code from another file and executes it, generally for
the purpose of subroutine declaration and variable initialization. It does
have a mechanism for tracking which files have been 'require'd already, so
that it can avoid re-evaluating them. But this is done on a per-file
basis. Different 'require'd files are free to redeclare subroutines and
reinitialize variables that may have been declared or initialized by previous
code.
Is the ctl structure to which you refer a variable that several 'require'd
files wish to initialize in conflicting ways? Or is your problem that your
'require'd files each 'require' another file, and that this other file is only
evaluated during the 'require' of the first file that your main program
'require's, and that behaviour causes some problem?
In either of these cases, some code redesign is probably in order. Or if it's
some other situation altogether, some other solution may be appropriate. Post
more details, maybe with *condensed* code examples.
--
Joel Earl, earl@vnet.ibm.com
Logic Analysis and Optimization
IBM Rochester, Minnesota
(507) 253-2304
------------------------------
Date: 12 Feb 1997 18:57:57 GMT
From: jason@ampersand.com (Jason Brazile)
Subject: Re: Code refs not first class?
Message-Id: <5dt3rl$9h0$1@ftp.ampersand.com>
In article <w10ohdqhzym.fsf@wombat.staff.ichange.com>,
nelson <nmljn@wombat.staff.ichange.com> wrote:
>
>So you need to disambiguate what you mean by sub { print...}. The
>following works fine, suggesting that code references are indeed first
>class:
>
> perl -e '&{ +sub { print "Hello!\n" } };'
Ahh, the magical "+".
If it were up to me, I would have used the "const" keyword ;-)
In other words, I needed to have read the section entitled "Terms and List
Operators (Leftward)" page 77 in "Programming Perl" 2nd Edition.
Of course, I like Tom Christiansen's answer better:
"Fixed in the next release"
Thanks to all who answered.
---
Jason Brazile
Ampersand, Inc
Billerica, MA
------------------------------
Date: 12 Feb 1997 18:31:56 -0500
From: root@alk.com (root)
Subject: Connecting to Modem with Perl in Win95
Message-Id: <5dtjtc$l2n@vader.alk.com>
Any tips on how I can connect to a remote machine using a modem on Windows 95?
Sami Akbay
akbay@alk.com
------------------------------
Date: 12 Feb 1997 16:07:33 -0800
From: Wei Wu <wwu@fis028.fis.lehman.com>
Subject: Does Net::FTP modules work under Win32 Perl5 ?
Message-Id: <dsybctd0vt.fsf@fis028.fis.lehman.com>
I have a perl program that uses Net::FTP under unix. I am tring to
move the program to Win32. I am not sure if any of the Net:: modules
work under Win32 Perl5.
Thanks.
Wei Wu (wwu@lehman.com)
------------------------------
Date: 12 Feb 1997 22:38:00 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: get a string from a line
Message-Id: <slrn5g4hd2.cgp.dave@fast.thomases.com>
On Wed, 12 Feb 97 20:46:10 GMT, Stefan Wimmer <swimmer@freising-pop.de> wrote:
> Hi all,
>
> I'm trying to pull a string from one line from a HTML-File. I have no idea of
> the terminology, so I try to explain practically =8-))
>
> HTML:
>
> <H2>PM 01/97: Whatever you want ...</H2>
>
> My plan:
>
> extract the string "PM 01/97" from every line with header-tags and place this
> string in a buffer, which will be written in another HTML-File serving as an
> index-file.
>
> I tried to work with regular expressions like that:
>
> $buffer =~ m/\<h2\>string\<\\h2\>/is;
>
OK - you need to use parentheses to specify a part of the match to extract:
while ($buffer =~ /<[Hh]2>(.*?):/gs) {
print "$1\n";
}
The match operator is magic when used with 'g' - it iterates through each
match in turnn
Dave
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Wed, 12 Feb 1997 15:31:04 -0600
From: grajek@orasis.com
Subject: Getting "return status" from cmd in a rsh call
Message-Id: <855782530.1400@dejanews.com>
I am having no luck getting the execution status of "tar"
using "rsh" in a perl script. Here is my attempt:
$rc = system("tar -cOz -T $TAR_LIST | rsh rsite tar -xz -C $REM_DIR");
$rc = $? >> 8;
print("Remote tar results rc=$rc\n");
NOw, in this example, I *want* $rc to return the status of
the REMOTE tar, the "tar -xz".
But all I ever get is the result of the rsh, that is if the
command is executed.
If you have any clue how to get the status of a remote operation -
please let me know. I can break up the command to be:
system("tar -cz -C $REM_DIR -f $TAR.FILE");
system("rcp $TAR.FILE rsite:$TAR.FILE");
$rc = system("rsh rsite tar -xz -C $REM_DIR -f $TAR.FILE");
$rc = $? >> 8;
print("Remote tar results rc=$rc\n");
(In this second example, I am still just getting the results from
the "rsh" not the "tar".)
Any hints/comments appreciated. Please copy all responses
to me via e-mail.
Thanx.
--
Garret Grajek
grajek@orasis.com 714 829-0636
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Wed, 12 Feb 1997 16:06:04 -0800
From: Silvio Picano <spicano@ptdcs2.intel.com>
To: grajek@orasis.com
Subject: Re: Getting "return status" from cmd in a rsh call
Message-Id: <33025AEC.41C6@ptdcs2.intel.com>
>From the comp.unix.questions faq:
Subject: How do I check the exit status of a remote command executed via
"rsh"?
Date: Thu Mar 18 17:16:55 EST 1993
3.11) How do I check the exit status of a remote command
executed via "rsh" ?
This doesn't work:
rsh some-machine some-crummy-command || echo "Command failed"
The exit status of 'rsh' is 0 (success) if the rsh program
itself completed successfully, which probably isn't what
you wanted.
If you want to check on the exit status of the remote program,
you can try using Maarten Litmaath's 'ersh' script, which was
posted to alt.sources in October 1994. ersh is a shell script
that calls rsh, arranges for the remote machine to echo the
status of the command after it completes, and exits with that
status.
Here is ersh.shar: it is a pretty "challenging" script.
Newsgroups: alt.sources
From: maart@na47sun29.cern.ch (Maarten Litmaath)
Subject: ersh 3.1 - rsh wrapper that returns exit status of remote
command
Message-ID: <Cx68sr.FwI@news.cern.ch>
Keywords: UNIX (BSD), sh, csh, rsh (remote shell)
Sender: news@news.cern.ch (USENET News System)
Organization: CERN - European Laboratory for Particle Physics - Geneva
Date: Tue, 4 Oct 1994 23:19:38 GMT
This wrapper script for BSD UNIX "rsh" (System V "remsh") gives you
the exit status of the remote command, provided that the remote shell
is (a superset of) "sh" or "csh".
If the connection is broken prematurely, it returns 99.
Usage: see "man rsh".
: This is a shar archive. Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
: --------------------------- cut here --------------------------
PATH=/bin:/usr/bin:/usr/ucb
echo Extracting 'ersh'
sed 's/^X//' > 'ersh' << '+ END-OF-FILE ''ersh'
X#!/bin/sh
X# @(#)$Id: ersh 3.1 94/03/17 maart@nikhef.nl (Maarten Litmaath) $
X# This rsh front-end returns the exit status of the remote command,
X# or 99 if the connection is broken prematurely.
X# It works OK with sh/csh-compatible shells on the remote (!) side.
X# If there is no remote command present, rlogin is invoked, which
X# need not return a meaningful exit status.
X# Usage: see rsh(1).
X
XRSH=/usr/ucb/rsh
XRLOGIN=/usr/ucb/rlogin
X
Xhostname=
Xlflag=
Xnflag=
Xuser=
X
Xcase $1 in
X-l)
X ;;
X*)
X hostname=${1?'hostname expected'}
X shift
Xesac
X
Xcase $1 in
X-l)
X lflag=-l
X shift
X user=${1?'username expected after -l flag'}
X shift
Xesac
X
Xcase $1 in
X-n)
X nflag=-n
X shift
Xesac
X
Xcase $hostname in
X'')
X hostname=${1?'hostname expected'}
X shift
Xesac
X
Xcase $# in
X0)
X exec $RLOGIN $lflag $user "$hostname"
Xesac
X
Xid=ersh.$$.`date | awk '{ print $4; }'`
Xhangup=99
X
XAWK='
X prprev == 1 {
X print prev0;
X prprev = 0;
X }
X $1 == "'$id'" {
X prev0 = $0;
X prev2 = $2;
X prev3 = $3;
X prprev = 1;
X next;
X }
X {
X print;
X }
X END {
X if (prprev == 0) {
X exit('$hangup');
X }
X if (prev2 ~ /^[0-9]+0$/) {
X exit(prev2 / 10);
X }
X if (prev2 ~ /^0$/ && prev3 ~ /^[0-9]+$/) {
X exit(prev3);
X }
X print prev0;
X exit('$hangup');
X }
X'
X
Xexec 3>&1
X
X# If the remote shell is a Bourne shell variant, "$status" might
X# contain a newline, hence the "sed q"...
X
Xcmd="( ${*-:} ); exec sh -c 'echo $id "'"$0 $1" | sed q >&2'\'' $?0
"$status"'
X
X$RSH "$hostname" $lflag $user $nflag "$cmd" 2>&1 >&3 3>&- |
X awk "$AWK" >&2 3>&-
+ END-OF-FILE ersh
chmod 'u=rwx,g=rx,o=rx' 'ersh'
set `wc -c 'ersh'`
count=$1
case $count in
1486) :;;
*) echo 'Bad character count in ''ersh' >&2
echo 'Count should be 1486' >&2
esac
exit 0
------------------------------
Date: Wed, 12 Feb 1997 18:33:20 GMT
From: "Tom Hill" <tom@tomagic.com>
Subject: Help with Redirect Script
Message-Id: <01bc1912$db4b9280$398232cf@default>
I am creating a page with bookmarks to the names of all 50 States. What I
want is a dropdown menu containing thses names so that when a user selects
a name from the menu, he/she will be taken to the appropiate bookmark.
Any help would be appreciated.
Tom Hill
Computer Magic
------------------------------
Date: 12 Feb 1997 22:32:17 GMT
From: "Craig or Diana Duncan" <art2mis@apk.net>
Subject: Re: Help
Message-Id: <01bc1934$18650a40$0b08b7ce@zeus>
Yup, it works beautifully, although we DID have installation problems (and
now I can't remember what they were, oh well) When we had problems, we
followed the suggestions in the IF YOU HAVE PROBLEMS section in the
DBD-Oracle-<version>.readme file. I would suggest you do the same.
Diana Duncan art2mis@apk.net, dduncan@realogic.com
Oracle DBA, programmer, resident Perl guru (did I ask for this?), wireless
geek
REALOGIC, Inc.
Opinions are my own, OK? Go get your own.
Muhammad Siddiqui <SIDDIQM2@boat.bt.com> wrote in article
<3300980B.2942@boat.bt.com>...
> Has anyone out there actually got 'oraperl' to work ??
> I'm using Oracle 7.3 and Perl 5.003. I've downloaded the source code for
> oraperl and when try to build it up, it complains that it can't find a
> file namely 'uperl.o'..
> --
> Views expressed are my own, and do not represent those of my employer.
>
------------------------------
Date: 12 Feb 1997 21:27:50 GMT
From: "Craig or Diana Duncan" <art2mis@apk.net>
Subject: Re: Hierarchical Directory Tree
Message-Id: <01bc192b$17558520$0b08b7ce@zeus>
Actually, this is the current homework assignment for a class in Perl I'm
teaching currently--unfortuately the solution is at work currently. I'll
post it tomorrow, OK?
Diana Duncan art2mis@apk.net, dduncan@realogic.com
Oracle DBA, programmer, resident Perl guru (did I ask for this?), wireless
geek
REALOGIC, Inc.
Opinions are my own, OK? Go get your own.
John Putnam <jputnam@nwu.edu> wrote in article <32FF5C77.16CE@nwu.edu>...
> Does anyone have or know how to use perl to create a text file of
> directory levels indented in a tree structure. This would very useful
> for documenting Web site sub trees.
------------------------------
Date: 12 Feb 1997 23:46:56 GMT
From: "Craig or Diana Duncan" <art2mis@apk.net>
Subject: Re: how best to share a hash between packages
Message-Id: <01bc193e$83c4a2a0$0b08b7ce@zeus>
Greg Haygood <greg@iweb.net> wrote in article
<3300b476.521895205@nntp.atlanta.com>...
>
> # In file Util.pm:
> package Util;
>
> sub Function {
> local *hash = shift;
>
> # make normal hash calls here
> }
>
> # End Util.pm
>
> # in file DoSomething.cgi
> use Util;
>
> my %hash;
>
> # build up hash
> # ...
>
> # neither of these calls gains access to this script's %hash
> Function(*hash);
> Function(\*hash);
>
> # end DoSomething.cgi
>
>
> since neither of these works, but *should*, i must be doing something
> wrong. can someone enlighten me?
>
You actually need to do the following
Function(\%hash);
Aren't references fun?
If you actually want to return your hash from the Function, you will want
to
return %hash;
and call it with
%hash = Function(\%hash);
This works fine, but...
If you need to pass and/or return more parameters than just a hash, you
will probably need to get into anonymous references and forget the
globbing. Try the following...
sub Function {
my ($hashref, $keysarray, $valuesarray) = @_;
# Print out the contents of the passed in hash
#
foreach $key (keys %$hashref) {
print "key:\t$key\t\tvalue:$$hashref{$key}\n";
}
# Add the keys and values to the hash, depleting the arrays as you go
#
while (@$keysarray) {
$$hashref{shift @$keysarray} = shift @$valuesarray;
}
# Return the modified structures
#
return ($hashref, $keysarray, $valuesarray);
}
In the calling program...
use Util;
my %hash;
# Add a couple of values to the hash the conventional way
#
$hash{test1} = 'testing once...';
$hash{test2} = 'testing twice...';
my $keys = ['alpha', 'beta', 'kappa']; # This is an anonymous array
reference
my $values = ['one', 'two', 'three']; # So is this
my $hashref = \%hash; # This is a hash reference to an existing hash
my $newhash = {}; # This is an anonymous hash reference (empty)
# Print out the contents of $hashref, then add $keys and $values,
returning the
# completed hash and the diminished arrays
#
($newhash, $keys, $values) = Util::Function($hashref, $keys, $values);
# Print out the contents again
#
Util::Function($newhash);
Hope this helps,
Diana
--
This was Diana (Oracle/Perl/wireless) OR Craig (Notes,hardware), so we both
hereby claim individual opinions, not necessarily held by the other or the
companies for whom we work.
art2mis@apk.net, dduncan@realogic.com, cduncan@atrium-hr.com
"the three great virtues of a programmer: laziness, impatience, and
hubris"
-- Programming Perl -- Larry Wall, Tom Christiansen & Randall Schwartz
------------------------------
Date: 12 Feb 1997 21:23:48 GMT
From: stampes@xilinx.com (Boulder SQA)
Subject: Re: How to tell if Perl is run in debug mode
Message-Id: <5dtcd4$1r5@neocad.xilinx.com>
Brett Denner (dennerbw@lmco.lmtas.com) wrote:
: I would like to add some code to my perl script that is executed only
: when perl is started with the -d flag (either via the command line or
: the #!/usr/bin/perl line). I envision something like this:
I believe $^P is set to 1 when in debug mode, 0 otherwise...see
'man perlvar':
fappy 192: perl -e 'print "$^P\n"'
0
fappy 193: perl -d -e 'print "$^P\n"'
Stack dump during die enabled outside of evals.
Loading DB routines from perl5db.pl patch level 0.94
Emacs support available.
Enter h or `h h' for help.
main::(-e:1): print "$^P\n"
DB<1> s
1
fappy 194:
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: 12 Feb 1997 21:03:36 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
To: jimmy_wong@trimble.com
Subject: Re: Normal Distribution Function in Perl
Message-Id: <ORWANT.97Feb12160336@fahrenheit-451.media.mit.edu>
In article <855712320.29300@dejanews.com> jimmy_wong@trimble.com writes:
> Can anyone tell me if they know where to find a Perl module or
> package to calculate normal distribution function for statistical
> analysis? I checked CPAN and the statistics packages listed didn't
> have this capability.
> If there isn't a Perl module readily available, then can someone
> point me to any online resources which might explain the algorithm
> for calculating the normal gaussian distribution function?
I'll throw in some other features (like making it n-dimensional, and
perhaps supporting related distributions like the Laplacian) and make
this into a module after I get issue #5 of The Perl Journal to press.
But plain Gaussians are pretty straightforward:
# pass it the mean, the variance, and the x value.
sub normal {
my ($mean, $var, $x) = @_;
return undef unless $var > 0;
return exp(-($x - $mean)**2/(2 * $var))/sqrt(8 * atan2(1,1) * $var);
}
print normal(4, 1, 5); # prints 0.241970724519143
-Jon
----------------
Jon Orwant
The Perl Journal
http://tpj.com/
------------------------------
Date: 12 Feb 1997 22:03:37 GMT
From: help <college@tbaytel.net>
Subject: PERL FOR WINDOWS
Message-Id: <5dtenp$iom@Ouimet.tbaytel.net>
What is the perl for Windows newsgroup, and has perl
been ported to Windows NT 4.0 yet?
Randy Rostie
------------------------------
Date: Wed, 12 Feb 1997 22:27:49 GMT
From: jgd@cix.compulink.co.uk ("John Dallman")
Subject: Re: perl in varied environment
Message-Id: <E5IH2D.B1A@cix.compulink.co.uk>
tgorby@emc.com (Terry Gorby) asked:
> I am using perl in a unix environment
> that is widely varied. I have to live with for now.
> Perl can reside in /usr/local/bin, /usr/local/SOLARIS/bin,
> or in /home/bin.
>
> I would like my perl scripts to execute the available
> perl binary depending on the environment.
> Is this possible? If so, may I see an example?
Easy. You use softlinks. There must be *some* directory that is always a
machine-specific executable directory on all your machines -
/usr/local/bin is a good candidate; we use
/user/local/software_tools/bin. If there isn't, it's time to designate
one.
Create a softlink in each architecture's version of that directory that
points to the perl for that architecture. That's all it needs.
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: Wed, 12 Feb 1997 22:03:21 GMT
From: john@jssm.demon.co.uk (john smith)
Subject: Re: Perl5/Tk for Win95/NT
Message-Id: <33043da1.135330845@news.demon.co.uk>
On 27 Jan 1997 19:32:15 GMT, Erh.O.Wagner@t-online.de (Erhard O.
Wagner) wrote:
>Hi world!
>Is there somewhere a Perl5/Tk package available for Win95/NT?
>
>(Erh.O.Wanger@t-online.de)
>
>Erhard
Me too... I checked the faqs I could find and Perl5 for NT is
advertised as on ftp://ftp.intergraph.com/pub/win32/perl but
doesn't seem to be anything there!
John
--john smith.
------------------------------
Date: 12 Feb 1997 16:06:12 +0000
From: Vish Subramanian <vish@gqc.com>
Subject: perldb and NT Emacs
Message-Id: <uzpxauhzf.fsf@gqc.com>
Hi all,
Has anyone gotten the perl debugger (perldb) to work from NT Emacs? I
use perl for WIN32 (from Activeware) and NT Emacs 19.34. One problem
seems to be that perl5db.pl uses the console, and according to the FAQ
the console cant be redirected by emacs. I tried (without much
knowledge) to make perl5db.pl use stdin and stdout when invoked by
gud-mode of emacs, only to crash my emacs. It hangs after the message
"Enter h for help" appears.
Any help/suggestions would be greatly appreciated.
Thanks,
Vish
vish@gqc.com
------------------------------
Date: 12 Feb 1997 22:07:26 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: perldb and NT Emacs
Message-Id: <5dteuu$6bj$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Vish Subramanian
<vish@gqc.com>],
who wrote in article <uzpxauhzf.fsf@gqc.com>:
> Hi all,
>
> Has anyone gotten the perl debugger (perldb) to work from NT Emacs? I
> use perl for WIN32 (from Activeware) and NT Emacs 19.34. One problem
> seems to be that perl5db.pl uses the console, and according to the FAQ
> the console cant be redirected by emacs. I tried (without much
> knowledge) to make perl5db.pl use stdin and stdout when invoked by
> gud-mode of emacs, only to crash my emacs. It hangs after the message
> "Enter h for help" appears.
>
> Any help/suggestions would be greatly appreciated.
First of all, NT Emacs is broken, so do not expect to get much from
it. Second, perl5db.pl contains lines
# Around a bug:
if (defined $ENV{OS2_SHELL} and ($emacs or $ENV{WINDOWID})) { # In OS/2
$console = undef;
}
which makes it work in OS/2 Emacs and OS/2 xterm of XFree86. If you
can make something similar work, let me know. (Btw, this line predates
$^O, so use it instead.)
Ilya
------------------------------
Date: 12 Feb 1997 17:55:47 +0000
From: Vish Subramanian <vish@gqc.com>
Subject: Re: read and write +> at the same time - HOW?
Message-Id: <uvi7xsycc.fsf@gqc.com>
"Michael Avila" <lnussat.mavila@eds.com> writes:
>
> I cannot find any examples of how to read and write to a file at the same
> time. I have the open as follows:
>
> open (IDDBFILE, "+>../../../company/carclub/reports/iddb") || die "Error:
> $!";
>
You might want +< to read and then write.
Also, if you read past the end of file before you start writing you
need to seek to reset the eof - try "seek(IDDBFILE, 0, 1)".
Vish
------------------------------
Date: Wed, 12 Feb 1997 22:57:18 GMT
From: marka@andyne.com (Mark Anderson)
Subject: Re: Recognize Canadian Zipcodes...
Message-Id: <E5IIFJ.EME@griffin.andyne.com>
In article <5c61ds$l05@coranto.ucs.mun.ca>, pdf@morgan.ucs.mun.ca says...
>
>
>>>>>> "Pamela" == Pamela Pledger <pledger@netcom.com> writes:
>>>>>> "Randal" == Randal Schwartz <merlyn@stonehenge.com> writes:
>
>Pamela> Anyone written this yet? The script needs to recognize Canadian
>Pamela> postal codes vs US zipcodes, phone numbers, etc. Anyone
>Pamela> know the rules on Canadian postal codes, is it :
>Pamela> [A-Z0-9][A-Z0-9][A-Z0-9][0-9][A-Z][0-9]?
>Pamela> (American zipcodes being \d{5} or \d{5}-\d{4})
>
>Randal>I think you just have to look for the "eh?" on the end.
>Randal>(Ducking...)
>
I am no authority on this, but I believe it's:
[A-Z][0-9][A-Z]\s?[0-9][A-Z][0-9]
------------------------------
Date: 12 Feb 1997 15:47:30 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: Phil Williams <williams@irc.chmcc.org>
Subject: Re: regexp help
Message-Id: <JFRIEDL.97Feb13004730@tubby.nff.ncl.omron.co.jp>
Phil Williams <williams@irc.chmcc.org> wrote:
|> I have a user input string of items that may
|> be delimeted with spaces, commas, semicolons, carriage returns, etc. or
|> any combination of those. I want to substitute those with a single ,.
|>
|> Here's what I do
|>
|> $value =~ s/[,:; ][ \n]*/,/g;
This doesn't exactly match your description... for a plausable value of "etc",
that would be closer to:
$value =~ s/[,:; \s]+/,/g;
|> Which works except that it leaves the last, sometimes unwanted character
|> in place. i.e. the user hit a <ret> at the end but did not enter
|> anything afterwards. How would I check and get rid of this last char in
|> the same regexp?
It's easiest to do it as a separate step, i.e.
$value =~ s/[,:; \s]+/,/g;
$value =~ s/,$//;
If you're going to split this, though, i.e.
@values = split(/[,:; \s]+/, $value)
you don't need to worry about trailing empty fields, since split() removes
them if you don't provide a non-zer split limit (3rd argument).
Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@omron.co.jp> Omron Corp, Nagaokakyo, Kyoto 617 Japan
O'Reilly & Associates' _Mastering Regular Expressions_
http://enterprise.ic.gc.ca/~jfriedl/regex/
------------------------------
Date: Wed, 12 Feb 1997 16:57:24 -0500
From: "Chris R. Contakes" <AFconcr@dia.osis.gov>
Subject: Sorting a Hash of a Hash ?
Message-Id: <33023CC4.73D7@dia.osis.gov>
I am tring to sort a hash of a hash and am having some difficulties.
The record gets read in from a file and looks like:
while (<INPUT>) {
$RECORD{$SSN}{last} = $lastname;
$RECORD{$SSN}{first} = $firstname;
......
}
Then I try to sort by the lastname. I tried a staement like:
foreach $SSN (sort keys %RECORD) {
foreach $SSN(sort keys %{$RECORD}{$SSN}{$last}})
print.....
}
}
This didnt work. I also tried some variations off this. Is there a way
that I can sort these records off of that field?
Any help would be much appreciated.
Thanks,
Chris
------------------------------
Date: Wed, 12 Feb 1997 16:49:51 -0500
From: "Chris R. Contakes" <AFconcr@dia.osis.gov>
Subject: Sorting Hash of a Hash...help
Message-Id: <33023AFF.3854@dia.osis.gov>
I am tring to sort a hash of a hash. The record gets its data from a
file and looks like:
while(<INPUT>)
{
$RECORD{$SSN}{last} = $lastname;
$RECORD{$SSN}{first} = $first;
.
.
.
}
Since the outer hash is keyed on the SSN, I am trying to sort off of the
lastname field.
I wrote a statement that looks like
foreach $SSN (keys %RECORD) {
foreach $last( sort keys %{ $RECORD{$SSN}{$last}} )
.......
......
}
}
Unfortunately this didnt work. Any advice would be much appreciated.
Thanks !
Chris
------------------------------
Date: 12 Feb 1997 22:12:18 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: subtle (to me) RE problem
Message-Id: <5dtf82$80v@news.netusa.net>
In a script which is scoring spam, I want to be able to
detect N or more occurances of any one of these characters:
()!%*_+=|\/,<>:~-
For N=7, I have
/([\(\)!%*_+=|\\\/,<>:~-]).*${1}.*${1}.*${1}.*${1}.*${1}.*${1}/
And that gives me a "nested *?+ in regexp" error. Why?
Elijah
------
normally pretty good with RE's (although not perl specific ones)
------------------------------
Date: 12 Feb 1997 21:33:25 GMT
From: "Craig or Diana Duncan" <art2mis@apk.net>
Subject: Re: System calls
Message-Id: <01bc192b$df0a17c0$0b08b7ce@zeus>
Check your permissions, and see if the CGI user is set up for Oracle, (does
it have an $ORACLE_HOME environment variable set in its path?)
Diana Duncan art2mis@apk.net, dduncan@realogic.com
Oracle DBA, programmer, resident Perl guru (did I ask for this?), wireless
geek
REALOGIC, Inc.
Opinions are my own, OK? Go get your own.
Petr Ged Kunc <ged@fi.muni.cz> wrote in article
<32FF6722.167E@fi.muni.cz>...
> I have such problem:
>
> I'd like to connect to Oracle 7 database using PERL.
> Sytem calls works right when I run PERL script from UNIX command line,
> but they don't work as CGI-scrips.
------------------------------
Date: 11 Feb 1997 22:59:59 GMT
From: neilb@zetnet.co.uk (Neil S. Briscoe)
Subject: Re: using sendmail
Message-Id: <memo.970211225832.7279C@zetnet.co.uk>
In article <33003678.E86@student.tuwien.ac.at>,
e8726057@student.tuwien.ac.at (Klaus Johannes Rusch) wrote:
> Sean W. Ellis wrote:
>
> > B: Will not be on the NT system the page will eventually end up on.
> > I need to take information and send an email or save this information
> > to a file to be downloaded.
> >
> > I would rather have the email, how do I implement with something other
> > than sendmail or how do I implement on NT server?
>
> Probably a good question on a Windows NT newsgroup [FUP to
> comp.os.ms-windows.nt.misc], as this is not at all related to Perl,
> unless you intend to re-implement sendmail for Windows NT.
>
Its related to Perl if the script is written in Perl. Don't talk sendmail
- talk SMTP. As you're on NT, you'll need my ugly, but functional, hack
of the smtp.pm module - which doesn't [yet] work under NT. Just send me
a request and I'll chuck it right back at you.
Oh, my hack is an smtp.pl perl library - and it works just fine under the
effected patient. ;-))
Regards
Neil
------------------------------
Date: 12 Feb 1997 23:11:04 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: what does this line do?
Message-Id: <5dtim8$788$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
ycheung@Bayou.UH.EDU (Raymond Cheung) writes:
:I don't understand this line:
: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
:it appears in a cgi script. Could someone explain it?
Just what is that you don't understand?
the $value variable
the =~ operator
the s/// substitution operator
the catch buffer with parens creating $1
the [a-fA-F0-9] character class
the pack function
the unsigned character "C" format in the pack function
the use of the /g global match/change flag
the use of the /e full-expression flag
What man pages did you previously check before your posting? Between
perlre and perlre for all the pattern stuff, and maybe perlfunc for pack
and perldata for what variables are, you should be able to figure it out.
--tom, who today prefers teaching how to fish to giving free meals
--
Tom Chrisiansen tchrist@jhereg.perl.com
You can't set a breakpoint on a subroutine that hasn't been
defined yet (yet). This is a topic for ongoing research... :-)
--Larry Wall in <1994Feb25.192042.17196@netlabs.com>
------------------------------
Date: 13 Feb 1997 00:14:37 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: what does this line do?
Message-Id: <5dtmdd$dak$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<tchrist@mox.perl.com>],
who wrote in article <5dtim8$788$2@csnews.cs.colorado.edu>:
> [courtesy cc of this posting sent to cited author via email]
> What man pages did you previously check before your posting? Between
> perlre and perlre for all the pattern stuff, and maybe perlfunc for pack
^^^^^^ ^^^^^^
> and perldata for what variables are, you should be able to figure it out.
This misprint reflects a bug in Perl docs: most docu on RE is in
perlop. Should not it be moved from there to perlre?
Ilya
------------------------------
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 V7 Issue 936
*************************************