[6622] in Perl-Users-Digest
Perl-Users Digest, Issue: 247 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 7 12:27:19 1997
Date: Mon, 7 Apr 97 09:00:26 -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 Mon, 7 Apr 1997 Volume: 8 Number: 247
Today's topics:
Re: ANWER (was: [Win32] "Error: parse exception" loadin <jburley@uci.edu>
Re: Can't get 2 way communication using sockets <joeo@hpfcjoe.fc.hp.com>
Re: CGI Server error (Erik Braun)
dbm oddity (David A. Enete)
Dumb question 'bout finding files <patrick@arch.ethz.ch>
Re: Dumb question 'bout finding files (Andrew M. Langmead)
Re: Dumb question 'bout finding files (Nathan V. Patwardhan)
gethostbyname won't use DNS (Eric M. Kidd)
Re: Help! How do I pass filehandles to subroutines? <ajs@ajs.com>
HELP: Redirecting links ????? <konink@telebyte.nl>
Re: How Do I... (Jason Bodnar)
Re: How Do You Get User Input? (A. Deckers)
how do you use assert.p[lh] (Curtis Hrischuk)
Re: How to get key from value in a %VAR <mcampbel@tvmaster.turner.com>
IPC/semaphore problem in perl5 <jim.oconnor@amp.com>
Re: Is the Penguin dead? (Jason Bodnar)
Re: My perl script just died <mdperry@cougar.netutah.net>
Re: No GUI environment for Perl? <neeri@iis.ee.ethz.ch>
Re: OO-Perl corrupts parameters! <gtk@walsh2.med.harvard.edu>
Re: Ousterhout and Tcl lost the plot with latest paper (Donal K. Fellows)
Re: Perl-5.003 test error <twalker@voyager.cmp.com>
Please help me with a for loop to grab hostnames - than <jsykes@tartar.ulib.albany.edu>
Problems with OO Perl5 features <lpa@sysdeco.no>
QUESTION: "assert.ph:15: unterminated character consta (Curtis Hrischuk)
select says data waiting but sysread blocks? <matija.grabnar@k2.net>
sort array? (Geoffrey Hebert)
Re: Strange warning about split, without a split being <eike.grote@theo.phy.uni-bayreuth.de>
Re: Strange warning about split, without a split being <ajs@ajs.com>
Re: substituting with /g and simulating "lookbehind" (David Combs)
Re: symbolic reference doesn't work with arrays? (Mik Firestone)
Re: TCL & interface definitions (was Re: Ousterhout and (Jack Jansen)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 07 Apr 1997 08:31:56 -0700
From: Josh Burley <jburley@uci.edu>
To: Dave Roth <rothd@roth.net>
Subject: Re: ANWER (was: [Win32] "Error: parse exception" loading module (AdminMisc)?)
Message-Id: <3349136C.6B89@uci.edu>
Dave... you're the MAN!! :>
Needless to say, it worked. Thanks alot!
-Josh
Dave Roth wrote:
> A new version is available for build 304 called Adminmisc_build_304.zip on
------------------------------
Date: 06 Apr 1997 21:27:21 -0600
From: Joe Orth <joeo@hpfcjoe.fc.hp.com>
Subject: Re: Can't get 2 way communication using sockets
Message-Id: <yb6n2rb4ina.fsf@hpfcjoe.fc.hp.com>
Tim Archer <tarcher@csu.edu.au> writes:
> I am trying to a get a conversation going between a client and
> server using sockets. I can get the server to write to the client or
> the client to the server but when I try and do something like this:
>
> [Server]
> print CLIENT "How are you";
> $in = <CLIENT>;
>
> [Client]
> $in = <SERVER>;
> print SERVER "I'm Good thankyou!";
>
> Things just seem to hang. Am I creating a deadlock here?
> I'm new to sockets programming, both the client and server are taken
> from code in ch6 of the Camel Book 2nd Ed. I'm running perl 5.002 on
> Solaris 2.5. It seems logical to me that the above should work but
> apparently not. I'm using Unix domain sockets and a non-threaded
> server.
I am actually having the same problem on HP-UX 10.20 with perl5.003.
Here are the code snipets:
I started with the socket_tcp_threaded example from chapter 6 of the
new camel book and made the following change:
spawn sub {
print "getting line\n";
select(STDIN); $|=1; select(STDOUT);
my($line) = <STDIN>;
print "got: $line\n";
print "Hello there, $name, it's now ", scalar localtime, "\n";
exec '/usr/games/fortune'
or confess "can't exec fortune: $!";
};
In the corresponding client I do this: (again almost a direct copy
from chap 6).
my($oldfh) = select(SOCK); $|=1; select($oldfh);
print SOCK "hello\n";
while ($line = <SOCK>) {
print($line);
}
If I stick to the one-way commmunication (like the original programs),
it works fine. When I try to get the two way communication going,
something breaks and it just hangs.
Any help would be appreciated.
-- Joe Orth
------------------------------
Date: 7 Apr 1997 11:26:06 GMT
From: erik@paxp01.mipool.uni-jena.de (Erik Braun)
Subject: Re: CGI Server error
Message-Id: <slrn45khmed.euu.erik@paxp01.mipool.uni-jena.de>
On Fri, 04 Apr 1997 18:20:19 -0800, carlmm <carlmm@well.com> wrote:
>Does anyone know what this error might be from:
>
>[04/Apr/1997:18:14:42] failure: for host 206.80.16.53 trying to POST
>/cgi-bin/addee.pl, cgi-parse-output reports: the CGI program
>/usr/local/wwwdocs/support.well.net/cgi-bin/addee.pl did not produce a
>valid header (name without value: got line "no write permission to ndbm
>file at emplib.pl line 71.")
Hmm, where's the perl problem?
This message means, that your CGI program (/usr/local/wwwdocs/
support.well.net/cgi-bin/addee.pl) did not produce a valid header
for the http server.
The server got the line "no write permission to ndbm file at emplib.pl
line 71."
Where's the problem with these error messages? They say everithing
you want to know.
just wondering,
erik
--
erik@minet.uni-jena.de
------------------------------
Date: 7 Apr 1997 14:19:07 GMT
From: denete@coe.uga.edu (David A. Enete)
Subject: dbm oddity
Message-Id: <5iavor$6sf$1@cronkite.cc.uga.edu>
Hi all. I've just started using dbm files, and have run into a big snag.
I'm using dbm files to store the listing of a directory for use in another
script, and can't seem to get the hash that is returned make sense.
This is the fragment used alone (its own script) to create the dbm file.
#################
# BEGIN FRAGMENT
$unitdir = '/full/path/to/directory/to/be/indexed/';
$db_out_file = '/name/of/file/for/dbm';
opendir DIRUNITS, "$unitdir" || die;
@allunits = readdir DIRUNITS;
closedir DIRUNITS;
dbmopen(%UNITS, "$db_out_file", 0666)
|| die "\nCan't open the file\n$db_out_file\n";
for(@allunits) {
next if(/^\D/); # I just want files that begin with digits
push @{ $UNITS{(unpack("A2", $_))} }, "$_";
}
dbmclose %UNITS;
# END FRAGMENT
#################
That apears to successfully create the dbm files which contain hashes
indexed by the first two characters of the file names. If I re-open the
dbm file and print out the contents from WITHIN the same script, things
appear to work fine, BUT if I re-open from another script, things get odd.
The following script produces the hash keys, but no data after that.
#################
# BEGIN FRAGMENT
$db_in_file = '/path/to/dbm/file';
dbmopen(%REVIEW, "$db_in_file", 0666)
|| die "\nCan't open the file\n$db_in_file\n";
for(keys %REVIEW){
print "$_: ";
print @{ $REVIEW{$_} };
print "\n\n";
}
dbmclose %REVIEW;
# END FRAGMENT
#################
Am I missing something here?
Thanks for any suggestions,
-David
------------------------------
Date: Mon, 07 Apr 1997 13:56:37 +0100
From: Sibenaler <patrick@arch.ethz.ch>
Subject: Dumb question 'bout finding files
Message-Id: <3348EF05.41C6@arch.ethz.ch>
How do you guys read in a list of files of which you know the pattern,
from a SINGLE directory and from WITHIN a script? I've been using
open(FILE, "find . -name '*$filepattern*' -print |");
@filenames=<FILE>;
for quite a while now. But unfortunately, 'find' searches recursively,
which one does not always want.- And no, I don't want to read the
pattern from the commandline - that is a different thing. I tried
globbing but found it very unrelieable. Also, readdir() and then
filtering the result looks too waisty. Anything that uses 'ls' is
unreliable too, since different UNCES act differently.
Mybe this looks like rookie stuff, but still I wonder what Ideas
may come up.
greets,
patrick
---------------------------------------------------------------------------
The trick is to communicate bi-directional in real time and high
resolution
---------------------------------------------------------------------------
------------------------------
Date: Mon, 7 Apr 1997 13:28:25 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Dumb question 'bout finding files
Message-Id: <E89s3D.MJ1@world.std.com>
Sibenaler <patrick@arch.ethz.ch> writes:
>How do you guys read in a list of files of which you know the pattern,
>from a SINGLE directory and from WITHIN a script?
For quick hacks, I might use the fileglob operator,as in <*.c>. For
real programs, I'd use the opendir/readdir/closedir functions. Maybe
with a pattern match operator or grep to filter out only the files I'm
interested in.
--
Andrew Langmead
------------------------------
Date: 7 Apr 1997 14:00:53 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Dumb question 'bout finding files
Message-Id: <5iauml$4u6@fridge-nf0.shore.net>
Sibenaler (patrick@arch.ethz.ch) wrote:
: How do you guys read in a list of files of which you know the pattern,
: from a SINGLE directory and from WITHIN a script? I've been using
: open(FILE, "find . -name '*$filepattern*' -print |");
: @filenames=<FILE>;
For better or worse I like to do:
$dir = '/foo';
opendir(DIR, $dir) || die("dir open error: $!");
@matching_files = grep(/\.foo$/, readdir(DIR)); # foo is the file extension,
# where foo$ DOES NOT MATCH
# food or fool
closedir(DIR);
foreach (@matching_files) {
print $_,"\n";
}
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Mon, 07 Apr 1997 09:57:16 -0400
From: eric.kidd@pobox.com (Eric M. Kidd)
Subject: gethostbyname won't use DNS
Message-Id: <eric.kidd-ya02408000R0704970957160001@newshost.dartmouth.edu>
I'm running Perl 5.003 under PowerPC Linux 2.0.25.
The Perl function gethostbyname will return hosts in /etc/passwd, but will
not use the DNS to look up hostnames. C programs such as nslookup, telnet
and ncftp work just fine, however, so I assume my nameserver is working
correctly.
Is this a configuration problem of some sort? I'd appreciate any leads.
The machine in question doesn't have enough disk space to rebuild perl from
the source (it's a piddly little web server). I'll have to set up a
cross-compiler under a different UNIX if the problem is with the perl
binary.
Cheers,
Eric
------------------------------
Date: Mon, 07 Apr 1997 09:43:15 -0400
From: Aaron Sherman <ajs@ajs.com>
Subject: Re: Help! How do I pass filehandles to subroutines?
Message-Id: <3348F9F3.4326@ajs.com>
Bart Lateur wrote:
>
> hh@scam.XCF.Berkeley.EDU (Eric Hollander) wrote:
>
> >I'm trying to do something like this:
>
> >foo(<STDIN>);
WRONG! The <FILEHANDLE> construct should be read as
FILEHANDLE->read_record !
> >sub foo {
> > my($FD, $byte);
> > $FD = $_[0];
$FD is a record (line, by default) from STDIN.
> Try passing the handle as text instead. I haven't tried it on STDIN, but
> I *have* used it with handles of ordinary files, before:
>
> foo ('STDIN');
Also a bad idea. Take a look at File::Copy for examples, but this is
basically what I would suggest (if you're not using the IO module):
foo(*STDIN); # or foo(\*STDIN);
--
Aaron Sherman "We are, all of us, living in the shadow of
Safety Net Solutions Manhatten." -The Watchmen
Email: ajs@ajs.com
WWW: http://ajs.com/~ajs/
------------------------------
Date: Mon, 07 Apr 1997 16:33:59 +0200
From: "T. de Konink" <konink@telebyte.nl>
Subject: HELP: Redirecting links ?????
Message-Id: <334905D7.13C2@telebyte.nl>
Hello,
I'm still a little bit of beginner in programming Perl. If got the
following question:
How can I send an visitor to an page (an page wich is not part of the
current site) using an perl-script ?
What I want to try is like some Banner-systems works: a visitor clicks
on a link to a script, but automaticly gets to an page on another site.
Banner-systems use this methodes, as far as I can see, to count
click-throughs and sending an visitor somewhere else at the same time.
Thanks in advance,
Thomas de Konink
E-mail: mailto:konink@telebyte.nl
PS: My English is not good, but I hope that it's understandable.
------------------------------
Date: Mon, 07 Apr 1997 15:22:24 GMT
From: jason@cimedia.com (Jason Bodnar)
Subject: Re: How Do I...
Message-Id: <334910de.596440355@news.onr.com>
"Jerry Bradenbaugh" <bradenb@ibm.net> wrote:
>How do I access the user name and password fields from the dialog box
>prompted by restricting access to files or directories on a UNIX platform?
>
>I want to use the information as variables in another CGI Script.
>
1) This isn't a perl question. You're better off asking it in
comp.infosystems.www.authoring.cgi
2) Since you're here, the CGI must also be protected. Then you can get
the username from the REMOTE_USER environment variable. The password
is not available.
--
Jason C. Bodnar
jason@cimedia.com
Internet Programmer
Cox Interactive Media
------------------------------
Date: 7 Apr 1997 14:47:34 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: How Do You Get User Input?
Message-Id: <slrn5ki287.498.Alain.Deckers@nessie.mcc.ac.uk>
In <01bc423a$64942ca0$c8c32581@default>,
Jerome Bradenbaugh <bradenb@ibm.net> wrote:
>How do you get user input by calling a dialog box after clicking a link?
>How can you use it once you have it?
Use CGI.pm. (Sorry, if you ask a bad question, you'll get a bad answer.)
[followup set]
>Jerry Bradenbaugh
>HotSyte Webmaster
Oooooh, dude, how kewl! :-)
Cheers,
--
Alain.Deckers@man.ac.uk <URL:http://www.man.ac.uk/%7Embzalgd/>
Perl information: <URL:http://www.perl.com/perl/>
Perl FAQ: <URL:http://www.perl.com/perl/faq/>
Perl software: <URL:http://www.perl.com/CPAN/>
NB: comp.lang.perl.misc is NOT a CGI group.
------------------------------
Date: 07 Apr 1997 14:45:45 GMT
From: ceh@sundance.sce.carleton.ca (Curtis Hrischuk)
Subject: how do you use assert.p[lh]
Message-Id: <CEH.97Apr7104549@sundance.sce.carleton.ca>
Hi. I just tried to use assert.p[lh] that comes with the distribution
(version 5.001) and it does not seem to behave like the assert I have
come to know and love. I am using it in the following fashion. What
is wrong with the way I am using it?
#include <assert.ph>
requrie 'assert.pl'
...
main::assert('0');
main::assert('1');
main::assert(0);
main::assert(1);
my($tester) = 1;
main::assert('$tester');
main::assert("$tester");
main::assert($tester);
$tester = 0;
main::assert($tester);
main::assert('$tester');
main::assert("$tester");
None of the tests above raised an assertion.
Curtis
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Curtis Hrischuk (PhD Cand) "in reality that comes from above _/
_/ ceh@sce.carleton.ca God is calling _/
_/ Carleton University there's no bigger love _/
_/ Ottawa, On., Canada, K1S-5B6 It's his reality that welcomes us back_/
_/ Ph (613) 520-2600 x1762 Trust and obey _/
_/ FAX (613) 520-5727 there is no other way..." the newsboys_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
------------------------------
Date: 07 Apr 1997 08:15:17 -0400
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: How to get key from value in a %VAR
Message-Id: <r5d8s7ghbe.fsf@tvmaster.turner.com>
jgd@cix.compulink.co.uk ("John Dallman") writes:
> The easy way:
>
> If you need to do reverse lookup a lot, make the hash array twice, one
> keyed on the "key" values and one keyed on the "data" values.
This is assuming the values in the hash are unique.
------------------------------
Date: 7 Apr 1997 15:37:31 GMT
From: "Technology Benchmark Facility" <jim.oconnor@amp.com>
Subject: IPC/semaphore problem in perl5
Message-Id: <01bc4369$9d8fb800$02f4f1a3@tbfpc12.amp.com>
Can anyone point me to some GOOD documentation on using semaphores in perl?
I have been unable to get semop to properly wait on a semaphore.
The code below is supposed to:
Parent:
create a semaphore
fork off some children(who wait for the semaphore value to go to 1)
wait 5 seconds and toggle the semaphore.
Children:
wait for the semaphore value to go to 1
when semaphore value goes to 1 print message and exit.
#!/opt/perl/bin/perl -wT
$mode = mode_string_2_num('rw-rw-rw');
defined($semid = semget(IPC_PRIVATE, 1, $mode)) || die "semget: ",$!+0,"
$!\n";
for($i=0; $i < 5; $i++){
if($pid = fork) {
#in the parent
print "Forked $pid\n";
} elsif (defined $pid) {
#in the child
$semop = pack "s*", 0, -1,0;
die "Semaphore trouble: $!\n" unless semop $semid, $semop;
print "$$ Child is responding to semaphore\n";
exit;
}
}
sleep 30;
$semop = pack "s*",0,1,0;
die "Semaphore trouble: $!\n" unless semop $semid, $semop;
exit;
sub mode_string_2_num {
my($mode) = @_;
# Just in case its a number already
$mode =~ /^\d+$/ && return $mode+0;
$mode =~ /^([r\-])([w\-])\-([r\-])([w\-])\-([r\-])([w\-])\-$/ ||
return undef;
my $n_mode = 0;
if ($1 eq 'r') {$n_mode |= 00400}
if ($2 eq 'w') {$n_mode |= 00200}
if ($3 eq 'r') {$n_mode |= 00040}
if ($4 eq 'w') {$n_mode |= 00020}
if ($5 eq 'r') {$n_mode |= 00004}
if ($6 eq 'w') {$n_mode |= 00002}
$n_mode;
}
------------------------------
Date: Mon, 07 Apr 1997 15:26:21 GMT
From: jason@cimedia.com (Jason Bodnar)
Subject: Re: Is the Penguin dead?
Message-Id: <334911e6.596704999@news.onr.com>
jimr@aubrey.stanford.edu (James A. Robinson) wrote:
>
>I've been reading some stuff about the Penguin perl modules, but I
>can't seem to locate any up-to-date information resources for it. The
>web pages at http://www.eden.com/~fsg/penguin and at what appears to
>be the original development site coriolan.amicus.com is also empty. :(
>
>Anyone know if the Penguin is dead?
Felix (Penguin author) used to be at Amicus, but I've heard he's since
moved on. Not sure where though.
--
Jason C. Bodnar
jason@cimedia.com
Internet Programmer
Cox Interactive Media
------------------------------
Date: Mon, 07 Apr 1997 08:22:35 -0700
From: Mark Perry <mdperry@cougar.netutah.net>
Subject: Re: My perl script just died
Message-Id: <3349113B.3272@cougar.netutah.net>
Just a little clarification.
http://icstech.com/~copinion/addletter.html is the form that calls the
script. The script's text is found at:
http://icstech.com/~copinion/letter.pl.txt
The line that the sysadmin changed is the $cgiurl
------------------------------
Date: 07 Apr 1997 14:55:40 +0200
From: Matthias Neeracher <neeri@iis.ee.ethz.ch>
Subject: Re: No GUI environment for Perl?
Message-Id: <86vi5z2drn.fsf@iis.ee.ethz.ch>
<blueox@mail.cyberhighway.com> writes:
> Is there any gui environment for programming available?
Yes, but I suppose I can't convince you to switch to MacOS :-)
Matthias
-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri
"Larry Wall got us 15kg of cyclonite. We're waiting for the final go-ahead
then we'll blow them all to hell."
-- (Presumably random) .sig generated by the Berkeley anonymous remailer.
------------------------------
Date: 07 Apr 1997 11:14:44 -0400
From: Gregory Tucker-Kellogg <gtk@walsh2.med.harvard.edu>
Subject: Re: OO-Perl corrupts parameters!
Message-Id: <w2vi5y3lwb.fsf@walsh2.med.harvard.edu>
Carl <ceklof@vt.edu> writes:
> I am adding/converting some of my perl code to be immplement the OOP
> extentions. Has anyone done this?
Yes.
>
> All of the routines that I've made into object methods no longer receive
> their parameters correctly! For single '$' parameters, everything has
> been shifted up one in the array of parameters
>
> eg.
> package foo;
> sub test{
> $firstVar = $_[0];
> print $firstVar;
> }
> is now:
> sub test{
> $firstVar = $_[1];
> print $firstVar;
> }
If you create a foo object by blessing a reference in a constructor
(let's call it new), i.e.,
$foo_instance = new foo;
Then any "object oriented" calls to methods like what you have above
will put the reference at the head of @_, that is
$foo->test('test');
will have internally the arguments
$_[0] = a reference to the object.
$_[1] = 'test'
This is What You Want, if you have any intention of putting the
object-orientation to work for you. Read the "perltoot" and "perlobj"
documents.
> AND THEN, MY HASHES ARE REVERSED, KEY->VALUE, VALUE->KEY!!! Needless to
> say, this is bad!
This is also unclear, since you don't give an example.
--
Gregory Tucker-Kellogg
Department of Biological Chemistry and Molecular Pharmacology
Harvard Medical School, Boston MA 02115
"Mojo Dobro" Finger for PGP info
------------------------------
Date: 7 Apr 1997 14:55:46 GMT
From: fellowsd@cs.man.ac.uk (Donal K. Fellows)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <5ib1ti$q15@yama.mcc.ac.uk>
In article <E88Ir4.EK4@undergrad.math.uwaterloo.ca>,
Paul Prescod <papresco@csclub.uwaterloo.ca> wrote:
[ JO's simple button example elided ]
> Easier to use for people who are not knowledgable about the language? Yes.
> Easier to use for people who are? No. The latter is certainly no harder
> for a MCL programmer than the former is for a TCL programmer. It will also
> be easier to maintain, for all of the usual reasons.
OK, let's raise the stakes a little. :^)
toplevel .t
button .t.b -text Hi! -font {Times 16} -command {puts "Pressed at (%x,%y)"}
pack .t.b -fill both -expand 1
The button now appears in a separate window to the main application
window, and reports where it was pressed. When this window is
resized, the button will occupy any extra space allocated. How much
extra Lisp would be needed to achieve this?
Unless you can do this in very few lines, the point about Tcl being
better for some things would seem to be made amply to me.
But then, I wouldn't write an AI system or theorem prover in Tcl
(though I might embed it within Tcl so I could integrate it with other
preexisting code... :^)
Donal.
--
Donal K. Fellows http://r8h.cs.man.ac.uk:8000/ (SAY NO TO COMMERCIAL SPAMS!)
(work) fellowsd@cs.man.ac.uk Dept. Comp. Sci, Univ. Manchester, U.K.
| donal@ugglan.demon.co.uk 6,Randall Place, Heaton, Bradford, U.K. (home)
+-> ++44-161-275-6137 Send correspondence to my office ++44-1274-401017 <-+
------------------------------
Date: Mon, 07 Apr 1997 10:41:33 -0400
From: Terry Walker <twalker@voyager.cmp.com>
Subject: Re: Perl-5.003 test error
Message-Id: <3349079D.3BE0@voyager.cmp.com>
Nathan V. Patwardhan wrote:
>
>
> Did you choose dynamic loading (y)? If so, did you choose the correct
> dynamic loading type? (I *think* it should be dldopen, but it's been
> awhile since I've built our Solaris 2.5 version, so I'm not sure - this
> *is* listed in the Perl install doc, however.)
>
> --
> Nathan V. Patwardhan
> nvp@shore.net
Thanks for the response Nathan.
I did use dynamic loading for gdbm, and in my config.sh d_dlopen is
defined so it appears that I am using d_dlopen.
--
-------------------================*================--------------------
Terry Walker email: twalker@cmp.com
Systems Administrator www: http://techweb.cmp.com
CMP Media Incorporated voice: (516) 562-5754
600 Community Drive fax: (516) 562-7488
Manhasset, N.Y. 11030
------------------------------
Date: Thu, 3 Apr 1997 13:56:58 -0500
From: Jon Sykes <jsykes@tartar.ulib.albany.edu>
Subject: Please help me with a for loop to grab hostnames - thanks
Message-Id: <Pine.LNX.3.93.970403134535.3603M-100000@tartar.ulib.albany.edu>
greetings!
i am a beginner perl person and am currently using the excellent perl for
dummies and teach yourself perl in 21 days - i would recommend either to
any perl newbie; they are much easier to understand than even the llama
books.
anyway, there is an excellent perl script on page 501 of the 21 days book,
program 14.5, which I want to use, but in a slightly differnet form. I do
not intend to break any copywrite laws, but here is the code:
# p14_5.pl
print ("Enter an Internet address:\n");
$machine = <STDIN>;
$machine =~ s/^\s+|\s+$//g;
@bytes = split (/\./, $machine);
$packaddr = pack ("C4", @bytes);
if (!(($name, $altnames, $addrtype, $len, @addrlist) =
gethostbyaddr ($packaddr, 2))) {
die ("Address $machine not found.\n");
}
print ("Principal name: $name\n");
if ($altnames ne "") {
print ("Alternative names:\n");
@altlist = split (/\s+/, $altnames);
for ($i = 0; $i < @altlist; $i++) {
print ("\t$altlist[$i]\n");
}
}
The script will find a machine's hostname after prompting you for the ip
address. This is great, but I would like to modify the code to loop over
a list of ip addresses and write the results to a file.
I have experimented a little, with
@ ip_address =("111.11.1.1","111.11.1.2");
foreach $ip_address (aip_address) { ...and the loop above
and also with trying to read in strings from a text file containing ip
address 111.11.1.1 through 111.11.1.200
However, there must be a simple way to tell perl the beginning and ending
ip address only and get it to check them and every one in between?
I am sure that in 21 days I will know the answer to this question, but I
currently have the task of doing a system inventory of 200 machines and I
need to grab all of their hostnames and ip addresses.
If any of you out there can help me, I would be very grateful. Perhaps
you can be kind enough to email me any advice, tips, whatever.
Many thanks in advance,
Jon Sykes **** jsykes@tartar.ulib.albany.edu **** sykesj@nimo.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-==-=-=
o \ o / _o __| \ / |__ o _ \ o / o
/|\ | /\ __\o \o | o/ o/__ /\ | /|\
/ \ / \ | \ /) | ( \ /o\ / ) | (\ / | / \ / \
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Homepage at http://www.albany.edu/~js3150
------------------------------
Date: Mon, 07 Apr 1997 16:41:05 +0200
From: Luca Passani <lpa@sysdeco.no>
Subject: Problems with OO Perl5 features
Message-Id: <33490781.7114@sysdeco.no>
Hallo,
first off I would like to ask if anybody has a hint about this problem
(I've used the debugger before, i.e. the packages are all there)
______________________________________________
### perl -d convertdia.pl diag0
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.
Undefined subroutine &Carp::longmess called at
/usr/local/lib/perl5/perl5db.pl l
ine 1361.
###
______________________________________________
Even though I'm not sure about the connection, the above might be faces
of the same problem with what follows:
### perl -c Component.pm
Component.pm syntax OK
### perl -c Block.pm
Global symbol "ISA" requires explicit package name at Block.pm line 5.
Block.pm had compilation errors.
### perl -v
This is perl, version 5.002
Copyright 1987-1996, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.
###
with Component.pm
______________________________________________
package Component;
use strict;
=head1 NAME
Component - bla bla
=head1 SYNOPSIS
use Component;
$comp = new;
=head1 DESCRIPTION
bla bla
=head1 AUTHOR
Luca Passani <lpa@sysdeco.no>
=cut
# Component constructor
sub new {
my $name_or_ob = shift; #name of the class or reference to object
my $class = ref($name_or_ob) || $name_or_ob;
my $self = {};
$self->{NAME} = undef;
bless($self,$class);
}
1; #keeps use and require happy
___________________________________________________
and Block.pm
___________________________________________________
package Block;
use strict;
use Component;
@ISA = qw("Component");
=head1 NAME
Block - bla
=head1 SYNOPSIS
use Block;
$blck = new;
=head1 DESCRIPTION
Blocks group together other components (Blocks, Cofs and Vafs)
=head1 AUTHOR
Luca Passani <lpa@sysdeco.no>
# Component constructor
sub new {
my $name_or_ob = shift; #name of the class or reference to object
my $class = ref($name_or_ob) || $name_or_ob;
my $self = {};
$self->{NAME} = undef;
$self->{COMPONENTS} = [];
bless($self,$class);
}
1; #keeps use and require happy
_______________________________________________________
Thanx for help.
Luca
--
======================================================================
Luca Passani. | Sysdeco Innovation AS, http://www.sysdeco.no
Email: lpa@sysdeco.no | Trondheimsveien 184, 0570 Oslo, Norway
Tel: (+47) 22 09 66 06 | Fax: (+47) 22 09 65 03
======================================================================
------------------------------
Date: 07 Apr 1997 12:32:21 GMT
From: ceh@sundance.sce.carleton.ca (Curtis Hrischuk)
Subject: QUESTION: "assert.ph:15: unterminated character constant"
Message-Id: <CEH.97Apr7083222@sundance.sce.carleton.ca>
Hi. I am using the perl standard "assert.p[lh]". However, I am
getting the following warning and I was wondering what it means:
assert.ph:19: unterminated character constant
Thanks
Curtis
--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Curtis Hrischuk (PhD Cand) "in reality that comes from above _/
_/ ceh@sce.carleton.ca God is calling _/
_/ Carleton University there's no bigger love _/
_/ Ottawa, On., Canada, K1S-5B6 It's his reality that welcomes us back_/
_/ Ph (613) 520-2600 x1762 Trust and obey _/
_/ FAX (613) 520-5727 there is no other way..." the newsboys_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
------------------------------
Date: Mon, 07 Apr 1997 13:27:45 +0200
From: Matija Grabnar <matija.grabnar@k2.net>
Subject: select says data waiting but sysread blocks?
Message-Id: <3348DA31.6F1CBF7E@k2.net>
I have a program which manages a bunch of processes, each opened
by a open(FH,"command |") type of call. The processes run for some
time (from seconds to hours), output some text and then exit.
My program is trying to keep the number of processes running
constant to make the best possible use of resources, so it starts
a new process when an old one terminates.
So much for the background, now to the problem:
the gist of the program is
while (!defined($exitreason)) {
$nfound=select($rout=$rin,$wout=$win,$eout=$win,30000);
for (0..$nspawns-1) {
if (vec($rout,fileno($files[$_]),1)) {
$len=sysread($files[$_],$content[$_],65536,
length $content[$_]);
unless ($len) {
# process has terminated, handle the $content[$_]
# and start a new one
}
}
}
}
According to logging statements (not shown here), sysread occasionaly
blocks while reading, even though there CLEARLY should be data waiting
for it to read.
Is my buffer size (65536) too big? Does it mean it should block
until it has 65536 bytes or until the file is closed? If so,
what would be a good size that would avoid blocking on the
sysread and still allow for efficient operation?
I guess I could do a sysread(fd,$var,1,..) call, but I feel
it would be terribly wastefull.
I am running linux 2.0.28 and perl 5.003
--
"My name is Not Important. Not to friends.
But you can call me mr. Important" - Not J. Important
Matija.Grabnar@k2.net, webmaster@k2.net A Slovenian and an Atarian
K2.net, Resljeva 1, Ljubljana K2.net - our name is our domain
------------------------------
Date: Mon, 07 Apr 1997 16:04:56 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: sort array?
Message-Id: <5ib502$2va$1@news3.microserve.net>
I want to sort lines. So simple (ha), I thought I would
code is as below. The nature of my real data is like that
below.
help appreciated.
Yeh, this is my first sort. Read and re-read for a couple of hours
I haven't given up. But, I know this is an easy question for someone
that knows the answer. Thanks.
#!/opt/bin/perl -w
@line_is = (
["10", "line data"],
["1", "line data"],
["31", "line data"],
["3", "line data"],
["6", "line data"],
["2", "line data"],
["22", "line data"],
["202", "line data"],
["41", "line data"],
["4", "line data"],
["5", "line data"],
); # problem one how to print line
foreach $line(@line_is) {
print "$line\n"; # This of course prints ARRAY(0..etc
}
@sorted= sort {$line_is[$a][1] <=> $line_is[$b][1]} @line_is;
# sort gives OUT OF MEMORY
foreach $line(@sorted) {
print "$line\n";
}
exit;
------------------------------
Date: Mon, 07 Apr 1997 12:48:13 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Strange warning about split, without a split being used.
Message-Id: <3348D0ED.2781@theo.phy.uni-bayreuth.de>
Hi,
Abigail wrote:
>
> Earlier today, I did:
>
> #!/usr/local/bin/perl -wT
> $ENV {PATH} = qw (/usr/bin /bin);
>
> (Of course I wanted to do: $ENV {PATH} = join ":", qw (/usr/bin /bin);)
>
> The warning I got when running this was:
>
> Use of implicit split to @_ is deprecated at - line 1.
>
> That surprised me, as there is no split being used.
>
> Is this a bug, or does qw call split when being used in a scalar context?
The 'perlop' man page says:
qw/STRING/
Returns a list of the words extracted out of STRING, using
embedded whitespace as the
word delimiters. It is exactly equivalent to
split(' ', q/STRING/);
...
Bye, Eike
======================================================================
Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
e-mail -> eike.grote@theo.phy.uni-bayreuth.de
WWW -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html
http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================
------------------------------
Date: Mon, 07 Apr 1997 09:47:57 -0400
From: Aaron Sherman <ajs@ajs.com>
Subject: Re: Strange warning about split, without a split being used.
Message-Id: <3348FB0D.3966@ajs.com>
Abigail wrote:
>
> Earlier today, I did:
>
> #!/usr/local/bin/perl -wT
> $ENV {PATH} = qw (/usr/bin /bin);
>
> (Of course I wanted to do: $ENV {PATH} = join ":", qw (/usr/bin /bin);)
>
> The warning I got when running this was:
>
> Use of implicit split to @_ is deprecated at - line 1.
>
> That surprised me, as there is no split being used.
>
> Is this a bug, or does qw call split when being used in a scalar context?
qw is split, but I don't know why this message appeared. Could
it be that space between qw and ( ? Remember this is not a
function, but a delimeted operator.
-AJS
--
Aaron Sherman "We are, all of us, living in the shadow of
Safety Net Solutions Manhatten." -The Watchmen
Email: ajs@ajs.com
WWW: http://ajs.com/~ajs/
------------------------------
Date: Mon, 7 Apr 1997 14:56:16 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: substituting with /g and simulating "lookbehind"
Message-Id: <dkcombsE89w5t.5LL@netcom.com>
In article <E7ysFu.K0H@murdoch.acc.Virginia.EDU>,
Michael Krell <mk2h@clove.cs.Virginia.EDU> wrote:
>I'm trying to write a regex that will strip out all occurances of the "{"
>character from a string, unless the brace is immediately preceded by a
>backslash.
>
<snip>
Why not do it in two passes?
Just change all \{ to foobletch or something unique,
then change all remaining { to null, then
restore the foobletches.
I think LOTS of things can be made far more
simple via multiple passes.
Hope this helps.
------------------------------
Date: 7 Apr 1997 14:01:37 GMT
From: mfiresto@vnet.ibm.com (Mik Firestone)
Subject: Re: symbolic reference doesn't work with arrays?
Message-Id: <5iauo1$l4o$1@mail.lexington.ibm.com>
In article <33451EFC.41C6@lmtas.lmco.com>,
Brett Denner <Brett.W.Denner@lmtas.lmco.com> wrote:
>I am trying to use a symbolic reference to change array elements
>as follows:
>
> my @one = ('a');
> @two = ('b'); # <============ Note: no "my"
[snip]
>Why should declaring the @one array with "my" prevent the symbolic
>reference from working properly? Is this a bug, or am I using the
>"my" declaration or the symbolic reference improperly?
>From pg 255 in the Camel:
" Only package variables are visible to symbolic references. Lexical
variables ( declared with my ) aren't in the package symbol table, and
thus are invisible to this mechanism."
Htth,
Mik
-----
Mik Firestone mfiresto@mindspring.com
Evil Overlord Rule #35: If my supreme command center comes under attack,
I will immediately flee to safety in my prepared escape pod and direct
the defenses from there. I will not wait until the troops break into my
inner sanctum to attempt this.
------------------------------
Date: Mon, 7 Apr 1997 11:27:37 GMT
From: jack@cwi.nl (Jack Jansen)
Subject: Re: TCL & interface definitions (was Re: Ousterhout and Tcl lost the plot with latest paper)
Message-Id: <jack.860412457@news.cwi.nl>
"Mark Sterin" <msterin@bmc.com> writes:
>Jack Jansen <jack@cwi.nl> wrote in article <jack.860328432@news.cwi.nl>...
>> ...
>> ...With languages like Python or Tcl, with
>> no interface definitions whatsoever, you can only *hope* that you use
>> every interface correctly. I work on a largish project in Python, and
>> the one thing that gives continuous headaches is the lack of interface
>> definitions. Whenever you change an interface it is very very
>> difficult to check that you haven't inadvertantly broken something.
>This what the regression testing is for, isn't it ?
Regression testing is not good enough. The Python model is great
for small project and during the development stage of big projects,
but at some point you want to be able to cast the interfaces in
concrete, and have the compiler check that all uses and definitions of
the interface are correct.
One of the things regression testing will not catch is
misunderstanding over what the interface exactly is. If I create a
module with a function that sorts a list of integers, but my collegue
thinks that it sorts lists of any numbers, and this assumption is
correct for the first implementation but changed later regression
testing will not catch this.
I would dearly like a "companion language" to Python in which I can
specify what interfaces are. If such interface definitions are
available Python would enforce them, giving me a much safer language,
if they are not available Python would function as it currently does.
Unfortunately I have no idea whatsoever as to how one would design and
implement this:-(
--
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 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.
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 247
*************************************