[11215] in Perl-Users-Digest
Perl-Users Digest, Issue: 4815 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 3 13:07:23 1999
Date: Wed, 3 Feb 99 10:00:20 -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, 3 Feb 1999 Volume: 8 Number: 4815
Today's topics:
Re: ActivePerl on Win95 <cederstrom@removethis.kolumbus.fi>
Re: ActivePerl on Win95 (Bart Lateur)
ActivePerl perlTOC.html file is empty (Blair Kingsland)
Bad free() ignored at MyModule.pm. What is this? <kayaalp@cbmi.upmc.edu>
Re: Bath.pm-ish Meetings (brian d foy)
Re: Bath.pm-ish Meetings (Randal L. Schwartz)
Data-Dumper module installation problems <Oleg_Waisberg@Health.Lmig.ca>
Re: Deleting duplicates in a text file ()
Re: Deleting duplicates in a text file <jdf@pobox.com>
handling sysopen errors <bmb@ginger.libs.uga.edu>
Help - Complex Sort and Error Control/Reporting. <ccyr@sycore.ml.org>
Re: Help - Complex Sort and Error Control/Reporting. (Sean McAfee)
Help me! make error in Safe module <yslee@eve.soongsil.ac.kr>
Re: Help Unistalling ActivePerl (Blair Kingsland)
Re: Is there an Interactive Debugger for Perl? <no_spam@no_spam.com>
Re: locking/linking files - HELP <kiml@worldnetla.net>
Re: LWP Question (brian d foy)
Re: Net::Telnet -- how do I telnet from a telnet sessio <newsposter@cthulhu.demon.nl>
Re: newbie having trouble with concatination (Steve Linberg)
Re: read an html from a url <ebohlman@netcom.com>
Re: require does not work nondeterministically <jdf@pobox.com>
Re: Shared library and Perl (Greg Bacon)
Simple Perl Script <gt3511a@prism.gatech.edu>
Re: Simple Perl Script <ebohlman@netcom.com>
Re: Statistics for comp.lang.perl.misc (Greg Bacon)
Re: strange fork/pipe open behaviour (M.J.T. Guy)
Timer dkelly@emhain.wit.ie
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 2 Feb 1999 19:33:18 +0200
From: "Juho Cederstrvm" <cederstrom@removethis.kolumbus.fi>
Subject: Re: ActivePerl on Win95
Message-Id: <799t6q$3oc$1@news.kolumbus.fi>
mikey kirjoitti viestissd ...
Offtopic: Damn this Finnish Outlook Express is dumb... It's kind a miracle
that it can use Re: instead of Vs: when posting to newsgroups...
>$dummy = <STDIN>;
>Then you just have to hit enter when you want the DOS box to disappear.
I usually put just
<>
and that's fine also.
-juhoc
------------------------------
Date: Wed, 03 Feb 1999 17:03:14 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: ActivePerl on Win95
Message-Id: <36b88079.8100339@news.skynet.be>
Juho Cederstrvm wrote:
>>$dummy = <STDIN>;
>>Then you just have to hit enter when you want the DOS box to disappear.
>
>I usually put just
>
><>
>
>and that's fine also.
Except, if your program dies because of a die statement when the input
is not yet empty, it will simply go ahead and close the window.
I do a
END {
<STDIN>
}
which works, but it's also silly.
Oi! Guys from Activestate, or other knowledgable persons! Is there a
way to set a preference that .PL files when not run from the web server
(how would it know? Not sure...) that the window stays open? There
*must* be a way...
Bart.
------------------------------
Date: Wed, 03 Feb 1999 17:12:58 GMT
From: blairk@istar.ca (Blair Kingsland)
Subject: ActivePerl perlTOC.html file is empty
Message-Id: <vr%t2.16$ok6.217440@NewsRead.Toronto.iSTAR.net>
Hi:
I installed ActivePerl build 509. The installation was "successful."
But the doc file perlTOC.html is empty (zero bytes). I can't use the
online docs.
Is this an installation bug? Where can I get a copy of perlTOC.html?
Thanks,
Blair Kingsland
blairk@tigron.com
------------------------------
Date: Wed, 3 Feb 1999 12:24:52 -0500
From: "Mehmet Kayaalp" <kayaalp@cbmi.upmc.edu>
Subject: Bad free() ignored at MyModule.pm. What is this?
Message-Id: <79a0pl$ckj$1@usenet01.srv.cis.pitt.edu>
I am running cgi scripts written in perl (see my perl configuration below).
my $covL = $pid2covL{$pid};
This line causes an error "Bad free() ignored at MyModule.pm.", which
I can read on the apache's error_log file.
%pid2covL is tied to MLDBM 'DB_File' (DB_File.pm's version is 1.15)
Given an integer (ie $pid), it returns a reference ($covL) to a list of
integers.
This part works fine, but I do not understand what causes this error.
I would appreciate any helpful comments.
mehmet kayaalp
Center for Biomedical Informatics
University of Pittsburgh
== configuration=
413> perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=solaris, osvers=2.5.1, archname=sun4-solaris
uname='sunos ultra 5.5.1 generic sun4u sparc sunw,ultra-1 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-I/usr/local/include -I/opt/gnu/include'
ccflags ='-I/usr/local/include -I/opt/gnu/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib -L/opt/gnu/lib'
libpth=/usr/local/lib /opt/gnu/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldb -ldl -lm -lc -ldir -lcrypt
libc=/lib/libc.so, so=so
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-Kpic', lddlflags='-G -L/usr/local/lib -L/opt/gnu/lib'
Characteristics of this binary (from libperl):
Built under solaris
Compiled at Jul 9 1998 15:27:08
@INC:
/usr/local/lib/perl5/sun4-solaris/5.00404
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/sun4-solaris
/usr/local/lib/perl5/site_perl
.
------------------------------
Date: Wed, 03 Feb 1999 11:22:40 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Bath.pm-ish Meetings
Message-Id: <comdog-ya02408000R0302991122400001@news.panix.com>
In article <7986gv$20f$1@panix.com>, ziggy@panix.com (Adam Turoff) posted:
> Leon Brocard <leon@netcraft.com> wrote:
> >brian d foy wrote:
> >
> >> now, just how many groups do you plan on starting? ;)
> >
> >Actually, I was thinking of doing it alphabetically: Amsterdam.pm,
> >Bath.pm, ....... Hmmmm, where shall I move to next? Any suggestions /
> >job offers in Cairo? ;-)
>
> Cairo.pm is nice in that it'll finally establish mongers in Africa,
> leaving one continent to go (RossIceShelf.pm anyone?).
if we are playing the alphabet game, there are only a few holes to
fill in (for the english alphabet anyway):
Amsterdam.pm
Bristol.pm
Charlotte.pm
Denver.pm
Edmond.pm
F
GrandRapids.pm
Humboldt.pm
Israel.pm
JPL.pm
Knoxville.pm
London.pm
Montreal.pm
NY.pm
Omaha.pm
Philadelphia.pm
Q
Raleigh.pm
SanFrancisco.pm
Tokyo.pm
U
Vancouver.pm
Winnipeg.pm
X
Y
Zhengzhou.pm
[group information available from <URL:http://www.pm.org/groups.html>]
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: 03 Feb 1999 09:32:17 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Bath.pm-ish Meetings
Message-Id: <m1k8xz8kbi.fsf@halfdome.holdit.com>
>>>>> "brian" == brian d foy <comdog@computerdog.com> writes:
brian> Q
Yeah, how come there's no Quebec.pm??!
brian> X
Maybe I should start "Xanadu.pm"
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 03 Feb 1999 11:20:51 -0500
From: Oleg Waisberg <Oleg_Waisberg@Health.Lmig.ca>
Subject: Data-Dumper module installation problems
Message-Id: <36B87763.9D8C3C8B@Health.Lmig.ca>
Hello,
During a "make test" step of Data-Dumper module installation
following output generated:
-----------------------------------------
# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Data::Dumper
# make test
gcc -c -O -DVERSION=\"2.10\" -DXS_VERSION=\"2.10\" -fpic
-I/usr/local/lib/perl5/sun4-solaris/5.00401/CORE Dumper.c
Running Mkbootstrap for Data::Dumper ()
chmod 644 Dumper.bs
LD_RUN_PATH="" gcc -o blib/arch/auto/Data/Dumper/Dumper.so -G Dumper.o
chmod 755 blib/arch/auto/Data/Dumper/Dumper.so
cp Dumper.bs ./blib/arch/auto/Data/Dumper/Dumper.bs
chmod 644 blib/arch/auto/Data/Dumper/Dumper.bs
PERL_DL_NONLAZY=1 /usr/local/bin/perl -I./blib/arch -I./blib/lib
-I/usr/local/lib/perl5/sun4-solaris/5.00401 -I/usr/local/lib/perl5 -e
'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;'
t/*.t
IO object version 1.20 does not match $ 1.15 at
/usr/local/lib/perl5/sun4-solaris/5.00401/DynaLoader.pm line 172.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/sun4-solaris/5.00401/IO/Seekable.pm line 50.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/sun4-solaris/5.00401/IO/File.pm line 111.
BEGIN failed--compilation aborted at
/usr/local/lib/perl5/Test/Harness.pm line 7.
BEGIN failed--compilation aborted at -e line 1.
*** Error code 2
make: Fatal error: Command failed for target `test_dynamic'
----------------------------
Any ideas what's wrong here and how can I fix it.
Perl version: 5.004_01
OS: Solaris 2.6
Data-Dumper: 2.10
Thanks in advance.
Sincerely,
Oleg Waisberg
------------------------------
Date: 3 Feb 1999 16:26:26 GMT
From: kevin@sahara.research-inc.com ()
Subject: Re: Deleting duplicates in a text file
Message-Id: <slrn7bgu53.gb7.kevin@sahara.research-inc.com>
quick and dirty non-perl solution:
cat log* | addressextractor.pl | sort | uniq > uniquelist.txt
Hope this helps!
Kevin
clpm@overtone.org
------------------------------
Date: 03 Feb 1999 18:39:58 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: kevin@sahara.research-inc.com ()
Subject: Re: Deleting duplicates in a text file
Message-Id: <m34sp3xu6p.fsf@joshua.panix.com>
kevin@sahara.research-inc.com () writes:
> cat log* | addressextractor.pl | sort | uniq > uniquelist.txt
I can name that tune in 2 notes...
addressextractor.pl log* | sort -u > uniquelist.txt
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Wed, 3 Feb 1999 11:33:42 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: handling sysopen errors
Message-Id: <Pine.A41.4.02.9902031112310.56322-100000@ginger.libs.uga.edu>
Recipe 7.5 in the Perl Cookbook shows how to use sysopen to create
temporary files, like this:
for (;;) {
$name = tmpnam();
sysopen(TMP, $tmpnam, O_RDWR | O_CREATE | O_EXCL) && last;
}
unlink $tmpnam;
(I hope I typed that right.) I used that example to rewrite a file backup
routine that formerly checked -e before opening, which introduced a race
condition (as the book pointed out). The code is below, and my question
regards the 'for' loop around the 'sysopen' command. As you can see, I
added a couple of tests inside the loop, one for errors other than "File
exists" and one to catch an infinite loop if the file-exists error string
doesn't happen to be exactly "File exists". I added the first test for
the situation where the user doesn't have write permission for the
directory.
I would like to think that there is a better way to do this. Even though
I never expect to have 10000 backup files, I hate to add an unnecessary
limit--this is perl, after all. Any ideas?
Regards,
-Brad
#######################################################################
sub makebak {
use Fcntl; use File::Copy; local *BAK;
my $filename = shift;
die "Invalid argument: filename missing" unless defined $filename;
die "File, $filename, does not exist" unless -e $filename;
my $fmt = shift||'%s.bak.yyyymmdd.';
die "Invalid format ($fmt)" unless $fmt =~ /%s/;
my $yyyymmdd = sprintf( "%04d%02d%02d",
sub { ( $_[5] + 1900, $_[4] + 1, $_[3] ) }->( localtime ) );
$fmt =~ s/%s/$filename/; $fmt =~ s/yyyymmdd/$yyyymmdd/;
### backup file can't already exist, so skip existing ones
for( my $serial = 1, my $count = 0;; ) {
last if sysopen( BAK, $fmt . $serial++, O_WRONLY|O_EXCL|O_CREAT );
die $! unless $! eq 'File exists'; ### other error
die "Infinite loop" if ++$count > 10_000; ### last resort
}
return ( copy $filename, *BAK );
} # end sub makebak
------------------------------
Date: Wed, 03 Feb 1999 16:08:59 GMT
From: Colin Cyr <ccyr@sycore.ml.org>
Subject: Help - Complex Sort and Error Control/Reporting.
Message-Id: <36B874E8.3DDF391E@sycore.ml.org>
Hello, I am currently trying to deal with the following two issues:
1) Complex Sorting.
I have a dataset similar to:
6
6.3.2.2
6.3
6.1.1
6.2
6.3.2.1
6.4
6.3.2
6.3.1
6.1
I need this to be sorted to:
6
6.1
6.1.1
6.2
6.3
6.3.1
6.3.2
6.3.2.1
6.3.2.2
6.4
Each item represents a thread, 6.3.1 is a sub-thread of 6.3 and so on.
I'm looking for a way to make an index of this data so that it will be
easy to sort with the built-in sort routine.
I've devised the following two methods:
i) Take the leftmost postion of the identifier (6) and shift it left a
specific number of bits (Ie. 16, thus giving this routing a maximum of
64K items it could use), then take the next portion (as separated by the
dots) and shift it left by a number of bits, shift even those that do
not have a second identifier. And continue this procedure.
Problems: Too computationally expensive, you never know how many shifts
you might have to perform. You also will run out of bits, seeing as you
never know how many sub-threads you will have, you would have to try and
limit the number of bits you shift, and this puts unrealistic limits on
the number of threads and sub-threads.
ii) Zero padd each dotted portion, to a fixed with of say 10, thus for
6.3.2 you would get: 0000000006.0000000003.0000000002. Do this on all
items and then run it though a string compare. This would work.
Problems: String compares are too computationally expensive, Splitting,
zero padding, and joining isn't all that bad, but the only easy method
of zero padding I know is sprintf. Are there any solutions that can use
pack, unpack, or similar??? (I'd like to know this answer even if the
sorting answer is different).
Any suggestions on how to build an index to sort this kind of data?
2) Error Control and Reporting:
I'm programming an API for a GPL request tracking system. I am looking
for best practise information on handling this.
Currently upon error I have the methods etc., just return undef. This
works well to a point. Problem is there is no way for the calling
program to know what the error is.
The interfaces will be many and various, command-line, web, x(motif),
tcl/tk, e-mail. So I need a method that I can easily report the last
error, and have the calling program read this in and use it to generate
valid output for the user.
I've vaguely looked at using Carp, doe this just 'die' the program and
make it look like the calling program was at fault? Or does it allow
the calling program a chance to capture the call? Should the calling
programs use sig-handler (DIE)?
Any info on various methods of handling this would be appreciated.
Thanks in advance.
--
Colin Cyr (ccyr at home dot com)
------------------------------
Date: Wed, 03 Feb 1999 17:24:29 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Help - Complex Sort and Error Control/Reporting.
Message-Id: <hD%t2.5440$Ge3.22247474@news.itd.umich.edu>
In article <36B874E8.3DDF391E@sycore.ml.org>,
Colin Cyr <ccyr@sycore.ml.org> wrote:
>1) Complex Sorting.
>I have a dataset similar to:
>6
>6.3.2.2
>6.3
>6.1.1
>6.2
>6.3.2.1
>6.4
>6.3.2
>6.3.1
>6.1
>
>I need this to be sorted to:
>6
>6.1
>6.1.1
>6.2
>6.3
>6.3.1
>6.3.2
>6.3.2.1
>6.3.2.2
>6.4
This looks like a job for the Schwartzian Transform! (see perlfaq4)
@unsorted = qw(6 6.3.2.2 6.3 6.1.1 6.2 6.3.2.1 6.4 6.3.2 6.3.1 6.1);
@sorted =
map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, join "" => map chr, split /\./, $_ ] } @unsorted;
This first converts your data elements into a "stringy" representation--
"6.3.1" becomes "\x06\x03\x01", etc--and then uses an ordinary string sort
on it.
Of course, this approach will fail if any of the numbers gets bigger than
255. This may or may not be a problem for you. If it is, one alternate
approach might be this:
@sorted =
map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, do { ($tmp = $_) =~ s/(\d+)/pack "n", $1/ge; $tmp } ] }
@unsorted;
Replace the "n" with "N" if your numbers go higher than 65535.
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Wed, 03 Feb 1999 16:53:34 +0900
From: Yo-Seob Lee <yslee@eve.soongsil.ac.kr>
Subject: Help me! make error in Safe module
Message-Id: <36B8007E.1C5D8170@eve.soongsil.ac.kr>
Safe 8p5b@; makeGR 6' 4Y@=0z 00@: ?!7/0! 9_;}GU4O4Y.
>F=C4B :P@: ?,6tAV=C8i 0(;gGO0Z=@4O4Y.
mkdir blib
mkdir blib/lib
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/Safe
mkdir blib/lib/auto
mkdir blib/lib/auto/Safe
mkdir blib/man3
cp Safe.pm blib/lib/Safe.pm
/bin/perl -I/usr/local/lib/perl5/5.005/sun4-solaris
-I/usr/local/lib/perl5/5.005 /usr/local/lib/perl5/5.005/ExtUtils/xsubpp
-typemap /usr/local/lib/perl5/5.005/ExtUtils/typemap Safe.xs >Safe.tc &&
mv Safe.tc Safe.c
Please specify prototyping behavior for Safe.xs (see perlxs manual)
gcc -c -O -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\" -fPIC
-I/usr/local/lib/perl5/5.005/sun4-solaris/CORE Safe.c
Safe.xs: In function `XS_Safe_safe_call_sv':
Safe.xs:19: `defstash' undeclared (first use this function)
Safe.xs:19: (Each undeclared identifier is reported only once
Safe.xs:19: for each function it appears in.)
Safe.xs:20: `endav' undeclared (first use this function)
Safe.xs:21: `op_mask' undeclared (first use this function)
Safe.xs: In function `XS_Safe_op_mask':
Safe.xs:43: `op_mask' undeclared (first use this function)
*** Error code 1
make: Fatal error: Command failed for target `Safe.o'
------------------------------
Date: Wed, 03 Feb 1999 17:08:41 GMT
From: blairk@istar.ca (Blair Kingsland)
Subject: Re: Help Unistalling ActivePerl
Message-Id: <vn%t2.15$ok6.217440@NewsRead.Toronto.iSTAR.net>
Thanks.
I decided not to poke around the registry. I re-installed Win95. Then
I installed ActivePerl again.
Blair
Leon Stepanian <info@purco.qc.ca> wrote:
>You should be able to remove the remnants from your
>Start/Settings/Control Panel/Add-Remove Programs. In the
>Install/Uninstall window you should see a reference to this program.
>Usually when you click on the program name to reomve, and windows see
>that it is not available, it will ask you if you want to remove this
>reference. Say yes, and it's done.
>If you don't have any reference to this in the above location, or if
>Windows won't let you remove it, you'll have to use your RegEdit program
>located in your Windows directory, and do a "find" and delete each
>reference manually. But, be very carefull because you could make
>mistakes which could result in other problems.
>Another thing to do is check your System.ini and Win.ini files and
>remove any reference to this program, then reboot. Hope this helps.
>=================================================
>Blair Kingsland wrote:
>>
>> Hi:
>>
>> I installed ActivePerl on Win95. But something went wrong. So, I
>> (stupidly) unistalled AP by deleting the AP directory. I should have
>> used the Win95 unistall, but I forgot. Now, I want to re-install AP.
>> But I get a "system error decompressing file" message when I start the
>> AP install.
>>
>> I think I may have a corrupt registry. How do I completely remove the
>> old copy of AP?
>>
>> Your help would be appreciated.
>>
>> Blair
>> Blairk@tigron.com
------------------------------
Date: Wed, 3 Feb 1999 09:43:11 -0600
From: "Ban Spam Now" <no_spam@no_spam.com>
Subject: Re: Is there an Interactive Debugger for Perl?
Message-Id: <799qvo$b95@sjx-ixn5.ix.netcom.com>
I figured it out, thanks for your help :)
Ban Spam Now wrote in message <799j8p$b6g@sjx-ixn6.ix.netcom.com>...
>Would this be Unix based? I am running on Unix, sorry forgot to tell you.
>
>Tad McClellan wrote in message ...
>>Ban Spam Now (no_spam@no_spam.com) wrote:
>>: I am learning Perl and am used to languages which have an interactive
>>: debugger. At the moment I'm putting print statements everywhere. Is
>there
>>: an Interactive Debugger for Perl, or a slicker way than using prints?
>>
>>
>> perldoc perldebug
>>
>>
>>--
>> Tad McClellan SGML Consulting
>> tadmc@metronet.com Perl programming
>> Fort Worth, Texas
>
>
------------------------------
Date: Wed, 3 Feb 1999 11:22:08 -0600
From: "Kim Long" <kiml@worldnetla.net>
Subject: Re: locking/linking files - HELP
Message-Id: <36b886f0.0@209.4.101.246>
Thanks for the response. Is there a way to tell which programs honor flock
and which do not? Or is it a trial and error process?
KimL
Eugene Sotirescu wrote in message <36B7CFFA.5A0FB4C1@snailgem.org>...
>Kim Long wrote:
>>
>> I have a book with this snippet of code for locking a file before
>> manipulation. However there are a few things I don't understand.
>
>open (FH, ">$file") or die "Can't open $file: $!;
>flock (FH, 2); #use exclusive lock on file
>#do stuff to file
>close FH;
>
>Note tho that for the lock to work, other programs accessing the file
>also have to honor flock.
>
>--
>Eugene
>
>"Light is the all-exacting good,
>That dry, forever virile stream
>That wipes each thing to what it is,
>The whole, collage and stone, cleansed
>To its proper pastoral."
> Alvin Feinman
------------------------------
Date: Wed, 03 Feb 1999 11:35:23 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: LWP Question
Message-Id: <comdog-ya02408000R0302991135230001@news.panix.com>
In article <80Zt2.20$Al6.20504@news1.usit.net>, "Webdude" <webdude@usit.net> posted:
> I am running a simple script that goes and gets info from a webpage and
> post's in via SSI to my page. The script looks for the info by using key
> words
> if($line =~ /Past Scores/){ $start = 1; }
> Past Scores being the keyword here..What I wanted to know is if anyone here
> knew of a way for it to grab the info by line number instead of by keyword?
if you store the fetch data in an array, one line per element, you
can simply pick the element that you need. of course, there are
several other ways to accomplish this.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 03 Feb 1999 11:17:59 -0500
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Net::Telnet -- how do I telnet from a telnet session?
Message-Id: <36B876B5.A7A7A683@cthulhu.demon.nl>
Lee Ramirez wrote:
>
> Hi,
>
> I'm trying to telnet to a security router to get access to other routers,
> then telnet to those other routers from the security router (only security
> router has telnet rights) . I can perform a single telnet session using the
> Net::Telnet module, but how do I telnet from the initial telnet session.
>
> I thought of using two telnet objects, but both are launched from the Linux
> OS, and I need the second session to be launched from the first session.
>
> I can telnet to the second router by issuing the $host->cmd(address) line,
> but then I lose control as the object is still considered by Perl as part of
> the first telnet session. At least that is what I suspect.
using a second telnet object won't work (as you found out). How would you do
this if you had to do it manually?
open telnet connection to router1
from router1 open telnet connection to access router2, do work, disconnect [*]
from router1 open telnet connection to access router3, do work, disconnect
...
from router1 open telnet connection to access routern, do work, disconnect
disconnect from router1
Note that for the nested sessions, you would _not_ use the commands defined by
the Telnet module, but the commands provided by the routers.
[*]
telnetob->cmd("telnet router2");
[password?;commands you need to perform]
telnetob->cmd("exit");
Hope this helps,
Erik
------------------------------
Date: Wed, 03 Feb 1999 16:24:55 GMT
From: slinberg@crocker.com (Steve Linberg)
Subject: Re: newbie having trouble with concatination
Message-Id: <slinberg-0302991124560001@cc11620-a.lwmrn1.pa.home.com>
In article <3r6897.ij6.ln@magna.metronet.com>, tadmc@metronet.com (Tad
McClellan) wrote:
> Steve Linberg (linberg@literacy.upenn.edu) wrote:
> : In article <36B70CF4.3AB3@ee.surrey.ac.uk>, Gavin Ian Andrew Kenny
> : <eem3gk@ee.surrey.ac.uk> wrote:
>
> : > $line =~ /\s*(\S+.*)$/; # this gets rid of tab at the start and \n
> : > at # the end
> It is a m// not a s///
> It doesn't get rid of anything.
No, but his subsequent use of $1 has that effect (albeit a little
inefficiently).
> : Your .* matches everything to the end of the string.
>
> No, it doesn't match the newline at the end of the string,
> which, I believe, was the whole point :-)
It doesn't?
> perl
my $line = "\tstring with a newline at the end\n";
print "before regex:\n\n($line)\n\n";
$line =~ s/\s*(.*?)\s*$/$1/;
print "after regex:\n\n($line)\n\n";
__END__
before regex:
( string with a newline at the end
)
after regex:
(string with a newline at the end)
--
Looks like it matched the newline to me. "." matches everything, right?
> : Or do
> : something like this:
>
> : $line =~ s/\s*(.*?)\s*$/$1/;
>
>
> That may remove more than just a tab from the front.
> It may also remove more that just a newline from the end.
> It doesn't do what the poster's comment says he wants to do.
>
> And it has all of the problems that Perl FAQ 4 says it has.
You're right there. I forgot about that. :) It does fail with embedded
newlines, isn't terribly efficient, and the original poster wasn't
extremely specific about what he wanted.
Memo to self: reread the FAQ once a month. Things slip out.
------------------------------
Date: Wed, 3 Feb 1999 16:00:25 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: read an html from a url
Message-Id: <ebohlmanF6L5sq.Bot@netcom.com>
Guillaume Buat-Menard <guillaume@nospam.com> wrote:
: I already have LWP it is just that sometimes with some ISP I can't install
: what I want on the server for CGI's so I was looking for script to grab a
: URL. I promess, I'll learn and use LWP...
You probably want to read the section in perlfaq8 about how to install
modules in your personal directories.
------------------------------
Date: 03 Feb 1999 17:23:47 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: hh@ecce-terram.de (herwig)
Subject: Re: require does not work nondeterministically
Message-Id: <m3emo7xxpo.fsf@joshua.panix.com>
hh@ecce-terram.de (herwig) writes:
> system: Linux (SUSE 6.0, brand new), perl, version 5.005_02 built for
> i586-linux. Apache 1.3.3
^^^^^^
hmmm
> I'm creating a cgi-script which does a "require" at the beginning.
> Strangely this require does not work about half the time!
This is just a wild guess, but is the cgi-bin directory configured as
an Apache::Registry directory? This could have effects similar to
those that you describe given certain other conditions.
If so, see the documentation for mod_perl, which will lead you to
other docs that discuss traps for the unwary Apache::Regsitry user.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 3 Feb 1999 15:52:23 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Shared library and Perl
Message-Id: <799rbn$rrr$3@info.uah.edu>
In article <7982hn$31c$1@nnrp1.dejanews.com>,
hoangngo@usa.net writes:
: I have a shared library (.so) that i would like to link with Perl. This
: library has a function that looks something like this:
: void (char *buf, uint , uint)
:
: What i would like to be able to do is to link this library in such a way
: so that i can change the library without recompiling Perl.
Read the perlxstut manpage, paying careful attention to the section
labeled `EXAMPLE 4'.
Greg
--
A lawyer is an expert on justice in the same way that a whore is an expert on
love.
------------------------------
Date: Wed, 03 Feb 1999 10:53:02 -0500
From: Stuart Lester <gt3511a@prism.gatech.edu>
Subject: Simple Perl Script
Message-Id: <36B870DE.F005A0B9@prism.gatech.edu>
Hey out there,
Does anyone happen to know how to get perl to do the following (when
passed a filename and string):
Search the entire file <filename> for the string. When found the ENTIRE
line is deleted. Repeat for all instances of <string>.
I am pretty sure this would only be a simple script, but i don't know
the syntax to delete an entire line.
Thanks in advance.
------------------------------
Date: Wed, 3 Feb 1999 16:15:24 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Simple Perl Script
Message-Id: <ebohlmanF6L6Ho.Czs@netcom.com>
Stuart Lester <gt3511a@prism.gatech.edu> wrote:
: Does anyone happen to know how to get perl to do the following (when
: passed a filename and string):
: Search the entire file <filename> for the string. When found the ENTIRE
: line is deleted. Repeat for all instances of <string>.
: I am pretty sure this would only be a simple script, but i don't know
: the syntax to delete an entire line.
Take a look at the second entry in perlfaq5, which deals with this very
subject.
------------------------------
Date: 3 Feb 1999 15:46:44 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <799r14$rrr$2@info.uah.edu>
In article <MPG.11215d7f70cdd0da98969a@nntp1.ba.best.com>,
moseley@best.com (Bill Moseley) writes:
: Is a high ratio good or bad???
Value is in the eye of the beholder.
Greg
--
God does not play dice with the universe. -- Albert Einstein
Who are you to tell God what to do? -- Niels Bohr
------------------------------
Date: 3 Feb 1999 17:49:42 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: strange fork/pipe open behaviour
Message-Id: <79a27m$ll2$1@pegasus.csx.cam.ac.uk>
In article <796h2a$f4s$1@newsgate.sps.mot.com>,
Christian Murphy <r28874@email.sps.mot.com> wrote:
>When I run this test program I expect it to print numbers from 0 upwards
>until I kill it. In fact, Perl 5.004_04 prints the following:
>
>0
>close: $? = 13 $! = at ./x.pl line 10.
As expected. You close the pipe, so the child process gets a SIGPIPE
when it next tries to output. Since the child doesn't trap SIGPIPE,
you get a wait code from the child saying SIGCHLD.
Depending on the exact timing, this may happen before or after the child
has generated any output.
Mike Guy
------------------------------
Date: Wed, 03 Feb 1999 16:25:59 GMT
From: dkelly@emhain.wit.ie
Subject: Timer
Message-Id: <799tab$jgf$1@nnrp1.dejanews.com>
Hi,
I am working on a Perl script that is running on a Unix system. I want to
have my script run automatically at a fixed time each day.
I am not allowed to run it by use of the CRONTAB or BATCH facilities on the
Unix system. I need it to run through the use of Perl code.
Any help would be appreciated.
Kelly
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4815
**************************************