[12894] in Perl-Users-Digest
Perl-Users Digest, Issue: 304 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 29 23:07:18 1999
Date: Thu, 29 Jul 1999 20:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 29 Jul 1999 Volume: 9 Number: 304
Today's topics:
Breaking things into modules <hal_mounce@amdahl.com>
Cookies and CGI::Cookie fwallace@thevm.com
Re: Cookies and CGI::Cookie (Martien Verbruggen)
Re: Creating dynamic GIF-s from CGI-script (brian d foy)
Re: Easy way to emulate Unix's "sort" command? (Tad McClellan)
finding http-redirection <gehring@politik.uni-mainz.de>
Re: finding http-redirection (Martien Verbruggen)
Re: How to read the submit button as a name or value (brian d foy)
Re: How to trim a String (Tad McClellan)
Re: is process still running? (Martien Verbruggen)
Re: Modules for Dummies (brian d foy)
Re: Modules for Dummies <tchrist@mox.perl.com>
Re: OOP question. <coljac@home.com>
Re: Outputting a HTTP Header (Martien Verbruggen)
Re: Perl with oracle questions ... (Martien Verbruggen)
PerlApp freestanding exe fails with File:Copy (David Tucker)
Re: POSIX win NT (Martien Verbruggen)
Re: Split is coming Back False?!? (Martien Verbruggen)
system function broken - ActivePerl - build 517 or 518 (Michael Allan)
Re: Using a timer on flock wgd@adelaide.on.net
Wellington NZ Perl Mongers davem@web.co.nz
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 29 Jul 1999 17:11:15 -0700
From: Hal Mounce <hal_mounce@amdahl.com>
Subject: Breaking things into modules
Message-Id: <37A0EDA3.E1168145@amdahl.com>
I have a chunk of perl code which has gotten too big to manage. I broke
it up into half a dozen subroutines to handle the scut work, and a
screen or so of mainline code that maps out what I want to do.
Everything is in package main, and is all in the same file.
Now I want to code my first module. At least, I think that's what I
want to do. I know I'll want to reuse, pretty much verbatim, about half
of the subroutines I've written. I don't however, want to make a
federal case out of things. I just want to be able to stash each
subroutine into a separate file under a directory somewhere.
So, I read up on things, and everything (the FAQ, Came, Panther,
Cookbook, Effective Perl) seems to say that modules are the way to go.
Libraries are out of favor.
I've been a couple of days now trying to modularize just one
subroutine. Should this be hard? (One prior strike: I'm new to unix
as well as to perl. What the hell is a "make" file anyway...?) I used
h2xs as described in Effective Perl. (Great book, BTW)
I seem to be having trouble in three areas. Perhaps someone could buy
me a vowel:
Area 1)
Although I'm the admin for all the systems I want to use, I don't want
to integrate my scripts into the perl installation. I'd like to keep
everything off of /home/hal/perlstuff someplace, and be able to tar
everything under /home/hal up and squirt it onto different machines.
All of the doc I've read has a blurb about you can do this if you want
to, but I can't seem to pull it off. I tried use lib
"/home/hal/perlstuff/MyModules"; with use MyModules::Module; (I put
&mysub in @EXPORT) but I can't seem to get the incantation just
right. (I tried @EXPORT = "mysub" as well.)
Does anyone know of something I could model off of out on CPAN
somewhere? I nosed around, but didn't spot anything between "hack and
slash" and "software engineering." I'd like to see a perl script that
counts on some modules in a local library? I think I could get it right
if I could watch somebody else do it first.
Area 2)
Do I really need all that directory hierarchy just to put a subroutine
in its own file? My script is in /home/hal/perl, but now my subroutine
is down in /home/hal/perl/MyModules/Module/blib/lib/MyModules/Module.
Or is that the "real" Module.pm?
My intent was to put each subroutine in its own file, so as to be easy
to reach, yet out of the way when I was busy editing the mainline code.
What does one normally do? One subroutine per module? One module with
all of ones subroutines?
Area 3)
I have (so far) one global called $diag which I set in the mainline, and
use everywhere, like so: print "DIAG: We're here and x is $x\n" if
$diag; I did a use vars($diag); in package MyModules::Module, but
that doesn't seem to drag $diag in from package main. Am I in the weeds
here? Again, a (well written) application to model off of might help.
I was thinking of picking up Learning Perl, but it looks like I'm about
to the point where Learning Perl drops off. How about Programmer's
Companion?
Oh, and one more thing...
Is it truly evil to use a library? It's very tempting to throw each
subroutine into a flat file and just require everything in. I don't
want vinyl siding, but I don't want to sand everything down to bare wood
either.
--Hal
------------------------------
Date: Fri, 30 Jul 1999 01:44:07 GMT
From: fwallace@thevm.com
Subject: Cookies and CGI::Cookie
Message-Id: <7nr015$i7r$1@nnrp1.deja.com>
Hi all -
I have a *MAJOR* problem with Cookies and the CGI::Cookie module.
I have gone through the documentation, the O'Reilly Perl Cookboon,
numerous other sources and it seems that cookie setting and recovery is
not very well documented (in comparison with other parts of Perl
Modules).
I am using Perl 5.xxx, and have the following code:
----------
#!/usr/bin/perl
use CGI qw/:standard/;
use CGI::Cookie;
$dIMAGE = "IMG" . $b;
$cookieIMG . $b = new CGI::Cookie(-name => $dIMAGE, -value =>
$localImge[$j] );
----------
Perl compiler complains that it -- >
Can't modify concatenation in scalar assignment at script line 52, near
");"
When I check with the -w flag.
I'm hoping that someone can point out what must be an obvious error
here.
$b is a random number between 1 and 1000; I am trying to set all form
output (which I have successfully captured) into cookies so I can
capture Shopping Cart type info on the client side.
I'd rather not muck about with hidden forms and framesets but If
cookies cannot be set/recovered without great heartache then it seems I
must. I was close to a solution yesterday, but for some reason the CGI
script would only receive the LAST 4 cookies (so I am a bit frustrated
right now).
If anyone can give me pointers I'd appreciate it, and would be happy to
post an summary of my experience and any successful approach [I'm
building a "Shopping Cart" where users can select up to 1000 items with
5 name=value pairs].
TIA!
Floyd Wallace
fwallace@thevm.com
f_wallace@hotmail.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 30 Jul 1999 02:30:33 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Cookies and CGI::Cookie
Message-Id: <d78o3.86$g91.7238@nsw.nnrp.telstra.net>
In article <7nr015$i7r$1@nnrp1.deja.com>,
fwallace@thevm.com writes:
> Hi all -
>
> I have a *MAJOR* problem with Cookies and the CGI::Cookie module.
No, you don't. You have a problem with perl syntax.
> I have gone through the documentation, the O'Reilly Perl Cookboon,
> numerous other sources and it seems that cookie setting and recovery is
> not very well documented (in comparison with other parts of Perl
> Modules).
Well... Cookies don't really have anything to do with perl. They're a
HTTP specific thing, and not even that standard. But that is not
related to your problem
> I am using Perl 5.xxx, and have the following code:
Do you realise that the .xxx part there is very important? Unlike
Billware that increases its major version number on every bug fix,
perl's versioning is a bit less marketing driven. There are major
differences between 5.001 and 5.005. There are even major differences
between 5.004_04 and 5.005.
> $cookieIMG . $b = new CGI::Cookie(-name => $dIMAGE, -value =>
> Can't modify concatenation in scalar assignment at script line 52, near
> ");"
Perl's concatenation operator is '.'. You are concatenating, and then
assigning to a concatenation of two variables. Perl will not allow
that.
> $b is a random number between 1 and 1000; I am trying to set all form
> output (which I have successfully captured) into cookies so I can
> capture Shopping Cart type info on the client side.
Are you trying to assign to a variable with a random name? Why?
Unless you know what you are doing there, you should be putting this
stuff in a hash.
This topic actually comes up at least a few times a week on this
group, and always gets answered the same way. Search dejanews for
references.
Martien
--
Martien Verbruggen |
Interactive Media Division | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd. | but mean your mother.
NSW, Australia |
------------------------------
Date: Thu, 29 Jul 1999 21:15:55 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Creating dynamic GIF-s from CGI-script
Message-Id: <brian-ya02408000R2907992115550001@news.panix.com>
In article <7nqs2p$mm7$1@ocean.cup.hp.com>, "Ron Savage" <ron_savage@non-hp-australia-om5.om.hp.com> posted:
> brian exaggerates. Its 430 lines, not thousands. However, he's right in
> urging you to use a module. That way the code is reusable more easily. And
> anywhere on your web site you can install a script, you can install a module
> (hint, hint).
what's 430 lines? just the GIF library? now you need a lot more lines
of code to actually make those functions work together in a way that
produces the images that you want. GIFgraph::axestype, for instance,
is about 1200 lines. that, of course, is built on top of GD, and is
only the base class for the other graph types.
i was not exxaggerating. you're just not including the full task in
your answer.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Thu, 29 Jul 1999 16:27:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Easy way to emulate Unix's "sort" command?
Message-Id: <lfdqn7.eoq.ln@magna.metronet.com>
Jim Hutchison (jimhutchison@metronet.ca) wrote:
: On 28 Jul 1999 20:04:13 -0000, Jonathan Stowe
: <gellyfish@gellyfish.com> wrote:
: >On Wed, 28 Jul 1999 18:38:53 GMT Jim Hutchison wrote:
: >> Newbie question here...
: >>
: >> I'd like to sort a four-column table on a specific field. Perl's sort
: >> is only for a simple list...
: >
: >I would read the article entitled :
: >
: > =head2 How do I sort an array by (anything)?
: >
: >in perlfaq4. Of course after you have read that and possibly still
: >have difficulties please feel free to ask again.
: Thanks Jonathan. As I'm still digesting the basics, the FAQ wasn't
: clear on how to do a simple numeric sort on, say, the 3rd column of a
: multi-column table.
: Their example was for "the first word after the first number"... I
: don't know perl enough yet to be creative, so it's not clear to me how
: to change the script to sort on another column.
@sorted = map { $_->[0] }
sort { $a->[1] cmp $b->[1] }
map { [ $_, uc((/\d+\s*(\S+)/ )[0] ] } @data;
^^^^^^^^^^^^^^^^^^^^^^
There is the part that isolates the "the first word after the
first number".
So all you need to do is to excise that, and replace it with
some Perl code that isolates the "3rd column" instead.
(split /\t/, $_)[2]
That should grab the 3rd column (assuming they are TAB separated).
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 30 Jul 1999 03:47:38 +0200
From: "Uwe W. Gehring" <gehring@politik.uni-mainz.de>
Subject: finding http-redirection
Message-Id: <37A1043A.EB7A0966@politik.uni-mainz.de>
Hi,
I like to query some domains to find their ips, look if they are
reachable, to whom they belong (whois), and finally, if the domain is
redirected. For example: www.foo.com is actually redirected to
www.bar.com/gnu/gnats/. How can I find out that by simply putting
"www.foo.com" into my perl script? (Or is there a system program
instead?)
TIA
------------------------------
Date: Fri, 30 Jul 1999 02:17:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: finding http-redirection
Message-Id: <CW7o3.81$g91.7238@nsw.nnrp.telstra.net>
In article <37A1043A.EB7A0966@politik.uni-mainz.de>,
"Uwe W. Gehring" <gehring@politik.uni-mainz.de> writes:
> Hi,
>
> I like to query some domains to find their ips, look if they are
Hmmm... domains don't really have ip addresses. They have name servers
however. The Net::DNS module might be helpful here.
> reachable, to whom they belong (whois), and finally, if the domain is
my @response = qx( 'whois', @options );
Be aware that not all domains are registered at the same spot.
> redirected. For example: www.foo.com is actually redirected to
> www.bar.com/gnu/gnats/. How can I find out that by simply putting
That is not a domain, that is a single ip address, or potentially a
number of ip addresses when they're load balancing.
use LWP::UserAgent, make a request, and see what comes back.
Martien
--
Martien Verbruggen |
Interactive Media Division | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Thu, 29 Jul 1999 21:18:11 -0400
From: brian@pm.org (brian d foy)
Subject: Re: How to read the submit button as a name or value
Message-Id: <brian-ya02408000R2907992118110001@news.panix.com>
In article <Tb6o3.41439$jl.29705745@newscontent-01.sprint.ca>, "Vox" <v0xman@yahoo.com> posted:
> On my page I have more than one submit button with different names and
> values ...
>
> how can do I get perl to read the input below?
>
> <input type=submit name="answer" value="Yes">
> <input type=submit name="answer" value="No">
> <input type=submit name="cancel" value="Cancel">
>
> I've seen this in other places but don't know how to implement it myself.
use CGI;
there, it's all done, and you can get on with your program.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Thu, 29 Jul 1999 16:34:04 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: How to trim a String
Message-Id: <srdqn7.uoq.ln@magna.metronet.com>
Faisal Nasim (swiftkid@bigfoot.com) wrote:
: : : sub trim
: : : {
: : : ( local $_ = shift ) =~ s/\s+|\s+$//gs;
^^^
: : : $_
: : : }
: :
: : I don't think that does what you think it does (unless you have a
: : different definition of what it means to trim a string).
: I thought trim means removing space from left and right...
Then you gave him buggy code (you are missing an anchor).
: but you are right, he asked, how to remove all spaces... :)
Then you didn't give him buggy code.
:-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 30 Jul 1999 02:58:15 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: is process still running?
Message-Id: <bx8o3.95$g91.7238@nsw.nnrp.telstra.net>
In article <7nq361$t7n$1@nnrp1.deja.com>,
mrduane@my-deja.com writes:
> Is there a function call available that can tell me if a UNIX process is
> still running, given that I have the pid?
Yes, kill will, but it's not a perl question. The perl kill just calls
the systems' kill. It's really a question about unix, and a usenet
group that talks about unix programming would have been more
appropriate.
# perldoc -f kill
[snip]
See L<perlipc/"Signals"> for details.
# perldoc perlipc
[snip]
Another interesting signal to send is signal number zero.
This doesn't actually affect another process, but instead
checks whether it's alive or has changed its UID.
[snip]
Martien
--
Martien Verbruggen |
Interactive Media Division | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use being
NSW, Australia | a damn fool about it.
------------------------------
Date: Thu, 29 Jul 1999 21:17:10 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Modules for Dummies
Message-Id: <brian-ya02408000R2907992117100001@news.panix.com>
In article <7nqpq2$ata@journal.concentric.net>, "Warren Bell" <warish@concentric.net> posted:
> I would like to learn how I can use modules in my programs. I am finding it
> hard to understand. I have read the perlmod pages and I am still lost.
>
> Any good books on the subject?
the module documentation in best. every module should have included
documentation that has a SYNOPSIS section that shows you how to use
that particular module.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: 29 Jul 1999 19:09:15 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Modules for Dummies
Message-Id: <37a0fb3b@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Warren Bell" <warish@concentric.net> writes:
:I have very limited programing knowledge. I don't want to learn how to write
:a module, I just would like to take advantage of them.
Then here's your answer
#!/usr/bin/perl
use Pick_Some_Module_Name_Here;
--tom
--
"Just because you're screwed *up* doesn't mean you're screwed." --Larry Wall
------------------------------
Date: Fri, 30 Jul 1999 01:52:37 GMT
From: Colin Jacobs <coljac@home.com>
Subject: Re: OOP question.
Message-Id: <37A10668.CAA29008@home.com>
Hmm... My original question had more to it than I thought, and the
responses have been very illumunating. Thanks, folks.
For those who are interested, the original question was from "Perl 5
Interactive Course" by Jon Orwant. The problem follows:
'Create four classes: Candy, Gum, Lollipop and Blowpop. Gum and Lollipop
should inherit from Candy; Blowpop should inherit from both Lollipop and
Gum, in that order. All Blowpop objects should contain a variable called
"name". If "name" is "Owl", the order of the @ISA array should be
reversed: Blowpop should inherit from Gum first.'
(And no, this is private self-betterment, not homework ;)
I interpreted this to mean, if a particular Blowpop should have name eq
"Owl" then for that object, the inheritance is reversed. Given that the
question was invented by Mr Orwant, and that it was labelled "medium"
difficulty (the moderate and hard were quite doable) I asssumed there
must be a simple mechanism I was unaware of.
After reading the previous posts, I got brave and had a go myself using
a slightly different approach. I made the class C inherit from only one
helper class which contains only an AUTOLOAD method which in turn
inherits from the right classes depending on the object passed to it.
Thus although C doesn't inherit *directly* from the two classes, it does
still inherit from them. This also seems to eliminate an objection to a
previous solution, namely:
DC> And what if it calls SUPER::method? Then you're stuck with C's
default
DC> inheritance, unless you do the local @ISA trick in every explicit
DC> method as well :-(
Since C's default inheritance is only the helper class, the Right Thing
seems to happen.
-- begin code
#!/usr/bin/perl
package Gum;
sub eat { print "Mmm, chewy!\n"; }
package Lollipop;
sub eat { print "*lick*\n"; }
package Lollipop_Gum;
sub AUTOLOAD {
my ($self, @args) = @_;
my $subname = $AUTOLOAD;
$subname =~ s/.*:+//;
@ISA = ($self->{name} eq "Owl")?qw(Gum Lollipop):qw(Lollipop Gum);
$sub = "SUPER::".$subname;
$self->$sub(@args);
undef(@ISA); # pesky cache :)
}
package Blowpop;
@ISA = qw(Lollipop_Gum);
sub new {
my $class = shift;
my $self = {};
if($name = shift) { $self->{name} = $name; }
bless $self, $class;
}
package main;
$notOwl = new Blowpop("Bob");
$owl = new Blowpop("Owl");
$notOwl->eat; # Acts like a Lollipop
$owl->eat; # Acts like a Gum
-- end code
Once again the ugly AUTOLOAD is used, so it's not really code you'd want
to use until quantum computers are the price of an iMac. I realise I'm
still a Perl OOP newbie, so if I made a hideous logical mistake, please
let me know.
By the way, I knew Damian was an Aussie since he taught me C in
first-year Comp. Sci at Monash. Even though I'm in California my Uni
days are still haunting me. :)
Thanks again.
Colin
--
------------
Colin Jacobs col@earthling.net
http://colspace.dhs.org
------------------------------
Date: Fri, 30 Jul 1999 02:36:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Outputting a HTTP Header
Message-Id: <Dc8o3.88$g91.7238@nsw.nnrp.telstra.net>
In article <jn3o3.941$IE.19784@typ21b.nn.bcandid.com>,
"news.mdo.net" <norris@mdo.net> writes:
> Hi all,
> I am trying to figure out how to redirect to a document that is in a
> password protected directory on NT system without giving that
> login/password information to the user.
I doubt it very much, but if there is such a way, it is not a perl
way, but a HTTP way. Ask in a more appropriate group in
comp.infosystems.www.* somewhere, and you will very likely get a
correct and full answer.
Instead of redirecting, you could of course act as a proxy, and fetch
the document yourself (with something like LWP::UserAgent) and send
the output to the connected client.
Martien
--
Martien Verbruggen |
Interactive Media Division | You can't have everything, where would
Commercial Dynamics Pty. Ltd. | you put it?
NSW, Australia |
------------------------------
Date: Fri, 30 Jul 1999 02:45:51 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl with oracle questions ...
Message-Id: <zl8o3.90$g91.7238@nsw.nnrp.telstra.net>
In article <Pine.GSO.3.96.990729120657.17252F-100000@jlequang-ss20.cisco.com>,
Praveen Mohan <praveenm@cisco.com> writes:
> 1> Which Oracle 8.0 libraries must be available for a perl script to work?
None whatsoever. My perl works fine without any Oracle software or libraries.
> 2> Are they already linked into the oraperl module or are they shared?
Dunno. What does the documentation of Oraperl say?
> Thanx in advance,
Sure.
Martien
--
Martien Verbruggen |
Interactive Media Division | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd. | crops where there ain't no crops.
NSW, Australia |
------------------------------
Date: 30 Jul 1999 02:21:12 GMT
From: david@temss2.main.temple.edu (David Tucker)
Subject: PerlApp freestanding exe fails with File:Copy
Message-Id: <7nr26o$o0f$1@cronkite.ocis.temple.edu>
------------------------------
Date: Fri, 30 Jul 1999 02:41:56 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: POSIX win NT
Message-Id: <Uh8o3.89$g91.7238@nsw.nnrp.telstra.net>
In article <933280327.58180@storm.tngi.com>,
"news.tngi.com" <eugene@iescrow.com> writes:
> IF anybody knows where to gete POSIX perl module for WinNT
If it doesn't come with the standard ActiveState installation of perl,
then I doubt very much that you will find it anywhere.
A quick look at the documentation at www.activestate.com shows me that
that version of perl has POSIX.
> and how to use
> it
That is explained in the documentation, and I just mentioned where
there is at least one copy. When installing perl, another copy should
have been installed on your disk.
#!/usr/local/bin/perl -w
use strict;
use POSIX;
> please email me at eugene@iescrow.com , or site@bastion.net .
Not a chance. Post here, read here.
Martien
--
Martien Verbruggen |
Interactive Media Division | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd. | but mean your mother.
NSW, Australia |
------------------------------
Date: Fri, 30 Jul 1999 03:03:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Split is coming Back False?!?
Message-Id: <4C8o3.97$g91.7238@nsw.nnrp.telstra.net>
In article <19990729123122.07000.00000307@ng-ch1.aol.com>,
mesarchm@aol.com (Mesarchm) writes:
After decently formatting the request, it reads:
> For some reason my split function is not updating. I am getting the
"Your" split function?
> error "No such file or directory". The split function works 25% of
> the time, but the other 75% I get the error. Why would split be
> returning false (or zero). Here is the code. Any help would be
> appreciated. Thanks, Mike
>
> open(FILE,"$readdir\\$file") ||
> print ERROR "couldn't open $readdir\\$file $!";
Instead of print, you should use die. It really doesn't make sense to
go on here, does it?
> while ($line=<FILE>)
> {splitit($line) || print ERROR "$!\n";}
Soooo... Where is the code for splitit?
> close(FILE) || print ERROR "couldn't close $file $!";
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Fri, 30 Jul 1999 02:20:36 GMT
From: mike@zelea.com (Michael Allan)
Subject: system function broken - ActivePerl - build 517 or 518
Message-Id: <MPG.120ad29146467ca598968e@news1.on.sympatico.ca>
Request for confirmation of bug in build 517 or 518 of ActivePerl for
Win32:
Applications fail to launch properly from a system function call under
build 518. For example, the following simple program, which worked in
build 516, is broken under 518.
use diagnostics;
use strict;
print system 'CALC.EXE';
print $!;
Under 516, this launches the Nindows calculator application (if its on
the path) but under 518, no calculator appears on the screen. (517 was
not tested.)
System calls with other arguments are similarly broken. No windows appear
on screen. The target registers as a process under Task Manager, but does
not open its main window (if it's an application) and does not show up on
the task bar. When the process is somehow terminated, the system function
returns 256.
The exec function does not exhibit this bug.
Seen under NT 4.0, SP5, on 3 separate machines: Pentium II (128M), AMD
K6-2 (128M), and 80x486 (40M).
Can anyone confirm this bug? ActiveState's bug database can't easily be
searched, and I don't know what's been posted there.
--
Mike Allan
------------------------------
Date: Fri, 30 Jul 1999 02:22:49 GMT
From: wgd@adelaide.on.net
Subject: Re: Using a timer on flock
Message-Id: <7nr29i$jhr$1@nnrp1.deja.com>
I'm sorry, I should have mentioned that this will be used in a CGI
context. The file to be locked is a database to be read and written from
(of course).
Alex.
In article <7np2lj$8dc$1@nnrp1.deja.com>,
wgd@adelaide.on.net wrote:
> Hi everyone,
>
> I've been researching the file locking issue and I have a question
> about setting up a timer to wait for a file to be unlocked.
>
> I read at the "Perl + Perl/CGI Mini FAQ", operated by Bekman Stas that
> you can use this sort of solution:
>
> $timeout=20; # in seconds
> while (-e $lock_file && (stat($lock_file))[9]+$timeout>time)
> { sleep(1);}
>
> However in Tom Christiansen's post, he says:
>
> "Never use the existence of a file C<-e $file> as a locking indication,
> because there is a race condition between the test for the existence of
> the file and its creation."
>
> So as a newbie, I ask how can you tell if a file is locked without
> using the -e indicator?
>
> Thanks in advance,
>
> Alex.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 30 Jul 1999 01:57:11 GMT
From: davem@web.co.nz
Subject: Wellington NZ Perl Mongers
Message-Id: <7nr0pj$imt$1@nnrp1.deja.com>
We are planning an initial meeting to set up a Wellington Perl Mongers
group. The meeting will be held on
Wednesday, 8 September 1999 at 5:30 PM
at
The Web Limited
Level 8, 86 Lambton Quay
Wellington
Our guest speaker will be Grant McLean, who will have just returned
from the Perl Conference in Monterey.
For more information, point your browser to http://pm.web.co.nz/
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 304
*************************************