[6396] in Perl-Users-Digest
Perl-Users Digest, Issue: 21 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 26 22:09:35 1997
Date: Wed, 26 Feb 97 19:00:22 -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, 26 Feb 1997 Volume: 8 Number: 21
Today's topics:
Re: Alarm signal caught--program dies <tchrist@mox.perl.com>
Re: ARGV fails on Win32/NT (Scott McMahan - Softbase Systems)
Array in Hash Object <jduncan@hawk.igs.net>
Re: Array in Hash Object (Mike Stok)
Re: Can tied hash be stored in HOH? (Charles DeRykus)
Can't Subscribe to Perl5-Porters list (Gary Andraza)
Re: Can't Subscribe to Perl5-Porters list (Mike Stok)
Re: CRC or checksum <jduncan@hawk.igs.net>
Re: el porvenir di perl und java-script <tchrist@mox.perl.com>
FILE LOCKING <neiled@enteract.com>
Re: Handling signals without dieing (Charles DeRykus)
Re: How thread safe is Perl? <tchrist@mox.perl.com>
Re: How to spam - legitimately <tchrist@mox.perl.com>
Re: learning perl <mooreds@whitman.edu>
Re: learning perl (Nathan V. Patwardhan)
Re: MS Access database access from Perl for Win32 <billc@tibinc.com>
Re: new win32::ODBC("DSN") <rothd@roth.netX>
Re: perl forking problem (Edward Walker)
Re: Perl on Windows 95 (Pete M. Wilson)
Re: perl-system call-security++ (I R A Aggie)
Re: Problem with function gethostbyname (Mike Stok)
Re: Problems reading file using <> operator (Mike Stok)
Re: Question on "eval" <tchrist@mox.perl.com>
Returning a reference to a 'my' variable <lucs@cam.org>
sometimes > not greater than? <oshmis1@pacbell.net>
Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 27 Feb 1997 01:34:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Alarm signal caught--program dies
Message-Id: <5f2oc0$9hi$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Elliott McCrory <mccrory@fnal.gov> writes:
:How do I catch an alarm signal and continue on? Here is the perl:
:
:#!/usr/local/ap/bin/perl
:$sec = 10;
:$SIG{ALRM} = \&mysub;
:alarm $sec;
:print "Waiting\n";
:while (<>) {
: print "Line read $_";
:}
:sub mysub {
: print "Alarm signal caught\n";
: return; # Effect is the same with and without this return
:}
:
:And it runs like this:
:
:solaris$ test-alarm.pl
:Waiting
:Write a line while I wait
:Line read Write a line while I wait
:Alarm signal caught
:solaris$
:
:It exits immediately after catching signal.
That's because what's happening is you're running a version
prior to 5.003 on an operating system with system calls
that do not by default restart, causing the read to fail
setting errno ($!) to EINTR.
Fixed on 5.003 for most systems.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Espousing the eponymous /cgi-bin/perl.exe?FMH.pl execution model is like
reading a suicide note -- three days too late."
--Tom Christiansen <tchrist@mox.perl.com>
------------------------------
Date: 21 Feb 1997 18:54:05 GMT
From: softbase@mercury.interpath.com (Scott McMahan - Softbase Systems)
Subject: Re: ARGV fails on Win32/NT
Message-Id: <5ekr0d$23k@redstone.interpath.net>
Trond Ruud (troruud@online.no) wrote:
: Hi,
: Does anyone know about this problem on NT installations:
: The script argument list ARGV is always empty!
: $ test.pl arg1 arg2
The registry association for .pl set up by the perl setup script
says for NT to run "perl.exe %1" for a .pl file, i.e. perl and the
name of the script. The other command line parms go into the
bit bucket.
Go into the registry, find the .pl association, and change
it to perl.exe %1 %2 %3 %4 ... %9
Scott
------------------------------
Date: 27 Feb 1997 00:32:51 GMT
From: "James Duncan" <jduncan@hawk.igs.net>
Subject: Array in Hash Object
Message-Id: <01bc2446$137b7560$0a30f8ce@hawk.igs.net.demo>
I've encountered a strange problem with Perl, that I can't explain (at
least, it doesn't make logical sense to me).
I have an object (lets call it $self) with the following constructer:
sub new {
my ($class, %args) = @_;
my $self = {};
$self->{'People'} = ( [], );
$self->{'People Count'} = 0;
bless $self, %args;
}
It is the People part that is causing me problems. People is - at least,
it's supposed to be - an array (in this case it is an array of people
objects). However, when I do the following:
foreach $person ($self->{'People'}) {
print $person->{'Name'};
}
I get an error, that says $person is not a hash. The same goes for any
array-typical function that is supposed to use
$self->{'People'}. What is the problem here. I can get around it by using
the following:
my $count;
while($count != $self->{'People Count'}) {
print $self->{'People'}[$count]->{'Name'};
$count++;
}
but this is rather cumbersome, and places some rather unlazy problems apon
my program.
This is not good. I want to be lazy, it's why I like perl.
There is more than one way to do it of course, but I lose stuff like
splice, and join, and a whole plethora of unpleasent, but nessercary
functions.
Regards,
James.
Note: If you could be so kind as to cc this to my email, I'd apreciate it:
jduncan@hawk.igs.net - thanks.
--
James Duncan
constantly distresed author of NetObj, Agent, and a few
other things.
------------------------------
Date: 27 Feb 1997 02:32:51 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Array in Hash Object
Message-Id: <5f2roj$5h6@news-central.tiac.net>
In article <01bc2446$137b7560$0a30f8ce@hawk.igs.net.demo>,
James Duncan <jduncan@hawk.igs.net> wrote:
> $self->{'People'} = ( [], );
>It is the People part that is causing me problems. People is - at least,
>it's supposed to be - an array (in this case it is an array of people
>objects). However, when I do the following:
Well $self->{'People'} is just a scalar really which holds a reference to
a list you could say
$self->{'People'} = [];
> foreach $person ($self->{'People'}) {
> print $person->{'Name'};
> }
>This is not good. I want to be lazy, it's why I like perl.
You need to explicitly dereference references in perl, so
foreach $person (@{$self->{'People'}}) {
print $person->{'Name'};
}
e.g.
$ perl -de 1
Stack dump during die enabled outside of evals.
Loading DB routines from perl5db.pl patch level 0.9905
Emacs support available.
Enter h or `h h' for help.
main::(-e:1): 1
DB<1> $self = {People => []}
DB<2> for (qw/Adrian Bill Tony Robert/) {push @{$self->{People}}, {Name=>$_}}
DB<3> X self
$self = HASH(0x8070360)
'People' => ARRAY(0x8050aec)
0 HASH(0x806cc8c)
'Name' => 'Adrian'
1 HASH(0x806cca4)
'Name' => 'Bill'
2 HASH(0x806ccc8)
'Name' => 'Tony'
3 HASH(0x806ccec)
'Name' => 'Robert'
DB<4> foreach $person (@{$self->{'People'}}) {print $person->{'Name'}, "\n"}
Adrian
Bill
Tony
Robert
Hope this helps,
Mike
(if it doesn't then the perlobj and perlref and perldsc man pages might...)
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Wed, 26 Feb 1997 23:36:23 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Can tied hash be stored in HOH?
Message-Id: <E68HKn.41E@bcstec.ca.boeing.com>
In article <3311FA98.56C8@boeing.com>,
Kipp E. Howard <kipp.e.howard@boeing.com> wrote:
> I'm creating my own tied implementation and would like to store
> the tied hash in a hash of hashes. Is this possible?
>
> The camel says "you can bind any ordinary variable (scalar,
> array, or hash) to an implementation class by using tie."
> Does this mean that only $scalar, @array and %hash can be used?
>
> Would if work if a reference to these variables were stored in a HOH?
>
> Here is one of the things I would like to do:
>
> # tie %{$self->{_Default}} MyClass::Item; # Would this work?
> tie %default MyClass::Item; # How about this?
> self->{_Default} = \%default;
>
> foreach $key (keys %{$self->{_Default}}) {
> # Do stuff
> }
>
> I know that I could just use %default in place of %{$self->{_Default}}
> but there are a number of other places that I want to use this
Hi Kipp,
If I get your drift, I believe this'll work if your're
returning a hash ref , e.g.,
package MyClass::Item;
require Tie::Hash;
@ISA= qw/Tie::StdHash/;
package main;
my(%hash, $my_obj, $k,$v);
my $self = {};
$self{_Default} = \%hash;
$my_obj = tie %{$self->{_Default}}, 'MyClass::Item';
$my_obj->STORE('a', 'some_value');
$my_obj->STORE('b', 'some_other_value');
print "$k = $v\n" while (($k, $v) = each %{$self->{_Default}});
__END__
This prints:
a = some_value
b = some_other_rvalue
HTH.
Regards,
--
Charles DeRykus
ced@carios2.ca.boeing.com
------------------------------
Date: 26 Feb 97 18:24:06 -0500
From: gaa7065@tntech.edu (Gary Andraza)
Subject: Can't Subscribe to Perl5-Porters list
Message-Id: <1997Feb26.182406@eagle.tntech.edu>
Everyone,
I tried to subscribe to the perl5-porters mailing list three times over
the past two days. By doing just like the page at www.perl.com said to by
sending mail to majordomo@nicoh.com but all I got abck each time was that the
list didn't exist. I got a list of served lists from that server , I didn't
appear on it. Where did the list move to so that I can subscribe to it. I
would sure apprieciate the help.
Gary Andraza
Tennessee Tech University
E-mail:gandraza@csc.tntech.edu
------------------------------
Date: 27 Feb 1997 02:21:35 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Can't Subscribe to Perl5-Porters list
Message-Id: <5f2r3f$4j4@news-central.tiac.net>
In article <1997Feb26.182406@eagle.tntech.edu>,
Gary Andraza <gaa7065@tntech.edu> wrote:
>Where did the list move to so that I can subscribe to it. I
>would sure apprieciate the help.
perl5-porters-request@perl.org might be a good address to try if you want
to subscribe to the list.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 27 Feb 1997 00:37:44 GMT
From: "James Duncan" <jduncan@hawk.igs.net>
Subject: Re: CRC or checksum
Message-Id: <01bc2446$c0fdcb20$0a30f8ce@hawk.igs.net.demo>
Brian Flanagan <flanagan@twisto.compaq.comm> wrote in article
<331365A6.41C67EA6@twisto.compaq.comm>...
> Hi,
>
> I would like to generate a semi-unique number for a
> large array of strings and integers, using a CRC or
> checksum algorithm. I think I will need to use pack,
> but don't know how to do any byte operations on its
> return value. Any suggestions would be helpful.
>
> --
> Brian
>
My suggestion is that you should download and
use the Crypt::MD5 module. It's real easy, and
a whole bunch-o-fun.
Regards,
James.
------------------------------
Date: 27 Feb 1997 02:10:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: el porvenir di perl und java-script
Message-Id: <5f2qfg$abb$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
nvp@shore.net (Nathan V. Patwardhan) writes:
:plussier@isd.3com.com wrote:
:
:: Would you please post your chthonic camel sentence sometime ?
:
:I think it's already posted on the www.ora.com website in the description
:of _Programming Perl_.
I didn't see it. Here it is:
That reminds me of how I despite diligent and even prayer-filled
attempts to rid myself of such traumatic experiences to this very
day still recall in dreams sleeping and waking those interminably
long and bleary-eyed nights sequestered chez Larry in Mountain
View this past July during which I would cobble together tortuous
monstrosities of innumerable clauses and moods and styles and
dubious-at-best antecedents bereft of periods or even semi-colons,
chthonic monstrosities long since banished to the nethermost depths
of RCS purgatory whence they cry out in anguish and in irrepentant
shamelessness to be brought forth again to the light of day and of
my fellows so that others might with their own disbelieving eyes see
how very miserable were the aborted words that a once-shimmering
brain then laden with fatigue toxins was nonetheless able to spew
out, all the while blisslessly unaware that those very words would
cause not just Sharon and Gloria but indeed the entire Wall household
immured with us for the duration to not once but rather on repeated
occasions erupt in fits and paroxyms of giggles and gaffaws while
feigning learnhd attempts at unravelling just what in tarnation
I was in fact trying to convey when I started those labyrinthine
sentences so painfully like this one.
I've put it up in HTML format at
http://www.perl.com/perl/critiques/chthonic.html for websters.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
At MIT the server is the unit of invention. --Rob Pike
------------------------------
Date: 27 Feb 1997 02:26:57 GMT
From: "Neil Edmondson" <neiled@enteract.com>
Subject: FILE LOCKING
Message-Id: <01bc2455$75ba6060$1d94e5cf@default>
Although the following code will do what I want (that is I can live with
the risk). There's a big hole re: locking. What strategies exist to deal
with the possibility that someone else may grab the file and screw with it
in between reading and writing?
open (SESSION, "<" . $session_file); # Open the file for reading
flock (SESSION, $exclusive_lock); # and lock it for exclusive use
$session_ID = <SESSION>; #
flock (SESSION, $remove_lock); # Give the file back
close (SESSION);
$session_ID++; # Bump the session counter
open (SESSION, ">" . $session_file); # Open the file for writing
flock (SESSION, $exclusive_lock); # and lock it for exclusive use
print SESSION $session_ID; # and rewrite
flock (SESSION, $remove_lock); # Give the file back
close (SESSION);
TIA, Neil
neil@weaveware.com
---------------------------------
Collectible baskets on the web at
http://www.weaveware.com
---------------------------------
------------------------------
Date: Thu, 27 Feb 1997 01:09:31 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Handling signals without dieing
Message-Id: <E68Lvv.A51@bcstec.ca.boeing.com>
In article <33137024.36DA@fnal.gov>, Elliott McCrory <mccrory@fnal.gov> wrote:
>(May have already been posted, not sure).
>
> I want to set an alarm in perl 5.003, do something and then continue on,
> until the next alarm comes. I have this snippet:
>
> #!/usr/local/bin/perl
>
> $sec = 10;
> $SIG{ALRM} = 'mysub';
>
> alarm $sec;
> print "Waiting\n";
> while (<>) {
> print "Line read $_";
> alarm $sec; # Wait some more
> }
>
> sub mysub {
> print "Alarm signal caught\n";
> return; #This line is irrelevant to behaviour
> }
>
> which does this:
>
> solaris $ ./test-alarm.pl
> Waiting
> Alarm signal caught
> solaris $
>
> Program dies *immediately* after execution of &mysub.
>
> How do I return from &mysub without killing the program?
Best to use eval {}; and avoid a risky print in your
signal handler, e.g.,
$alarm = "Alarm signal caught\n";
$SIG{ALRM} = sub { die $alarm };
LOOP: {
eval {
$sec = 10;
print "Waiting\n";
alarm $sec; # turn on alarm
while (<>) {
alarm 0; # turn off alarm
print "Line read $_";
alarm $sec; # reset alarm
}
};
if ( $@ =~ /^$alarm/ ) {
print $alarm;
redo LOOP; # if there's a 2nd chance
} elsif ($@) {
die "weird eval error: $@";
}
}
__END__
HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com
------------------------------
Date: 27 Feb 1997 01:43:09 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How thread safe is Perl?
Message-Id: <5f2ord$9hi$4@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, "Mark Scaletti" <marks@telebusiness.co.nz> writes:
:I'm looking at using Perl as a component of a multithreaded application. I
:have been unable to find any information about how thread safe Perl is.
:Are there any thread-safe versions of Perl?
Not really, but Malcolm's working on it. See the recent posting to the
perl-porters list.
Hm... do you have a thread-safe libc?
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Remember why the good Lord made your eyes -- Pla-gi-a-rize! --Tom Lehrer
------------------------------
Date: 27 Feb 1997 01:32:43 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to spam - legitimately
Message-Id: <5f2o7r$9hi$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:
:Although 'send me an email' doesn't sound that bad,
It does to me. It doesn't sound like a native speaker.
Everyone I know would just say "send me email" in that case.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Debugging is anticipated with distaste, performed with reluctance, and bragged
about forever."
--button at the Boston Computer Museum
------------------------------
Date: Wed, 26 Feb 1997 16:12:56 -0800
From: Daniel Moore <mooreds@whitman.edu>
To: Bertil Wennergren <bw@mail2.tripnet.se>
Subject: Re: learning perl
Message-Id: <Pine.SOL.3.95.970226160700.14518B-100000@marcus.whitman.edu>
On 16 Feb 1997, Bertil Wennergren wrote:
>En la afisxo <33038601.12843692@news.ultranet.ca> Helen skribis:
>
>: I'm in a similar position myself. I found that both Camel books
>: (Learning Perl being one of them, Programming Perl being the other)
>: became clearer as I learned more unix. They assume a unix background
>: in the reader. Not to have done so would have made them twice as
>: thick. Fortunately, unix isn't that hard to pick up. Learning unix is
>: useful even if you plan to use Perl on NT or whatever.
>
>True. Almost all material on Perl that I have come across has assumed a
>knowledge of C(++). This has been a major obstacle in my Perl learning
>since I don't know _any_ programming language, least of all C. Is there
>any material out there that does not start every other sentence with "this
>is mostly like C except for..."?
Hi,
I would just like to say that Perl was my very first true programming
language (I sure don't count HTML). I didn't think that _Learning
Perl_ assumed any knowledge of any programming language.
The easiest way to learn Perl is to follow those exercises in the
back of the Llama book. In the early stages, I tried to use Perl for
everything, even stuff that could have been done more efficiently by
another means.
Of course, I learned on a UNIX system, so that may have made things a
bit easier.
Dan
--
"If God had wanted us to vote, He would have given us candidates."
Barbara Hlavin(?)
------------------------------
Date: 27 Feb 1997 01:18:33 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: learning perl
Message-Id: <5f2nd9$md7@fridge-nf0.shore.net>
Daniel Moore (mooreds@whitman.edu) wrote:
: I would just like to say that Perl was my very first true programming
: language (I sure don't count HTML). I didn't think that _Learning
: Perl_ assumed any knowledge of any programming language.
It's good that you don't count HTML, because HTML isn't a programming
language - it's a markup. It's a collection of tags that are interpreted
by the browser.
--
Nathan V. Patwardhan
nvp@shore.net
"What is the wind speed of a sparrow?"
------------------------------
Date: Wed, 26 Feb 1997 20:25:29 -0500
From: Bill Cowan <billc@tibinc.com>
To: Phil Hanna <>
Subject: Re: MS Access database access from Perl for Win32
Message-Id: <3314E289.1591@tibinc.com>
Phil Hanna wrote:
>
> How can I access a MS Access database (.mdb) from a Perl for Win32
> program?
>
> Thanks.
> Phil Hanna (saspeh at unx dot sas dot com)
> Econometrics and Time Series R&D
> SAS Institute, Inc.
Usual answer on NT is ODBC to MS Access:
Database access via ODBC by Dave Roth's Win32::ODBC module:
Win32::ODBC Home Page with Online Documentation:
http://www.roth.net/odbc/
Download from:
http://www.perl.com/CPAN/authors/Dave_Roth/
-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com> Voice:919-490-0034 Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707
------------------------------
Date: 27 Feb 1997 02:05:07 GMT
From: "Roth Consulting" <rothd@roth.netX>
Subject: Re: new win32::ODBC("DSN")
Message-Id: <01bc2452$47e88430$0100a8c0@www>
You need to read the docs! Or the FAQ.
When this happens use the following line:
print Win32::ODBC::Error() . "\n";
dave
--
================================================================
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
rothd@roth.net the illusion of integrity
My email address is disguised to fool automailers. Remove the
trailing 'X' to send me email.
****************************************************************
Use of this message or email address for commercial purposes
(including "junk" mailings) is strictly prohibited and protected
under current international copyright laws and United States
Code, Title 47, Chapter 5, Subchapter II.
ted wang <ted.wang@bowne.com> wrote in article <33147E24.5675@bowne.com>...
> I just downloaded the win32::ODBC module from
> http://www.roth.net/odbc/odbcfaq.htm
> and installed it according to the instruction.
>
> However I cann't get it work. (I have 32 bit version of ODBC 3.0
> installed).
>
>
> In my test.pl, I only have two lines:
>
> use Win32::ODBC;
>
> $db= new Win32::ODBC("DSN=t:miswd001:wnt1;UID=ted;PWD=wang;") ;
>
>
> The $db always return null.
>
> I'm not sure if the DSN is correct or not.
>
> DSN='t:miswd001:wnt1' , where t:miswd01:wnt1 is the host string
> when i use sqlplus to access database.
>
> What is the DSN supposed to look like ?
>
> Any help is appreciated . (email response preferred)
>
> --Ted Wang
>
------------------------------
Date: 27 Feb 1997 01:48:28 GMT
From: edward@nsrc.nus.sg (Edward Walker)
Subject: Re: perl forking problem
Message-Id: <5f2p5c$9bt@nuscc.nus.sg>
Russ Allbery (rra@cs.stanford.edu) wrote:
: [ Posted and mailed. ]
: Derek A Crovo <s14237dc@umassd.edu> writes:
: > I've written a small perl program that does a rsh to a bunch of other
: > machines on a lan. The way I do it now is:
: > $result = `rsh $host last | grep $ARGV[0] | head -n 1`;
: > I want all the rsh's to happen at the same time, so I don't have to wait
: > so long for the output. I tried putting each rsh into child processes,
: > but it seems to fork off a child, and wait for it to complete before it
: > forks the next one.
: [stuff deleted ...]
: You have to have somewhere for the data to go when each rsh completes, and
: you're going to be getting that data asynchronously. In other words, you
: won't know which rsh is going to finish first. This is why Perl waits for
: a command in backticks to finish; that way, it can get all the data, put
: it in the scalar, and then move on. There isn't any built-in mechanism to
: say "go do this, put the results in $foo when it's done, and in the
: meantime continue executing my script". You'd need a full-blown parallel
: programming language to have that as part of the language.
If you would like to use a clean message-passing parallel programming model,
try the Perl-PVM module. It can be used to implement parallel programs
on clusters of workstations as well as on a uniprocessor system for
prototyping.
Check out the URL
http://www.nsrc.nus.sg/STAFF/edward/Pvm.html
Cheers!
- Ed
----------------------------------------------------------------------
Edward Walker, PhD
National Supercomputing Research Center
81, Science Park Drive
#04-03, The Chadwick
Singapore
Email: edward@nsrc.nus.sg
Tel: ++(65)-770-9234
------------------------------
Date: Tue, 25 Feb 1997 23:51:46 GMT
From: wilsonpm@gamewood.net (Pete M. Wilson)
Subject: Re: Perl on Windows 95
Message-Id: <33137aee.33198280@news.gamewood.net>
Microsoft has the free PWS (Personal Web Server) for Win95 on their
site. I don't know if it supports scripting.
Peter Holtan <puzzled@cris.com> wrote:
>Hank,
>
>I have the same question as Mark did. Please excuse me if my question
>sounds stupid, but I am very new to this. Where can I get a server? Is
>there a good one that you would suggest that I could download for free?
>I hope I could get a server for Windows95, I have LINUX but I have too
>many problems with it and X runs so damn slow.
>
>Thank you,
>Peter Holtan
>puzzled@cris.com
>
>
>Hank LeMieux wrote:
>>
>> Mark,
>>
>> You wrote,
>> > I would like to also see how it works by loading the page into Netscape
>> > locally and then running the script (like it would on a server). Is
>> > this possible. When I tried clicking on the button that calls the
>> > script nothing happened.
>>
>> Well, here are two options:
>>
>> 1)Use Netscape's File|Open command to directly open the script. When
>> netscape says it doesn't know what to do with the file, tell it to open
>> it with the script interpreter (ie: if you're using perl, tell it to use
>> perl.exe as the helper.) All this will do is have Netscape open the perl
>> command window and run the script every time you open a .pl file. This
>> won't emulate what the script will do on the server.
>>
>> 2) Install a server on your machine and run it locally. That's how I
>> test my scripts.
>>
>> Hank
>> --
>>
>> Hank LeMieux
>> Freelance Web Design/JavaScript/CGI
>> Santa Fe, NM, USA
>> (505) 986-8166
>> http://members.aol.com/HankW
------------------------------
Date: Wed, 26 Feb 1997 19:22:08 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: perl-system call-security++
Message-Id: <fl_aggie-ya02408000R2602971922080001@news.fsu.edu>
In article <01bc243a$1628b180$8a0e0792@flipbits>, "Jeff Peck"
<peck@csc.smsu.edu> wrote:
+ I webmaster a small college webserver. I am concerned that hackers slipping
+ "system" calls into cgi scripts on this server.
Why do you permit hackers access to your CGI programs?
Or do you mean to say that the suspected hackers are your users who have
permission to put CGI programs on your server?
Or are you worried about Bad Programming Practices and Potential Security
Flaws Opened to the Whole World inadvertantly by one of these aforementioned
users?
James
--
Consulting Minster for Consultants, DNRC
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: 27 Feb 1997 01:00:55 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Problem with function gethostbyname
Message-Id: <5f2mc7$ql3@news-central.tiac.net>
In article <33152220.5D3B@ping.be>, Bart Haezeleer <ping0621@ping.be> wrote:
>print ((gethostbyname(hostname()))[4], "\n");
># output : A"
>
>How can get the TCP/IP address via gethostbyname ?
>Who do I have to manipulate the last output to get the IP ?
The value you have is 4 bytes, you might want to do this:
$ perl -de 1
Stack dump during die enabled outside of evals.
Loading DB routines from perl5db.pl patch level 0.9905
Emacs support available.
Enter h or `h h' for help.
main::(-e:1): 1
DB<1> $packedIP = (gethostbyname 'www.perl.com')[4]
DB<2> print join '.', unpack 'C*', $packedIP
199.45.129.30
DB<3> use Socket
DB<4> print inet_ntoa ((gethostbyname 'www.perl.com')[4])
199.45.129.30
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 27 Feb 1997 02:18:00 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Problems reading file using <> operator
Message-Id: <5f2qso$4c3@news-central.tiac.net>
In article <DANR.97Feb26130441@hpwadjn.wal.hp.com>,
Daniel Rasmussen <danr@hpwadjn.wal.hp.com> wrote:
>I have a perl module that reads from a file using the <> operator.
>The exact code is as follows:
>
> open(PFILE, $pFile);
> while (<PFILE>)
> {
> if (/coc/)
> {
> ($par, $cocInd) = /(\".*\")(.*)\)/;
> }
> }
> close(PFILE);
>
>This code works as expected when called from my test app but I have
>problems when its used by the app it was designed for. Specifically,
>it is reading more than one line at a time when used by the other
>app. It behaves more like read() in that it seems to be reading a
>specific number of byes rather than a line at a time.
The <> operator reads records terminated by the contents of the perl
special vairable $/ (or the end of file) There are a few special cases,
which are documented in the Special Variables bit of The Gory Details
chapter in the 2nd edition of Programming Perl or in the perlvar manual
page that comes with perl 5 (or somewhere in the monster manual page that
comes with perl 4.xxx)
You probably want to see if $/ is defined and if so what it contains. It
may be that a
{
local $/ = "\n";
...
}
is needed to temoprarily set it to your desired end of record character
(this'll do the default line at a time slurping in Unix)
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 27 Feb 1997 01:39:19 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Question on "eval"
Message-Id: <5f2ok7$9hi$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
salisbur@venus.fsl.noaa.gov (David Salisbury) writes:
:
:Okay, I admit it, I'm not a perl wiz. Can someone please tell me
:why the code below doesn't work, and maybe even a solution.
:I've tried several ways, but I would think that the "\" escape
:protects the $ from the first pass of the eval.
:
:-------------------
:#!/bin/perl
:
:$sortorder='$date$type';
:
:$date='05/01/96';
:$type="bob";
:
:$sometext = "this is some text";
:
:eval "\$anArray{$sortorder} = \$sometext"; ##<--- why no work??
Because 5 divided by 1 divided by 96 is a silly notion, which
is what the eval is doing to you. Remove the eval and just to
the obvious thing:
$sortorder = "$date$type"; # note *double* quotes
$anArray{$sortorder} = $sometext; # see no eval, fear no eval!
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
*bp++ = i; /* now go back to screaming loop */
--Larry Wall, from perl/sv.c in the v5.0 perl distribution
------------------------------
Date: Wed, 26 Feb 1997 21:28:01 -0500
From: Luc St-Louis <lucs@cam.org>
Subject: Returning a reference to a 'my' variable
Message-Id: <3314F131.1D9EE6FE@cam.org>
I need to write a sub thats creates a huge list and would like to return
a reference to the list, rather than the list itself. For example:
sub CreateList
{
my @x;
# ... Build up the list ...
return \@x;
}
$A = CreateList();
$B = CreateList();
Does this work? Are references $A and $B guaranteed to be different and
usable?
------------------------------
Date: Wed, 26 Feb 1997 18:14:14 -0800
From: Marty McDowell <oshmis1@pacbell.net>
Subject: sometimes > not greater than?
Message-Id: <3314EDF6.7CC4@pacbell.net>
We had a program going through timecard punches and found that
sometimes 5 is not 5. How can I get the correct answer? Here
is some samples (of course the real program had variables instead
of hard coded numbers but it behaves the same)
$f = 6 - 1;
if ($f > 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12 - 7;
if ($f > 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.72 - 7.72;
if ($f > 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.62 - 7.62;
if ($f > 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.82 - 7.82;
if ($f > 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.7 - 7.7;
if ($f > 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.8 - 7.8;
if ($f > 5) { print "$f yes\n"; } else { print "$f no\n"; }
Produces the following:
5 no
5 no
5 yes
5 no
5 no
5 no
5 yes
And this code:
$f = 6 - 1;
if ($f == 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12 - 7;
if ($f == 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.72 - 7.72;
if ($f == 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.62 - 7.62;
if ($f == 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.82 - 7.82;
if ($f == 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.7 - 7.7;
if ($f == 5) { print "$f yes\n"; } else { print "$f no\n"; }
$f = 12.8 - 7.8;
if ($f == 5) { print "$f yes\n"; } else { print "$f no\n"; }
Produces this:
5 yes
5 yes
5 no
5 no
5 yes
5 no
5 no
We're running 5.001m under SVR5.4 on an intel box (unisys).
------------------------------
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 21
************************************