[7529] in Perl-Users-Digest
Perl-Users Digest, Issue: 1156 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 10 09:07:19 1997
Date: Fri, 10 Oct 97 06:01:05 -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 Fri, 10 Oct 1997 Volume: 8 Number: 1156
Today's topics:
Re: associative array (Bart Lateur)
Bidirection pipes <ghowland@hotlava.com>
Re: Bidirection pipes (Tad McClellan)
Re: CGI and URI::URL modules collision <aas@sn.no>
Re: child labour <dformosa@st.nepean.uws.edu.au>
Re: Combining two list using Perl <ajohnson@gpu.srv.ualberta.ca>
flush() - why, what and where? <ghowland@hotlava.com>
Re: Help storing a hash of hashes using DB_File <thomson@zinger.adp.wisc.edu>
Re: How do I skip \, in a split /,/ (Brendan O'Dea)
is there a GUI for MacPerl scripts? (Gert Jan Verhoog)
Re: needed: date stamp of a graphic file being loaded i <westxga@ptsc.slg.eds.com>
Re: Out of memory error? <nick@glencros.demon.co.uk>
Re: Out of memory error? <Brian_shields.0192063@nt.com>
Re: Posting to a Newsgroup with a Perl Script. (Michael Fuhr)
Re: Problems with flock <xavi@teclata.es>
Problems with win32::ODBC on NT (Pedro Pastor)
Re: Q: How to change GID? (Marek Rouchal)
Re: regexp: matching at least n chars out of a string o (Bart Lateur)
Re: Seeing if service is alive, Is this a good idea? <ghowland@hotlava.com>
Re: sql in perl (Michael Fuhr)
Re: sql on perl (brian d foy)
Tied filehandles <ghowland@hotlava.com>
Re: Win32ODBC-perl INSERT statement <jday@afgltd.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 10 Oct 1997 09:41:45 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: associative array
Message-Id: <343df196.823270@news.tornado.be>
colte@hem.passagen.se (Robert) wrote:
> @input = join("|", %input);
Ugh! Join returns one string, not an array. So:
$input = join("|",%input).
But I wouldn't do that:
1) You probably don't want to change the keys of the hash
2) Fields that contain a "|" will prevent you to split the data properly
later on.
But first:
> foreach $varde (%input) {
> $varde =~ s/e/å/g;
> $varde =~ s/E/Å/g;
> $varde =~ s/d/ä/g;
> $varde =~ s/D/Ä/g;
> $varde =~ s/v/ö/g;
> $varde =~ s/V/Ö/g;
> }
> %input = split(/\|/, @input);
You really should substitute all special entities in one swoop. It won't
happen in your particular case, but in some cases you might end up
substituting replacement characters themselves.
This does what I mean:
%entity = ( 'E' => 'Å', 'd' => 'ä',
'D' => 'Ä', 'v' => 'ö',
'V' => 'Ö' );
foreach $key (keys %input) {
$input{$key} =~s/(.)/$entity{$1} || $1/ge;
}
which is optimized for extensibility: if you need more entities, all you
have to do is add entries to %entity, and
foreach $key (keys %input) {
$input{$key} =~s/([EdDvV])/$entity{$1}/g;
}
which is optimized for speed: no run time execution, and no trying to
replace characters that needn't be replaced. But now you DO need to be
careful to include only characters in the charcter class (between [])
that have an entry in %entity.
HTH,
Bart.
------------------------------
Date: Fri, 10 Oct 1997 10:24:35 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Bidirection pipes
Message-Id: <343DF453.14DF@hotlava.com>
Hi,
I noticed that the pipe() function always returns a one way pipe, even
if the underlying OS supports bidirectional pipes. Does anyone know if
I can use syscall() to call the pipe system call and get a fully
bi-directional pipe?
(Please don't suggest the use of socketpair()).
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: Fri, 10 Oct 1997 06:31:56 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Bidirection pipes
Message-Id: <cn3l16.bh.ln@localhost>
Gary Howland (ghowland@hotlava.com) wrote:
: Hi,
: I noticed that the pipe() function always returns a one way pipe, even
: if the underlying OS supports bidirectional pipes. Does anyone know if
: I can use syscall() to call the pipe system call and get a fully
: bi-directional pipe?
: (Please don't suggest the use of socketpair()).
Maybe the Perl FAQ, part 8 would be helpful:
--------------------
=head2 How can I open a pipe both to and from a command?
The IPC::Open2 module (part of the standard perl distribution) is an
easy-to-use approach that internally uses pipe(), fork(), and exec()
to do the job. Make sure you read the deadlock warnings in its
documentation, though (see L<IPC::Open2>).
--------------------
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 10 Oct 1997 09:39:40 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: CGI and URI::URL modules collision
Message-Id: <m3en5u3w3n.fsf@furu.g.aas.no>
Bekman Stanislav <sbekman@iil.intel.com> writes:
> use CGI qw(:standard :html2);
> use URI::URL;;
Both modules tries to export a function called url(). If you don't
want URI::URL's version of it, then you can say:
use CGI qw(:standard :html2);
use URI::URL ();
> (URI::URL is part of LWP5.13 and CGI is 2.36)
> and run the perl5.004.01 perl on these two lines I get:
>
> Prototype mismatch: sub main::url vs ($;$) at
> /usr/local/lib/perl5.004/Exporter.pm line 155
> Exporter::export('URI::URL', 'main') called at
------------------------------
Date: 7 Oct 1997 02:58:40 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: child labour
Message-Id: <876193081.986023@cabal>
In <-0610971041110001@aggie.coaps.fsu.edu> fl_aggie@thepentagon.com (I R A Aggie) writes:
>In article <34393F37.1257@edith.antenna.nl>, karin
><nuekar@edith.antenna.nl> wrote:
>+ We will confront you with ten statements and we would be for ever
>+ greatefull if you would take the time to respond.
>Are these children perl programmers? If not, you're asking in the wrong
>newsgroup.
I thourt thay where complaining about the horrable labor done by child
proccesors. All thouse poor young proccessors just forcked off and being
forced to do heavy work in the data mines. Its a crime I tell you a
crime.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep. Buy easter bilbies.
Save the ABC Is $0.08 per day too much to pay? ex-net.scum and proud
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Fri, 10 Oct 1997 00:23:38 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
To: Fouad Al-Hallel <falhallel@neonetllc.com>
Subject: Re: Combining two list using Perl
Message-Id: <343DC9EA.1A8C68A8@gpu.srv.ualberta.ca>
Fouad Al-Hallel wrote:
>
> I am a new user of Perl. I am trying to solve the following problem:
>
> I have two list with similar entries
>
[snip data description]
>
> Each list is in a seperate file. I am trying to form a third list in a
> diffrent file which combibe the two
[snip output description]
> I am familiar with the way to open files and read and write from them.
>
> any idea on how to create this third list. I appreciate any ideas or
> thougths.
here's a minimally tested quickie that should work
for you --- it reads all the input lists into memory,
the prints the combined list to stdout... if your lists
are large you might want to try something a little different.
(it also assumes that the first line of each list-file is an
'item' line):
#!/usr/bin/perl -w
# mixlist.pl
# usage: mixlist.pl file1 file2... > outfile
use strict;
my($item,%new_list);
while (<>) {
$.==1 and /^item/ || die "no item at top of file $ARGV\n";
close ARGV if eof;
next if /^$/;
$item=$1 if s/^item\s+(\d+)\n//;
$new_list{$item}.=$_ if $item;
}
print map{"item $_\n$new_list{$_}\n"}
sort{$a<=>$b}keys %new_list;
__END__
hope it helps
regards
andrew
------------------------------
Date: Fri, 10 Oct 1997 10:18:27 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: flush() - why, what and where?
Message-Id: <343DF2E3.7CA0@hotlava.com>
Hi,
I've been playing around with tied filehandles, and have noticed that
flush does not seem to be defined for them. I then took at look at the
IO::Handle packages, and the perl source, and couldn't figure out what
the circumstances are for flush() to be available. I can't find any
reference to flush() in the documentation either.
So, first question: Where is flush() documented?
Second question: Why doesn't flush work in tied filehandles?
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: 10 Oct 1997 07:13:36 -0500
From: Don Thomson <thomson@zinger.adp.wisc.edu>
Subject: Re: Help storing a hash of hashes using DB_File
Message-Id: <tzen5tg6j3.fsf@zinger.adp.wisc.edu>
In article '<61jhe9$77a$1@daily.bbnplanet.com>' Larry Lentner asks:
> Hello,
>
> Does anybody have some pointers to examples/hints/etc for storing a
> hash of hashes in a Berkeley db file, using DB_File? It appears that a
> hash tied with "tie %hash, "DB_File", ... " will only work with a flat
> (ie. not multidimensional) hash.
>
> Much appreciated....
>
> Larry
Larry: Check out the MLDBM module, available at your nearest CPAN site.
I've been using it quite successfully for a number of projects that need
the ability to store an arbitrarily complex 'record' as a dbm value.
>From the man page:
NAME
MLDBM - store multi-level hash structure in single level
tied hash
DESCRIPTION
This module, intended primarily for use with DBM packages,
can serve as a transparent interface to any TIEHASH package
that must be used to store arbitrary perl data, including
nested references.
It works by converting the values in the hash that are
references, to their string representation in perl syntax.
When using a DBM database, it is this string that gets
stored.
It requires the Data::Dumper package, available at any CPAN
site.
As Tom Phoenix is fond of saying: 'Hope this helps'.
--
----- Don Thomson ----- DoIT (Division of Information Technology) -------
thomson@doit.wisc.edu (608) 262-0007 1210 W. Dayton, Madison, WI 53706
------------------------------
Date: 10 Oct 1997 10:10:07 GMT
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: How do I skip \, in a split /,/
Message-Id: <61kutv$bre$1@diablo.compusol.com.au>
In article <4aak16.991.ln@localhost>, Tad McClellan <tadmc@flash.net> wrote:
>
>Ty Cage Warren (tycage@infi.net) wrote:
>: Toutatis wrote:
>: >
>: > $line = 'xxxx,xx\,xx,xxxx'
>: > How do I split this line into three fields, omitting the escaped comma?
[snip]
>Perl does not have lookbehind, only lookahead.
>
>So, the usual approach is to reverse the string, and then use lookahead
>to get actual lookbehind, then reverse the string again.
>
>
>-------------------------
>#!/usr/bin/perl -w
>
>$_ = 'abcd,lm\,no,wxyz';
>
># reverse the string, then split it
>foreach ( split(/,(?!\\)/, # split using negative lookahead
> reverse $_ # reverse the original string
> )
> ) {
>
> # unshift() instead of push() to reverse order of substrings
> # back to their original order
> # reverse in scalar context to reverse the chars within each substring
> unshift @fields, scalar(reverse $_);
>}
>
>foreach (@fields) {print "$_\n"}
This approach has problems where the escape character may escape
itself (often the case, although not explicitly specified by the
original poster).
So in the example above, if the string contained
abcd,lm\\,no,wxyz
I would expect that to split into four fields, the second of which
ending with an escaped backslash (ie. \\).
While you could change the split to use:
/,(?!\\(?!\\))/
what happens when you have *three* backslashes?
I find that the simplest solution is to pre- and post-hack the string
to hide and restore the escapes:
s/\\(.)/sprintf '\\%02x', ord $1/ge;
@new = map { s/\\(..)/'\\' . chr hex $1/ge; $_ } split /,/;
Note that you would have to do something slightly different if your
delimiter was in the set [0-9a-f].
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: Fri, 10 Oct 1997 12:46:04 +0200
From: gerti@xs4all.nl (Gert Jan Verhoog)
Subject: is there a GUI for MacPerl scripts?
Message-Id: <1997101012460451054@mas02-08.dial.xs4all.nl>
I'm probably not the first one with this question, but since I couldn't
find anything relevant on the internet, I'll ask it here anyway:
Is there any work done on a Perl/tk for the Macintosh, or is it possible
to let MacPerl interact with wish or the Mac X-server MI/X for example?
In other words: I would like my perl scripts to have a graphical
interface, but the scripts will also have to run in a unix world without
too much modification...
--
Gert Jan Verhoog | - No brains, total freedom -
Cognitive Artificial Intelligence, | http://www.xs4all.nl/~gerti/
Dept. of Philosophy, Utrecht Uni- |
versity, the Netherlands | PGP-key available
------------------------------
Date: Thu, 09 Oct 1997 10:18:30 +0000
From: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: needed: date stamp of a graphic file being loaded into an HTML
Message-Id: <343CAF76.5FF5@ptsc.slg.eds.com>
David Miller wrote:
>
> I need, what I feel should be a very simple script. This script would
> determine the date stamp of a graphic file being loaded into an HTML
> document and then display the date in the HTML document. So that the user
> would know that the picture is old, recent, etc.
$FILE="xxx.jpg";
$ts=(stat($FILE))[9];
@time=localtime($ts);
$dom=$time[3];
$mon=$time[4];
.
.
.
>
> In advance....
> Thank you!
>
> David Miller
------------------------------
Date: Fri, 10 Oct 1997 12:02:51 +0100
From: Nick Glencross <nick@glencros.demon.co.uk>
Subject: Re: Out of memory error?
Message-Id: <343E0B5B.7E02@glencros.demon.co.uk>
I agree: this is the approach to take.
However, processes terminating 'through' lack of memory have more to
do with swap space resourses & kernel parameter limits
than physical memory.
Cheers!
Nick G.
------------------------------
Date: Fri, 10 Oct 1997 08:42:20 -0400
From: brian shields <Brian_shields.0192063@nt.com>
Subject: Re: Out of memory error?
Message-Id: <343E22AC.43F0@nt.com>
Here is the program, again, I appreciate any assistance you can
provide. Immediately following the program is a sample of the input
file. I was wrong about the input file size (I looked at the wrong
file). File 1 is 23 MB and file 2 is 6.6MB. My program is only
capturing a fraction of this total amount.
#!/usr/local/bin/perl -w
# use -c for compiling only
# getmail.pl
# this program scans email files to get up to two internal mailing
addresses
# per employee
#
@INC=('/usr/local/perl','/usr/local/perl-5.001','/usr/local/perl-5.001/lib');
$mailfile1='/data/junk/cocos.out';
$mailfile2='/data/junk/exchange.out';
# tables built for hits on wordlist
@data=();
%emdata=(); # associative array containing addresses.
#Open the input file, quit if it does not exist and print error message.
$loopk=1;
while($loopk<3) {
print "AAAAAAAAAA is $loopk ppp, \n"; #debugging
if($loopk==1) {$mailfile='/data/junk/cocos.out';}
else {$mailfile='/data/junk/exchange.out';}
print "xxx $mailfile,\n"; # debugging
open(INFILE, $mailfile) or die "The mail .out file does not
exist.\n";
# "j is $loopk.\n";
# "if 1, then file missing is cocos.out\n";
# "if 2, then file missing is
exchange.out\n";}
###dbmopen(%emdata, '/int/data/mailaddr', 0777);
# seek(INFILE,0 ,0);
#reset the count of successes
$numrecin=0;
$emaddr="";
#loop through the records in the file
while(<INFILE>) {
$numrecin +=1;
# if ($numrecin < 45) {goto getnextrec;} #debugging
# if ($numrecin > 510) {goto getnextfile;} #debugging
$inrec=$_;
chomp($inrec);
$inlen = length($inrec);
# print "loop level is $loopk ppp, recno is $numrecin\n"; #debugging
$emaddr="x";$empid="x";$lname="x";$fname="x";$cntr=0;
@alldata=split(/ /,$inrec);
foreach $i (@alldata) {
if ($i ne "") {$cntr +=1;
if ($cntr==2) {$lname=$i;}
else {if ($cntr==3) {$fname=$i;}
else {if (index($i,"@") > -1) {$emaddr=$i;}
}}
###print "$i,\n"; #debugging
}
}
$r1=rindex($inrec,"@");
###print "$r1,\n"; #debugging
$temp=substr($inrec,120,1);
$empid=substr($inrec,108,8);
# $xxxx=lc(substr($lname,0,2)); #debugging
# if($xxxx ne 'ad') {goto getnextrec;} #debugging
print "NEWREC $numrecin $empid, $temp, $lname, $fname, $emaddr\n";
#debugging
@data[0,1,2,3]=($lname, $fname, $temp, $emaddr);
if(exists($emdata{$empid})) {
@mail=@{$emdata{$empid}};
# print "BBB @mail\n"; #debugging
push(@mail,@data[0,1,2,3]);
$mail=@mail;
print "BBB $mail\n"; #debugging
print "BCD @mail\n"; #debugging
#Only store two addresses per employee
if($mail<9) {
$emdata{$empid}= [@mail]
}
@mail=@{$emdata{$empid}}; #debugging
print "CCC @mail\n"; #debugging
}
else {$emdata{$empid}= [@data];
@mail=@{$emdata{$empid}};
# print "DDD @mail\n"; #debugging
}
# #$emdata{$empid}=join(' ',@data[0,1,2,3]);
## print join("XX\n",%emdata); #debugging
#### if ($numrecin > 50) {goto codeend;} #debugging
getnextrec:
next;
} #end of while group
getnextfile:
close INFILE;
print "endendende is $loopk ppp, \n"; #debugging
$loopk +=1;
} #end of first while group
#goto codeend;
codeend:
#
####dbmclose(%emdata);
print "numrec=$numrecin\n";
print "Getmail program finished.\n";
1; #necessary for calls from other programs to use this program.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Input file 1 has 59838 records, file 2 has 16639 records. Sample input
record...
074285 1 Instructor (I.) 1236
BRAM NT
PSDPSD49 PNNY1 INSTRUCTOR
(I.) INSTRUCTOR
I 0134139 U
NNN
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Benjamin Holzman wrote:
>
> [posted & mailed]
>
> brian shields wrote:
> >
> > Greetings,
> > I am running Perl version 5.001 on an HP-UX 712 9.05. I am running a
> > program to create an associative array of our internal e-mail
> > addresses. The array is keyed by employee id and it constructs a list
> > for each id (dept number, first name, last name, and e-mail address). I
> > have set it up to have no more than 2 iterations of the e-mail address
> > per employee (an employee can have more than one e-mail address). The
> > program runs out of memory. I estimate there are about 60K records to
> > be produced. What I do not understand is why so much memory is used
> > when the source file is only 1.5 MB? My program is using a small
> > portion of each record in this file(perhaps about 80 bytes of
> > information). Using the HP command 'top' to monitor memory usage, I can
> > see the program went from initially using about 1 MB of memory to 80MB
> > before it finally failed. My system has 128MB RAM. I would expect an
> > internal file of less than 5 MB to be created. So why is so much memory
> > being consumed? I am not running anything else at the same time either
> > which would consume all available memory. I would sure appreciate any
> > suggestions on making full use of available memory without wasting it
> > all somehow. Any ideas?
> >
> > Sincerely,
> >
> > Brian
> If you post your script, I'm sure someone will be happy to help you find
> your memory leak :-)
>
> Benjamin Holzman
------------------------------
Date: 10 Oct 1997 01:43:03 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Posting to a Newsgroup with a Perl Script.
Message-Id: <61kma7$8ef@flatland.dimensional.com>
Brandon Stirling <brandons@uidaho.edu> writes:
> Posting to a Newsgroup with a Perl Script.
>
> This should be an easy task, but I can only find a method to read
> Newsgroups with a perl script.
>
> Can anyone in Perl land give me a starting point for this process?
Take a look at Net::NNTP, part of libnet. You can get libnet and other
useful modules from the Comprehensive Perl Archive Network (CPAN):
http://www.perl.com/CPAN/CPAN.html
There's also News::NNTPClient, but I've never used it. You might also
want to peruse RFCs 977 and 1036:
http://www.internic.net/rfc/rfc977.txt
http://www.internic.net/rfc/rfc1036.txt
Hope this helps.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Fri, 10 Oct 1997 03:06:07 +0200
From: Xavier Tarafa Mercader <xavi@teclata.es>
Subject: Re: Problems with flock
Message-Id: <343D7F7E.EF701269@teclata.es>
--------------32A69B8B874C1BCEB6F1AA6D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Xavier Tarafa Mercader wrote:
> I've modified the script for tryinfg to run it twice . The script
> does
> what follows: Open a file, lock it send amail with the return value for
> flock, do something with the file, close the file, unlocked, send a mail
>
> with the return value of the flock function.
>
> -------------------------------------------------------------------------
>
> #!/usr/bin/perl
> $ENV{PATH} = '/usr/bin:/bin';
>
> $LOCK_EX = 2;
> $LOCK_UN = 8;
> $trouble_email = 'xavi@teclata.es';
>
> #Open file
>
> if(!(open(TABLE,">./test"))){
> print STDERR "Couldn't open Table: $table_content file. Aqui";
> exit(0);
> }
>
> #lock the file
>
>
> $valor=flock(TABLE,$LOCK_EX);
>
sleep(10);
> #Get a mail with flock return value
>
> open(OUT,"|mail $trouble_email");
> print OUT "flock value is $valor"; # $valor = 1
> close(OUT);
>
> #Abort program if was not flocked
> if($valor == 0){
> print STDERR "Couldn't flock Table: $table_content file";
> exit(0);
> }
# I assumed the second time I run the script it should be aborted#Because the
file should be locked. $valor==0. But it was. Any Idea?
>
>
> Xavier Tarafa
> Teclata. S.L
--
Xavier Tarafa
Teclata.
--------------32A69B8B874C1BCEB6F1AA6D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Xavier Tarafa Mercader wrote:
<BLOCKQUOTE TYPE=CITE>I've modified the script for tryinfg to run it
twice . The script
<BR>does
<BR>what follows: Open a file, lock it send amail with the return value
for
<BR>flock, do something with the file, close the file, unlocked, send a
mail
<P>with the return value of the flock function.
<P>-------------------------------------------------------------------------
<P>#!/usr/bin/perl
<BR>$ENV{PATH} = '/usr/bin:/bin';
<P>$LOCK_EX
= 2;
<BR>$LOCK_UN
= 8;
<BR>$trouble_email
= 'xavi@teclata.es';
<P>#Open file
<P>if(!(open(TABLE,">./test"))){
<BR> print STDERR "Couldn't open Table: $table_content file. Aqui";
<BR> exit(0);
<BR>}
<P>#lock the file
<BR>
<P>$valor=flock(TABLE,$LOCK_EX);
<BR> </BLOCKQUOTE>
sleep(10);
<BLOCKQUOTE TYPE=CITE>#Get a mail with flock return value
<P>open(OUT,"|mail $trouble_email");
<BR>print OUT "flock value is $valor"; # $valor = 1
<BR>close(OUT);
<P>#Abort program if was not flocked
<BR> if($valor == 0){
<BR> print STDERR "Couldn't flock
Table: $table_content file";
<BR> exit(0); <BR>
}</BLOCKQUOTE>
# I assumed the second time I run the script it should be aborted#Because
the file should be locked. $valor==0. But it was. Any Idea?
<BR>
<BLOCKQUOTE TYPE=CITE><BR>
<BR>
Xavier Tarafa
<BR>Teclata. S.L</BLOCKQUOTE>
<PRE>--
Xavier Tarafa
Teclata.</PRE>
</HTML>
--------------32A69B8B874C1BCEB6F1AA6D--
------------------------------
Date: Fri, 10 Oct 1997 10:32:00 GMT
From: pedro@educ.mec.es (Pedro Pastor)
Subject: Problems with win32::ODBC on NT
Message-Id: <343e0226.78288152@news.mec.es>
I am trying to use ODBC driver for Oracle 1.0.0.1 with the win32::ODBC
object to access data from a aviion, but it give me with the call
FetchRow():
NumeroError: 911
Texto: [Microsoft][ODBC Driver Manager] El controlador no acepta esta
funcisn
Conn:63.
and I don't know wath to do.
Please help.
Answers in Spainsh are wellcome.
------------------------------
Date: 10 Oct 1997 10:15:10 +0200
From: Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal)
Subject: Re: Q: How to change GID?
Message-Id: <61ko6e$rmq@buffalo.HL.Siemens.DE>
I've investigated the problem further: The set[re]gid() C library function that's
behind the $( = ... or $) = ... perl code only works when the user is the
super-user, i.e. root. Therefore a perl script that needs to change its GID must
run as set-uid root :-(
I don't know whether this is standard UNIX behaviour; Solaris and Linux seem both
to behave this way.
I thought that if the "normal" (non-root) user *is* member of the group he wants
to switch to (as indicated by the getgroups() call), set[re]gid won't need root
priviledges, but I seem to be mistaken.
Is there any other way to change a perl script's GID than
- using /bin/newgrp
- giving the script setuid-root priviledges?
Thanks for any pointers!
Cheers,
Marek
PS. If you want to reply by EMail, please remove -nospam- from the address.
Thank you.
--
Marek Rouchal Phone : +49 89/636-25849
SIEMENS AG, HL CAD SYS Fax : +49 89/636-23650
Balanstr. 73 mailto:Marek.Rouchal@-nospam-hl.siemens.de
81541 Muenchen PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de
------------------------------
Date: Fri, 10 Oct 1997 09:41:55 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: regexp: matching at least n chars out of a string of length m
Message-Id: <343ef5fd.1950386@news.tornado.be>
gtuckerkellogg@genetics.com wrote:
>I have a collection of strings which contain many occurances of the
>character ':'. I'd like to know, for each string, all the substrings of
>length $window than contain $want colons.
>
>I've been thinking along the lines of
>
>$window = 30;
>$want = 20;
>
>foreach $string (@stringlist) {
> my $i;
> my $result = "";
> for (i=0;i<length($string)-$window; $i++) {
> my $substring = substr($string,$i,$window);
> if ($substring =~ /some_magical_regexp/) {
># stuff the results into $result;
> substr($result,$i,1) = "1";
> }
> }
>}
>
>but I can't seem to figure out the right regexp. Am I barking up the
>wrong tree?
Yes. You really should use tr/:// to count the colons.
if (($substring =~ tr/://)>=$want) { ... }
You can make it match EXACTLY $want colons, by replacing ">=" by "==".
PS. You could use { $substring =~ /(:)/g } too, as this returns an array
of all the matches. Just count them (hint: "scalar").
HTH,
Bart.
------------------------------
Date: Fri, 10 Oct 1997 11:12:49 +0100
From: Gary Howland <ghowland@hotlava.com>
To: Thomas Munn <munn@bigfoot.com>
Subject: Re: Seeing if service is alive, Is this a good idea?
Message-Id: <343DFFA1.11FC@hotlava.com>
Thomas Munn wrote:
> Have perl send an http request to the web server, to see if the server is up.
> Do I just send an http get command, then have a timeout? Or is there a built
> in function that will do this automagically?
>
> Also I am not sure how to install a "delay" (say a second or two) while perl
> waits for the answer, or do the web libraries automagically know how long to
> wait before returning a "fail" code.
This is best done by setting an alarm, and setting up a signal handler
to catch the alarm.
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: 10 Oct 1997 01:50:30 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: sql in perl
Message-Id: <61kmo6$8gc@flatland.dimensional.com>
"Louis Emerson B. Ricohermoso" <louis@cheerful.com> writes:
> does anybody know of a module or library that i can use to do sql in perl?
> i need relational database functionality, any ideas?
The Comprehensive Perl Archive Network (CPAN) contains all sorts
of useful modules:
http://www.perl.com/CPAN-local/CPAN.html
Search for "SQL" or "database" and you'll find modules to interface
with several popular database packages.
Hope this helps.
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: 10 Oct 1997 06:46:00 GMT
From: comdog@computerdog.com (brian d foy)
Subject: Re: sql on perl
Message-Id: <61kiv8$7ja@bgtnsc01.worldnet.att.net>
In article <01bcd525$3bc0ab40$0224a8c0@firewall>, "Louis Emerson B.
Ricohermoso" <louis@cheerful.com> wrote:
> does anybody know of a module or library that i can use to do sql in perl?
> i need relational database functionality, any ideas?
there are many database goodies on CPAN [1]. 'nuff said.
[1] Comprehensive Perl Archive Network, accessible through
<URL:http://www.perl.com/>
--
brian d foy <http://computerdog.com/>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Fri, 10 Oct 1997 10:20:10 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Tied filehandles
Message-Id: <343DF34A.4A2E@hotlava.com>
Hi,
Is it recommended that I use buffered IO (e.g. print, <>), or unbuffered
IO (sysread, syswrite), for implementing tied filehandles?
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: 10 Oct 1997 06:00:49 GMT
From: "Joseph M. Day" <jday@afgltd.com>
Subject: Re: Win32ODBC-perl INSERT statement
Message-Id: <01bcd541$dc914630$6020fdcd@gangster>
You may need to put "desc" in square brackets if that is really the name of
the field. It is a key word in Access that tells it what direction to sort
in. What I do in situations like this is to output your SQL statement to a
file. Sometimes your query may not look the way you think it's going to.
Cut and paste this query into MS Access query designer. You will typically
get an error there that lets you know exactly what the problem is.
Joe,
>>>>>>Kerry Cakebread <kerry@lumber.com> wrote in article
<343273D9.4B4@lumber.com>...
------------------------------
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 1156
**************************************