[9786] in Perl-Users-Digest
Perl-Users Digest, Issue: 3379 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 6 15:07:13 1998
Date: Thu, 6 Aug 98 12:00:27 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 6 Aug 1998 Volume: 8 Number: 3379
Today's topics:
[Q] copy Hash to temp Hash, change temp & not the orig? (Scott Cherkofsky)
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in <tchrist@mox.perl.com>
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (Marek Jedlinski)
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (brian d foy)
Binary File Upload <cgsshadow@hotmail.com>
Re: c.l.p.moderated: not much traffic? (Andy Lester)
Can't Match Multi-Line Pattern <matt@steinhoff.net>
Re: Can't Match Multi-Line Pattern (Larry Rosler)
Re: Can't Match Multi-Line Pattern (Craig Berry)
catnaps (was: Re: Threads and the debugger) (Greg Bacon)
Re: comp.lang.perl.announce redux (Abigail)
Re: Crossposting to clp.moderated and clp.misc? (Mark-Jason Dominus)
Re: Directory size (including all clilt files / dirs) - (Greg Bacon)
Re: gethostbyaddr (M.J.T. Guy)
Re: gethostbyaddr (Larry Rosler)
Re: help a newbie, please! mchunziker@us.fortis.com
Re: help a newbie, please! <REPLY_TO_lastronin@earthlink.net>
HELP on Perl <hiten@star.rl.ac.uk>
Re: Intriguing coderef question <tchrist@mox.perl.com>
MAJOR PROBLEMS <mlr7@po.cwru.edu>
modules and mounted disks <aravind@genome.wi.mit.edu>
Re: Newbie: Objects <jdporter@min.net>
Package visibility livshits@acm.org
Re: Perl 5.005 Beta 2 on NT mshore@arborsoft.com
Re: Perl Docs.. forget the original post <jdporter@min.net>
Re: Perl Docs.. forget the original post <jdporter@min.net>
Re: Reading file into single scalar, what's fastest? <barnett@houston.Geco-Prakla.slb.com>
Relocating Perl tree ... thalabi@my-dejanews.com
Re: Relocating Perl tree ... (Greg Bacon)
Re: Search Engine <thomas@marathoncom.com>
Re: socket problem <jperkins@wtmail.wtamu.edu>
Re: stuck: variable replacement within backquote escape (Mark-Jason Dominus)
Re: Teaching Perl <jdporter@min.net>
Threads and the debugger (David B. White)
variable indirection ioioio@my-dejanews.com
Re: variable indirection (Craig Berry)
Re: variable indirection <matthies@fsinfo.cs.uni-sb.de>
Re: variable indirection (Greg Bacon)
Re: X-file (?=...), case postponed. (Patrick Timmins)
Re: X-file (?=...), case postponed. <boys@aspentech.com>
Re: Zombies from Forking are Bad, says Sun (Ron Heiby)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 6 Aug 1998 14:27:34 -0400
From: crusader@bobo.shirenet.com (Scott Cherkofsky)
Subject: [Q] copy Hash to temp Hash, change temp & not the orig?
Message-Id: <6qcsim$8iq@bobo.shirenet.com>
I'm reading a file into a Hash variable and then doing some work on
the Hash which changes its values.
I want to keep a copy of the Hash variable in its original state before
being changed by the rest of the code in my script.
I did this (see below) and for some reason both Hash variables got changed
as if they were the same variable (or the execution of this code somehow
happened after the original Hash was changed):
%hOriginalFile = %hFile;
After that line in the file is where I do all my changes to %hFile but when
I print out both of them, they both show the changes.
What's happening here?
Scott
--
____________________________________________________________________________
Scott | scottc1033 aol com | Need Interenet access in Virginia?
Cherkofsky|crusader shirenet com | Try Shirenet <mailto:info@shirenet.com>
'Crusader'|HomePage: http://www.shirenet.com/~crusader/html/Home.html
------------------------------
Date: 6 Aug 1998 16:28:40 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <6qcljo$7u0$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Ludger Mainka <ludger.mainka@primus-online.de> writes:
:I tried to unpack the text version of the book from both the archive at
:perl.com and one from a German CPAN mirror and got CRC errors in both
:cases. Is there a problem or does my proxy store a garbled version?
As I've told about 15 people who've sent me mail about this, the problem
is that you're using Windows, and it screws up the download. The files
are intact and working correctly, as many can attest. There's nothing
I can do to fix Microsoft crippleware.
--tom
--
"Umm, square root of two? Ouch!"
--The guy who blew a hole in the Pythagoreans' assertion that all numbers can
be represented as a ratio of two integers, so they killed him
------------------------------
Date: Thu, 06 Aug 1998 18:06:51 GMT
From: cicho@polbox.com (Marek Jedlinski)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <35cae7ff.3770119@news.nask.org.pl>
Keywords: If you're happy and you know it, clunk your chains.
Ludger Mainka <ludger.mainka@primus-online.de> wrote:
>I tried to unpack the text version of the book from both the archive at
>perl.com and one from a German CPAN mirror and got CRC errors in both
>cases. Is there a problem or does my proxy store a garbled version?
>I'm dying to test the new features ...
I tried downloading the text/gzipped version from
http://language.perl.com/info/PerlDoc-5.005_02.txt.gz
but instead of saving to file, Netscape displayed the compressed garbage
on-screen. This behavior indicates that the http server is not configured
to recognize the .gz extension and instead sends the document as
text/plain, by default, which may corrupt the binary file.
.marek
--
General Frenetics, Discorporated: http://www.lodz.pdi.net/~eristic/
"The war isn't the war between the blacks and the whites, the liberals
and the conservatives, or the Federation and the Romulans. It's between
the clueful and the clueless." (an anonymous poster on Cypherpunks list)
------------------------------
Date: Thu, 06 Aug 1998 14:39:38 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <comdog-ya02408000R0608981439380001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35cae7ff.3770119@news.nask.org.pl>, cicho@polbox.com (Marek Jedlinski) posted:
>Ludger Mainka <ludger.mainka@primus-online.de> wrote:
>
>>I tried to unpack the text version of the book from both the archive at
>>perl.com and one from a German CPAN mirror and got CRC errors in both
>>cases. Is there a problem or does my proxy store a garbled version?
>>I'm dying to test the new features ...
>
>I tried downloading the text/gzipped version from
> http://language.perl.com/info/PerlDoc-5.005_02.txt.gz
>but instead of saving to file, Netscape displayed the compressed garbage
>on-screen. This behavior indicates that the http server is not configured
>to recognize the .gz extension and instead sends the document as
>text/plain, by default, which may corrupt the binary file.
yep:
HTTP/1.1 200 OK
Date: Thu, 06 Aug 1998 18:32:59 GMT
Server: Apache/1.2.6 mod_perl/1.11
Last-Modified: Mon, 03 Aug 1998 12:33:59 GMT
ETag: "feae-eb49f-35c5ae37"
Content-Length: 963743
Accept-Ranges: bytes
Content-Type: text/plain
Content-Encoding: x-gzip
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>
------------------------------
Date: Thu, 06 Aug 1998 10:18:52 -0700
From: shadow <cgsshadow@hotmail.com>
Subject: Binary File Upload
Message-Id: <35C9E57B.73D6D6B4@hotmail.com>
I have the following working for text files... but can't seem to get
binary files to work... any ideas, thoughts? All I'm getting with binary
is a file with the first 2-10 characters or so... the rest are "lost".
Thanks
#pardon any typos...
binmode STDIN;
$tempFile = "test.dat";
unless (open (X, ">$tempFile")) {
die ("cannot open temporary file");
}
binmode X;
while ($bytesRead = read(STDIN, $tempBuffer, 1024)) {
print X $tempBuffer;
}
close X;
------------------------------
Date: 6 Aug 1998 17:11:30 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <6qco42$kga$1@supernews.com>
: Pehaps clp.mod wasn't such a good idea after all, if noone wants to use it.
Only in the Internet 90s can you find people deciding that because a
worldwide anarchic gathering of people and resources hasn't gelled to hit
an arbitrary standard that said gathering is a failure.
xoxo,
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: Thu, 06 Aug 1998 13:03:25 -0400
From: Matt Steinhoff <matt@steinhoff.net>
Subject: Can't Match Multi-Line Pattern
Message-Id: <35C9E1DD.70E@steinhoff.net>
I'm sure this is easy and am just missing the boat.
I'm trying to change text between two HTML tags ("<B>text</B>"
becomes "t^De^Dx^Dt^D"). If the HTML tags are on the same line,
all is right with the world. If the tags span a line, life is not
worth living.
Per the perl FAQ, I've tried undef'ing $/ and I still get no love.
I've also tried changing...
s/($pre.*?$post)/markup($1,$char)/ge;
...to...
s/($pre.*?$post)/markup($1,$char)/gem; # m should match multi-line?
...with the exact same results.
Code below. Please be nice. Perl ans
Matt
$char = "\004"; #the character add between
$pre = "<[B|b]>"; #the prefix
$post = "<\/[B|b]>"; #the suffix
print doit($char,$pre,$post, \$x);
sub doit
{
my $char = shift;
my $pre = shift;
my $post = shift;
my $retval = '';
while (<>) {
s/($pre.*?$post)/markup($1,$char)/ge;
$retval .= $_;
}
return $retval;
}
sub markup
{
my $x = shift;
my $char = shift;
$x =~ s/($pre|$post)//g;
$x =~ s/(.)/$1$char/g;
return ($x);
}
+----------------------------------------------------------------+
| Matt Steinhoff 407-420-6121 |
| matt@steinhoff.net Unix Systems Administrator |
------------------------------
Date: Thu, 6 Aug 1998 11:29:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Can't Match Multi-Line Pattern
Message-Id: <MPG.103395d174591028989756@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <35C9E1DD.70E@steinhoff.net> on Thu, 06 Aug 1998 13:03:25 -
0400, Matt Steinhoff <matt@steinhoff.net> says...
> I'm sure this is easy and am just missing the boat.
> I'm trying to change text between two HTML tags ("<B>text</B>"
> becomes "t^De^Dx^Dt^D"). If the HTML tags are on the same line,
> all is right with the world. If the tags span a line, life is not
> worth living.
> Per the perl FAQ, I've tried undef'ing $/ and I still get no love.
> I've also tried changing...
> s/($pre.*?$post)/markup($1,$char)/ge;
> ...to...
> s/($pre.*?$post)/markup($1,$char)/gem; # m should match multi-line?
> ...with the exact same results.
You were on the right track to undef $/ and read the whole file into one
string. Where you went wrong is with the modifier '/m', which only
affects the behavior of '^' and '$'. What you should use is '/s', which
causes '.' to match "\n".
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 6 Aug 1998 18:21:33 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Can't Match Multi-Line Pattern
Message-Id: <6qcs7e$kgg$1@marina.cinenet.net>
Matt Steinhoff (matt@steinhoff.net) wrote:
: I'm sure this is easy and am just missing the boat.
: I'm trying to change text between two HTML tags ("<B>text</B>"
: becomes "t^De^Dx^Dt^D"). If the HTML tags are on the same line,
: all is right with the world. If the tags span a line, life is not
: worth living.
: Per the perl FAQ, I've tried undef'ing $/ and I still get no love.
By this, I presume you mean that you've read the entire file into a single
scalar, a necessary (but not sufficient) step toward doing this with one
substitution.
: I've also tried changing...
: s/($pre.*?$post)/markup($1,$char)/ge;
: ...to...
: s/($pre.*?$post)/markup($1,$char)/gem; # m should match multi-line?
: ...with the exact same results.
For some reason, the /m and /s modifiers cause far more confusion than
seems warranted. See Freidl's brilliant explanation of these in
_Mastering Regular Expressions_ for full enlightenment. In brief,
though:
/m has only one effect -- changing how ^ and $ are interpreted. Without
/m, they match only at the beginning and end of the entire string; with
it, they can also match at internal newlines. Your regex has no ^ or $,
so /m is irrelevant.
/s has only one effect -- changing how . is interpreted. Without /s, .
matches any character except newline. With it, it matches any character
*including* newline. You want your .* above to span newlines, so /s is
what you need.
Hope this helps...
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 6 Aug 1998 18:52:33 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: catnaps (was: Re: Threads and the debugger)
Message-Id: <6qcu1h$15f$13@info.uah.edu>
In article <6qcraq$fo6$1@mdnews.btv.ibm.com>,
dbwhite@btv.ibm.com (David B. White) writes:
: sleep 0.1;
*Bzzt* See perlfaq8 for how to do what you think that's doing.
Greg
--
Convictions are more dangerous enemies of truth than lies.
-- Nietzsche
------------------------------
Date: 6 Aug 1998 18:09:05 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: comp.lang.perl.announce redux
Message-Id: <6qcrg1$4ld$1@client3.news.psi.net>
Randal Schwartz (merlyn@stonehenge.com) wrote on MDCCCI September
MCMXCIII in <URL: news:8c90l2cgmi.fsf@gadget.cscaper.com>:
++ >>>>> "Abigail" == Abigail <abigail@fnx.com> writes:
++
++ Abigail> Well, of the 7 groups you mentioned, PSInet doesn't carry 4 of them.
++
++ That's not surprising, given the interesting delay PSInet had in
++ creating comp.lang.perl.moderated. Is it even carrying it yet?
Nope. Customer support claimed twice they created it, but I haven't
heard back after I mailed telnet sessions to their NNTP servers,
clearly indicating the 411 response on 'GROUP comp.lang.perl.moderated'.
It's still not there. A bunch of lusers.
But, PSInet might soon be hit by a UDP, so, if you don't hear from
me again, you know why....
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 6 Aug 1998 13:47:56 -0400
From: mjd@Op.Net (Mark-Jason Dominus)
Subject: Re: Crossposting to clp.moderated and clp.misc?
Message-Id: <6qcq8c$4cg$1@monet.op.net>
In article <6qcm25$rvi$1@news-int.gatech.edu>,
Chris Sidi <sidi@ulc199.residence.gatech.edu> wrote:
>Is it okay to crosspost questions to clp.moderated and clp.misc?
We had some discussion of this, and no clear policy emerged. So far
nobody has rejected an article for being crossposted, so I guess that
means it's OK, unless some kind of problem arises.
>Can I keep both groups in the follow-ups, or should I set it to just
>clp.misc?
You should do whatever you think is best.
------------------------------
Date: 6 Aug 1998 16:59:10 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Directory size (including all clilt files / dirs) - help
Message-Id: <6qcncu$15f$10@info.uah.edu>
In article <6qckir$7ho$1@news.interlog.com>,
"Jason Morehouse" <jm@interlog.net> writes:
: Anyone know the quickest way using non system calls to get the size of a
: directory and all of its contents (including all child directories / files)?
% du -sk dir
: I am using perl32 on NT server -- any functions, modules or otherwise
: possibilities are appreciated!
Oh.. you could try using File::Find and lots of -s.
Greg
--
Improve the postal system -- mail their pay checks!
------------------------------
Date: 6 Aug 1998 17:17:45 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: gethostbyaddr
Message-Id: <6qcofp$590$1@pegasus.csx.cam.ac.uk>
Matt Knecht <hex@voicenet.com> wrote:
>
>Quickly to the point:
>
>use Socket;
>$adrs = '208.201.239.48';
>$name = gethostbyaddr(pack('C4', split /\./, $adrs), AF_INET);
If you're Doing The Right Thing by using Socket, you might as well go
the whole way:
$name = gethostbyaddr(inet_aton($adrs), AF_INET);
Mike Guy
------------------------------
Date: Thu, 6 Aug 1998 11:18:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: gethostbyaddr
Message-Id: <MPG.10339339a3d0832b989755@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <6qclq9$rgi$1@nnrp1.dejanews.com> on Thu, 06 Aug 1998 16:32:09
GMT, droby@copyright.com <droby@copyright.com> says...
...
> A common idiom is something like
>
> $ip_address = "209.67.73.165";
> $hostname = gethostbyaddr(pack('C4', split(/\./, $ip_address), AF_INET);
>
> Hope this helps!
It helps even more if you replace the left parenthesis after 'split' by a
space. Then at least it compiles!
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 06 Aug 1998 16:45:25 GMT
From: mchunziker@us.fortis.com
Subject: Re: help a newbie, please!
Message-Id: <6qcmj6$t06$1@nnrp1.dejanews.com>
In article <35C96C4F.717A4F0D@hotmail.com>,
Jianjun Feng <j9feng@hotmail.com> wrote:
> I am running a server(Apache) on my Win95. Perl is installed in C:\Perl
> directory.
>
> I borrowed a very simple perl script and tried to use it in my server.
> The first line in the script is written for unix system: something like
> " #!/usr/bin/perl". How can i do the same thing for win95, or can i do
> it in win95 at all?
> If I could make the simplest thing done, I will have a good chance to
> learn the real perl things. But the problem is where I shall start
> from?
>
> Help me to make my first step straight
> Thank you
> Jianjun Feng.
Win95 dosen't use the #!/usr/bin/perl line....it's a unix thing.
Include the path to your perl.exe in your path statement. I have heard
that defining .pl extensions do not work in win95. You could write a batch
file to execute your script...
foo.bat
rem begin
c:\perl\bin\perl -w foo.pl
rem end
Hope this gets you started.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 6 Aug 1998 13:14:07 -0400
From: "Ha" <REPLY_TO_lastronin@earthlink.net>
Subject: Re: help a newbie, please!
Message-Id: <6qcnkt$cdt$1@oak.prod.itd.earthlink.net>
Jianjun Feng wrote in message <35C96C4F.717A4F0D@hotmail.com>...
>I am running a server(Apache) on my Win95. Perl is installed in C:\Perl
>directory.
>
>I borrowed a very simple perl script and tried to use it in my server.
>The first line in the script is written for unix system: something like
>" #!/usr/bin/perl". How can i do the same thing for win95, or can i do
>it in win95 at all?
>If I could make the simplest thing done, I will have a good chance to
>learn the real perl things. But the problem is where I shall start
>from?
>
>Help me to make my first step straight
>
>Thank you
>Jianjun Feng.
>
create a folder called 'usr' directly under your c:\ directory or wherever
your primary disk stuff is. reinstall Perl for Windows under c:/usr. When
you're done, check that your directory tree resembles the shell path perl
needs to automagically execute cgi scripts, ie. c:\usr\bin\perl.
if you're running win Apache, uncomment the line that turns on your cgi
stuff.
cheers,
ha quach
mailto:info@r-go.com
------------------------------
Date: Wed, 05 Aug 1998 16:43:26 +0100
From: Hitendra Patel <hiten@star.rl.ac.uk>
Subject: HELP on Perl
Message-Id: <35C87D9E.41C6@star.rl.ac.uk>
Help Please.
I'm not a programmer but I need a program to manipulation the file below
(FILE 1).
I need a program to read the file below and pickout the heading
HEP-NT-FARM followed by hepfm01 .. btbatch but NOT Level and convert it
into HTML form. For example the output might be in the form of:
HEP-NT-FARM : hepfm01 hepfm02 hepfm03 hepfm04 ...
I would appreciate any help received
Thanks
Hiten
---------------------------
(FILE 1)
Level: HEP-NT-FARM
hepfm01
hepfm02
hepfm03
hepfm04
hepfm05
hepfm06
hepfm07
ntbatch
---------------------------
HITENDRA PATEL EMAIL: hiten@star.rl.ac.uk
------------------------------
Date: 6 Aug 1998 16:26:14 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Intriguing coderef question
Message-Id: <6qclf6$7u0$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Aravind Subramanian <aravind@genome.wi.mit.edu> writes:
:Question: how do I print the contents of the subroutine? In other words
:how do I print (or assign to a scalar var) the statments in the
:subroutine as opposed to the results
You can't. Perl doesn't keep around the source once it's been compiled.
:The need for this is that the code in the anon subroutine is dynamically
:generated and I'd like the users to see the results of the code as well
:as the code itself.
Then you'll have to set up some other mechanism.
But realize that printing the statements compiled into the code
won't help with variable bindings in the closure, if any,.
--tom
--
There is always a better way.
-- Thomas Edison
------------------------------
Date: 6 Aug 1998 17:55:43 GMT
From: "marlee" <mlr7@po.cwru.edu>
Subject: MAJOR PROBLEMS
Message-Id: <01bdc163$6e4ff9a0$10371681@steeljack.caff.cwru.edu>
I'm working on a simple email form script the entir script looks correct
but when i submit the form on the webpage netscape come back and displays
an error message that says "Out of Memory!" does anyone know what this
problem could be
marlee
mlr7@po.cwru.edu
------------------------------
Date: Thu, 06 Aug 1998 13:50:02 -0400
From: Aravind Subramanian <aravind@genome.wi.mit.edu>
Subject: modules and mounted disks
Message-Id: <35C9ECCA.F34B7FBD@genome.wi.mit.edu>
Can perl scripts on a Solaris machine "use" modules from a mounted disk
where the mounted disk is on a Digital UNIX machine (and has its own
installation of perl)
My guess is that modules pass to the invoking script c objects of some
sort. These would be compiled for Digital UNIX by Perl on the Digital
machine and hence will *not* run on the Solaris machine?
Am I naive / mistaken / wrong?
The problem I'm trying to solve is that scripts on a solaris machine and
a digital machine need to use the same set of modules. The obvious
solution is to keep copies on both machines - but this opens the
possibility of the copies going out of sync.
I'd appreciate any suggestions.
Thanks,
aravind
------------------------------
Date: Thu, 06 Aug 1998 13:21:40 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Newbie: Objects
Message-Id: <35C9E624.77B0@min.net>
indhiraa@hotmail.com wrote:
>
> > $a = TEST::new('Foo');
>
> Oops, wrong invocation. Here you call this just like an ordinary
> subroutine. So you should pass the class name explicitly.
>
> $a = TEST::new("TEST", 'Foo');
That's a strange (and error-prone) way to do it.
Perl provides the arrow syntax to make it easy and safe:
$a = TEST->new( 'Foo' );
This is The Right Way To Do It, 99.9% of the time.
--
John Porter
------------------------------
Date: Thu, 06 Aug 1998 17:56:20 GMT
From: livshits@acm.org
Subject: Package visibility
Message-Id: <6qcqo3$59l$1@nnrp1.dejanews.com>
Suppose I have defined module M and two packages in it,
M::A and M::B. I want M::A to be visible whenever the user
says 'use JS' and M::B to be invisible unless the user
exports it explicitly. Right now everyting is visible.
Is there a way to do this? Can I use @EXPORT or @EXPORT_OK
for this? Please email. Thanks,
--Vladimir
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 06 Aug 1998 18:19:26 GMT
From: mshore@arborsoft.com
Subject: Re: Perl 5.005 Beta 2 on NT
Message-Id: <6qcs3e$7ar$1@nnrp1.dejanews.com>
I tried building this version of Perl with MSVC 5. It worked!
> I'm having some trouble installing Perl 5.005 Beta 2 on NT.
>
> I use MSVC++ 4.2 (including nmake) on NT4.0. When the "USE_THREADS" line is
> uncommented in ...\win32\Makefile, the build craps out when it tries to make
> the SOCKET extension.
-Matt
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 06 Aug 1998 13:44:59 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl Docs.. forget the original post
Message-Id: <35C9EB9B.8F@min.net>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, jdporter@min.net writes:
> :> I'm sorry that this is a shock, but perl is a unix tool.
> :Ok. And it's a Windows tool; and a OS/2 tool, and a Mac tool, and
> :a VMS tool...
>
> If one were to run vi or emacs under OS/2, would that act ipso facto
> make them `OS/2 tools'?
Well, no. But Perl has been ported to many platforms, covers over
as many OS discrepancies as possible, and runs as identically as
possible (;-) on many platforms. So it's silly to say it's a
"unix tool". It is no longer in a class with, say, troff.
--
John Porter
------------------------------
Date: Thu, 06 Aug 1998 13:49:54 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Perl Docs.. forget the original post
Message-Id: <35C9ECC2.288E@min.net>
Gary L. Burnore wrote:
>
> On Thu, 06 Aug 1998 09:50:43 -0400, in article <35C9B4B3.37E6@min.net>, John
> Porter <jdporter@min.net> wrote:
>
> >no.unsoliciteds@dead.end.com wrote:
> >>
> >> All I can say is this - if the gurus had had bad tempered, ecclectic, obtuse
> >> and sometimes downright abusive lecturers with bad communication skills
> >> perhaps they would have a different attitude now.
> >
> >The implication is that the "gurus" have, as a result, bad communication
> >skills. But just you can't (or won't) read doesn't mean they can't
> >write.
> >Your disparagement is very unjustified, and is very insulting.
> >What have *you* done for the Perl community?
>
> You're again suggesting that because someone has done something for the Perl
> community they have a right to be rude.
No, actually we weren't talking about rudeness.
We were talking about how well the docs are written, and the
alleged indifference of the doc writers.
Rudeness was introduced as a rider rather late in the thread.
--
John Porter
------------------------------
Date: Thu, 06 Aug 1998 12:00:42 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Reading file into single scalar, what's fastest?
Message-Id: <35C9E13A.D132C56@houston.Geco-Prakla.slb.com>
Niklas Matthies wrote:
>
> Hi,
>
> Is there a better (i.e. faster) way to read a file into a scalar than
> the following?
>
> $file = '';
> open FILE, "< filename";
> $file .= $_ while <FILE>;
> close FILE;
>
I should think that this would be the best way to do what you want.
Maybe I'm wrong.
{
open (FILE, "< $filename") or die "$!\n";
# you should always check return codes on open of file
local ($/) = undef;
# set input record seperator to undefined value
$file = <FILE>;
# read entire file into scalar variable $file
close(FILE);
}
<snip>
Just my USD 0.02.
HTH.
Dave
--
Dave Barnett Software Support Engineer (281) 596-1434
If you make it idiot proof, they'll just make a better idiot.
------------------------------
Date: Thu, 06 Aug 1998 17:06:07 GMT
From: thalabi@my-dejanews.com
Subject: Relocating Perl tree ...
Message-Id: <6qcnpv$v30$1@nnrp1.dejanews.com>
Hi,
Is there a way to relocate the Perl tree without recompiling?
It seems that the directory name where Perl was initally installed is in the
perl binary and moving the Perl tree somewhere else causes problems when Perl
tries find modules.
Regards
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 6 Aug 1998 18:43:01 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Relocating Perl tree ...
Message-Id: <6qctfl$15f$12@info.uah.edu>
In article <6qcnpv$v30$1@nnrp1.dejanews.com>,
thalabi@my-dejanews.com writes:
: Is there a way to relocate the Perl tree without recompiling?
:
: It seems that the directory name where Perl was initally installed is in the
: perl binary and moving the Perl tree somewhere else causes problems when Perl
: tries find modules.
Perl uses some default values for @INC that are hardcoded:
% strings /usr/bin/perl | grep /usr/local
/usr/local/bin
/usr/local/lib/perl5/5.005
/usr/local/lib/perl5/5.005/IP22-irix
/usr/local/lib/perl5/site_perl/5.005/IP22-irix
/usr/local/lib/perl5/site_perl/5.005
You could `setenv PERL5OPT -I/path/to/new/tree', but programs that
enable taint checking will ignore this, so you'd have to add an
explicit C<use lib '...';> pragma.
I'd just go ahead and recompile Perl (very easy if you kept your
config.sh).
Greg
--
Join the Army: travel to exotic distant lands; meet exciting, unusual people,
and kill them.
------------------------------
Date: Thu, 6 Aug 1998 13:45:09 -0400
From: "Thomas Barnwell" <thomas@marathoncom.com>
Subject: Re: Search Engine
Message-Id: <6qcq70$f0$1@camel29.mindspring.com>
I've got a contract with two different search engines... :)
I'll probaly end up hiring someone to write the script, but I was hoping
there was already one around.
-Thomas
Greg Bacon wrote in message <6qcn9m$15f$9@info.uah.edu>...
>In article <6qckq3$h3h$1@camel29.mindspring.com>,
> "Thomas Barnwell" <thomas@marathoncom.com> writes:
>: Does any know a good meta search script? Preferably one that returns
results
>: to a new document and dosen't just forward you to the other search
engine's
>: pages.
>
>This is usually against the terms of use of most search engines.
>
>Greg
>--
>A Freudian slip is when you say one thing when you're thinking about a
mother.
> -- Cliff Clavin
------------------------------
Date: Mon, 03 Aug 1998 11:29:34 -0500
From: Justin Perkins <jperkins@wtmail.wtamu.edu>
Subject: Re: socket problem
Message-Id: <35C5E56E.266BABFE@wtmail.wtamu.edu>
Russ Allbery wrote:
> > $port = 2345 unless $port;
>
> > $AF_INET=2;
> > $SOCK_STREAM=1;
> > $SOCK_ADDR= "S n a4 x8";
>
> You're hard-coding constants, and quite possibly attempting to run this on
> a system where those hard-coded constants are the wrong numbers. One
> should never do this if it is avoidable, and in this case it is. Rather
> than what you're doing, see perldoc Socket and use the Socket module; it
> makes this much easier and avoids the magic pack.
>
I tried to use the socket module but it requires other modules...and the one I
couldn't get to work was Dynaloader.pm and Config.pm and these didn't work
well because I had to port them over from another version of perl. I don't
have any for Novell's perl.
Justin
------------------------------
Date: 6 Aug 1998 13:54:36 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: stuck: variable replacement within backquote escape?
Message-Id: <6qcqks$4ef$1@monet.op.net>
In article <35C8BA04.D2BC9AFA@americasm01.nt.com>,
Fenwick, Wynn [FITZ:4C17:009] <wynn@americasm01.nt.com> wrote:
>$today= `$gzcat $logfilename | $grep -c $regexp`;
>...does not work because the identifiers are sent to the shell that
>services the backquote expression instead of being replaced with values
>first.
You are mistaken. Variables and escape sequences are expanded inside
of backquotes, just as in a double-quoted string, and the resulting
string is executed as a command.
$mySecretPerlVariableThatTheShellDoesNotKnowAbout = 'ub';
$result = `echo $mySecretPerlVariableThatTheShellDoesNotKnowAbout | rev`;
print $result;
(Prints `bu')
You have some other problem, but because you don't say what is
happening, there is no way to give you any advice.
------------------------------
Date: Thu, 06 Aug 1998 13:36:25 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Teaching Perl
Message-Id: <35C9E999.5AC@min.net>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, jdporter@min.net writes:
> :While regex is important, and should be touched on,
> :But references are essential, since without them
> :you can't have perl's powerful complex data structures,
> :let alone its object-oriented capabilities.
>
> I think a reasonable argument could be made the other way:
> that more people need data munging, massaging, and verifying
> than those who need complex data structures or OOOP.
Good point. But in my experience, the vast majority of my
programs use gobs of complex data structures (not necessarily
OO), and a mere smattering of simple regexes.
So naturally I teach people to write the way I write.
--
John Porter
------------------------------
Date: 6 Aug 1998 18:06:18 GMT
From: dbwhite@btv.ibm.com (David B. White)
Subject: Threads and the debugger
Message-Id: <6qcraq$fo6$1@mdnews.btv.ibm.com>
I seemed to have missed how to force the debugger to follow both a
'new' or 'async' Thread as well as the mainline code, preferably in
separate windows per debug thread. I've searched Thread.pm and
attrs.pm, but didn't see anything obvious. Also checked the
debugger's online help, without luck. Is there someplace else I
should be looking?
Also, any suggestions on how the debugger can regain control of a
misbehaving thread? Try single stepping through the following
pathological example:
#!/usr/bin/perl -d
use Thread qw(async);
$thr = async {
while (1)
{ $a++;
print "\$a is $a\n";
sleep 0.1;
}
};
$Data = 0;
Once the thread is started, put a break on the print statement. The
break is ignored until you 'q'uit the debugger, at which time the
debugger regains control (but your main flow is now history...) Yes,
good programming (a 'yield' or having the 'while' test some mainline
variable) would have helped. But the question remains, how does one
regain control of a rogue thread?
--
David B. White
IBM Microelectronics, Circuit Verification & Design Tools
Internal: dbwhite@btv Internet: dbwhite@vnet.ibm.com
Phone: 802-769-5671 (TieLine: 446) Fax: 802-769-5722
------------------------------
Date: Thu, 06 Aug 1998 18:04:59 GMT
From: ioioio@my-dejanews.com
Subject: variable indirection
Message-Id: <6qcr8b$5o8$1@nnrp1.dejanews.com>
I have a newbie question about variable indirection (if that is the right way
of saying it). Anyway, say
$a='good';
$b='a';
Is it possible to make $b to evaluate to 'good' through its own value?
I was thinking ${$b} would do the trick. Obviously, it doesn't.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 6 Aug 1998 18:26:31 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: variable indirection
Message-Id: <6qcsgn$kgg$2@marina.cinenet.net>
ioioio@my-dejanews.com wrote:
: I have a newbie question about variable indirection (if that is the right way
: of saying it). Anyway, say
:
: $a='good';
: $b='a';
:
: Is it possible to make $b to evaluate to 'good' through its own value?
: I was thinking ${$b} would do the trick. Obviously, it doesn't.
Obviously? It works for me:
> perl -we '$a="good"; $b="a"; print ${$b};'
good
And actually $$b would work just as well. This is called a symbolic or
soft reference. If it's not working on your copy of Perl, either you have
a very out-of-date Perl or you're doing something else wrong.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 6 Aug 1998 18:17:30 GMT
From: Niklas Matthies <matthies@fsinfo.cs.uni-sb.de>
Subject: Re: variable indirection
Message-Id: <6qcrvq$m32$1@hades.rz.uni-sb.de>
In comp.lang.perl.misc, ioioio@my-dejanews.com writes:
> I have a newbie question about variable indirection (if that is the right way
> of saying it). Anyway, say
>
> $a='good';
> $b='a';
>
> Is it possible to make $b to evaluate to 'good' through its own value?
> I was thinking ${$b} would do the trick. Obviously, it doesn't.
Yes, it does:
$a='good';
$b='a';
print ${$b};
ouputs 'good' with my perl.
print $$b;
works also.
-- Niklas
------------------------------
Date: 6 Aug 1998 18:54:29 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: variable indirection
Message-Id: <6qcu55$15f$14@info.uah.edu>
In article <6qcsgn$kgg$2@marina.cinenet.net>,
cberry@cinenet.net (Craig Berry) writes:
: And actually $$b would work just as well. This is called a symbolic or
: soft reference. If it's not working on your copy of Perl, either you have
: a very out-of-date Perl or you're doing something else wrong.
...or the compiler saw C<use strict>.
Greg
--
The first truth is that liberty is not safe if the people tolerate the growth
of private power to the point where it becomes stronger than that of their
democratic state itself. That, in its essence, is Fascism.
-- Franklin D. Roosevelt
------------------------------
Date: Thu, 06 Aug 1998 18:21:34 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qcs7d$7d3$1@nnrp1.dejanews.com>
In regard to Abigail's sig:
@arr = split /(.*)/s , "Just another Perl Hacker\n";
for (@arr) { print "elem:$_"; }
In article <6qce90$1pg$2@client3.news.psi.net>,
abigail@fnx.com wrote:
[snip]
> Well, yes, .* means zero or more non-newline characters. But, IMO,
> .* isn't (?=(.*)).
>
> Abigail
[snip]
Because with /(.*)/s, $& = .*, while with /(?=(.*))/s $& is always empty, so
the regex engine just keeps moving along because, in it's opinion, it hasn't
matched anything yet, because there is nothing in $& ? Is this right?
So it is the (.*) filling the array, but the regex engine doesn't stop (as it
normally would) because the (?= .. ) construct is making sure $& stays empty.
So where ever the regex engine is at, the split splits and puts the character
it is at in @arr and then whatever is left to the end of the "Just Another
Perl Hacker\n" expression in @arr as well.
So the first time through, it splits the expression to "J" and "ust Another
Perl Hacker\n", and loads each of those into @arr. But the regex engine
doesn't stop there because of the (?= .. ) construct forcing $& to remain
empty, so it now splits where it currently is at in the expression into 2
more elements: "u" and "st Another Perl Hacker\n", and continues on in a
similar fashion to the end of the line.
You are a cruel and unusual woman, Abigail :)
Patrick Timmins
U. Nebraska Medical Center
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 06 Aug 1998 19:49:48 +0100
From: Ian Boys <boys@aspentech.com>
Subject: Re: X-file (?=...), case postponed.
Message-Id: <35C9FACC.15FB@aspentech.com>
F.Quednau wrote:
>
> Abigail wrote:
> >
> > F.Quednau (quednauf@nortel.co.uk) wrote lots of stuff...
>
> > You lost it in the first step. /(?=(.*))/ does *NOT* mean zero or
> > more characters.
>
> [snip]
>
> I'll put this to the X-files. Unexplained mysteries. Don't worry, one
> day I'll have enough knowledge to read the documentation in a way you
> do, because I can't see that! And .* doesn't match zero or more
> characters? Aaanyway, I might have to get 'mastering regular
> expressions' after all.
>
Frank,
It put me through mental gymnastics figuring it out too, but it is a
dead fun .sig! Let me see if I can put you out of your misery:
For me, the key was to realise that /(?=(.*))/ consists of two
subexpressions: "" (null pattern) followed by "(?=(.*))" (what must
follow the null pattern for the match to succeed). So we are to split on
a null pattern that must however be followed by zero or more characters.
Because the (.*) is parenthesised, what it matched each time round is
going to get returned by split after each bit that is split off. Of
course, (.*) is going to match and capture everything after the
matching split pattern up to the end of the line...
Can you get it from there?
Ian
------------------------------
Date: Thu, 06 Aug 1998 18:18:22 GMT
From: heiby_u@falkor.chi.il.us (Ron Heiby)
Subject: Re: Zombies from Forking are Bad, says Sun
Message-Id: <35c9ede3.10630804@news.compuserve.com>
Hash: SHA1
On Tue, 28 Jul 1998 16:36:29 -0500, Steve Livingston
<slivings@digitalriver.com> wrote:
>Sun kernel engineers tell me having this many zombies is bad,
Yes. They are correct.
>and may be
>causing a unix/memory-being-stepped-on problem I'm having.
Seems unlikely.
>They said that this many zombied/defunct is very unusual and
Only in that most programs that create child processes arrange to clean
them up, using methods like others in this thread have already suggested.
In applications which create processes whose developers did not have a
good understanding of the information in the documentation, this is
(unfortunately) not unusual at all.
>zombied/defunct processes behave strangely.
A zombie process does not "behave" at all. It is just a place-holder in
the UNIX process table. It contains the process' exit status, which has to
be kept *somewhere* so that when you "wait" for the process you can find
out what that exit status was.
>They said that a lot of
>times they will not clear until the system reboots.
Wrong.
>They said just because you kill the zombied/defunct processes
>does not mean the kernel frees them and that they have gone away.
You cannot "kill the zombied/defunct process". It is already "un-dead".
That's why it is called a zombie. Trying to "kill" it again will have no
effect, just like in the movies. The only thing that will make them go
away is to remove their reason for being. (Clue: They want to report their
exit status.)
>Can anyone shed any light on this?
Re: the "Sun kernel engineers", one or more of:
1) They really aren't "kernel engineers", but low-paid, first-line,
answer-the-phone, tech-support flunkies.
2) They tried to "simplify" their explanations to help you understand
concepts that they didn't think you were ready for.
3) You completely misunderstood what they were telling you.
4) Sun isn't getting the same calibre of people they used to.
If you want a better understanding of how Unix operates, I suggest the
book by Bach. (If I were not 800 miles from my book shelf, I'd give you a
better reference. Sorry.) The new book just out on the 4.4bsd kernel is
probably also a good read, but I just bought it and haven't had a chance
to verify that assumption.
Version: PGP for Personal Privacy 5.5.3
Comment: My Keys: 0x571B55BD and 0x628ECED, available from keyservers
iQA/AwUBNcnxYGasl5Jijs7SEQJ5ZwCgpjD4z6LL/n5IEesl0kKnCJl6acwAoJkY
OyvvbhSZwCD59tAcOTiTcPnc
=yHOu
-----END PGP SIGNATURE-----
--
Ron.
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3379
**************************************