[13649] in Perl-Users-Digest
Perl-Users Digest, Issue: 1059 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 15 14:21:35 1999
Date: Fri, 15 Oct 1999 11:21:24 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940011683-v9-i1059@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 15 Oct 1999 Volume: 9 Number: 1059
Today's topics:
finding the oldest file and deleting that <dhiraj.verma@fmr.com>
Re: finding the oldest file and deleting that (Martien Verbruggen)
Re: finding the oldest file and deleting that <rhomberg@ife.ee.ethz.ch>
Re: finding the oldest file and deleting that <gellyfish@gellyfish.com>
Re: finding the oldest file and deleting that (Larry Rosler)
Re: finding the oldest file and deleting that (Martien Verbruggen)
Finding the PID of a process <ilya@speakeasy.org>
Re: Finding the PID of a process <jeffp@crusoe.net>
Re: Finding the PID of a process <ilya@speakeasy.org>
Re: Finding the PID of a process (Abigail)
Re: Finding the PID of a process (Dave Meyer)
Re: Finding the PID of a process <ilya@speakeasy.org>
Re: Finding the PID of a process <ilya@speakeasy.org>
Re: Finding the PID of a process (Abigail)
Re: Finding the PID of a process <occitan@esperanto.org>
Re: Finding the PID of a process (Randal L. Schwartz)
Re: Finding the PID of a process (Dave Meyer)
Re: Finding the PID of a process <ilya@speakeasy.org>
Re: Finding the PID of a process <ltl@rgsun40.viasystems.com>
Re: Finding the PID of a process (Martien Verbruggen)
flock question <scott_beck@my-deja.com>
Re: flock question <dan@tuatha.sidhe.org>
Re: flock question (M.J.T. Guy)
Re: flock question <ehpoole@ingress.com>
Re: flock question <cassell@mail.cor.epa.gov>
Focus on that field <scott@salmon.ltd.uk>
Re: Focus on that field (Michael Budash)
Re: Focus on that field (Abigail)
Re: Focus on that field (Martien Verbruggen)
Followup to SGML question (Brett W. McCoy)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Oct 1999 09:03:41 -0500
From: Dhiraj Verma <dhiraj.verma@fmr.com>
Subject: finding the oldest file and deleting that
Message-Id: <38033FBC.9EC6A6DF@fmr.com>
Hi,
How do I find the oldest file in the directory and delete that file.
Thanks
Dhiraj Verma
Fidelity Investment Systems Company
------------------------------
Date: Thu, 14 Oct 1999 06:21:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: finding the oldest file and deleting that
Message-Id: <MDeN3.3$16.787@nsw.nnrp.telstra.net>
On Tue, 12 Oct 1999 09:03:41 -0500,
Dhiraj Verma <dhiraj.verma@fmr.com> wrote:
> Hi,
> How do I find the oldest file in the directory and delete that file.
Open the directory with opendir, and check the return value.
# perldoc -f opendir
Read the directory contents with readdir, possibly filtering on the way.
# perldoc -f readdir
You could do this and capture the output in an array, and then later
process this array. You could filter and map while doing that, so that
you only have relevant data left at the end. You could set up a while
loop, and use stat on each file, and remember only the oldest one.
You of course will have to first _define_ what you mean by oldest.
I'll assume the file that has the lowest mtime.
# perldoc -f stat
Close the directory
# perldoc -f closedir
Delete the file
# perldoc -f unlink
I would normally do it a lot shorter than this (prolly with a map,
sort and grep or so), but this might be instructive:
#!/usr/local/bin/perl -w
use strict;
my $dir = '.';
my $o_fname;
# Initialise this to now, so that most files will probably be older than
# this initail value
my $o_mtime = time;
opendir(DIR, $dir) or die "Couldn't opendir $dir";
while (defined(my $fname = readdir(DIR)))
{
$fname = "$dir/$fname";
# Only do plain files
next unless -f $fname;
# use the special filehandle _, since we've already done a stat,
# just now
my $mtime = (stat _)[9];
if ($mtime < $o_mtime)
{
$o_mtime = $mtime;
$o_fname = $fname;
}
}
closedir(DIR);
print "Deleting $o_fname\n";
unlink($o_fname) or warn "Couldn't unlink $o_fname: $!";
A slightly more compact way could be to use a Schwartzian Transform:
opendir(DIR, $dir) or die "Couldn't opendir $dir";
my ($o_fname) =
map { $_->[1] }
sort { $a->[0] <=> $b->[0] }
map { (-f) ? [ (stat _)[9], $_ ] : () }
readdir(DIR);
closedir(DIR);
unlink($o_fname) or warn "Couldn't unlink $o_fname: $!";
Martien
PS. And do yourself a favour, read some documentation, and buy a good
book about Perl. Next time I might not feel like being so elaborate,
unless you;ve shown me that you have at least _tried_ something.
We're not here to write code for you, ok?
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: Thu, 14 Oct 1999 15:12:49 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: finding the oldest file and deleting that
Message-Id: <3805D6D1.F63C3CD2@ife.ee.ethz.ch>
Dhiraj Verma wrote:
>
> Hi,
> How do I find the oldest file in the directory and delete that file.
> Thanks
system('ls -1 -t | tail -1 | xargs rm -f');
- Alex
------------------------------
Date: 14 Oct 1999 15:05:40 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: finding the oldest file and deleting that
Message-Id: <3805e334_2@newsread3.dircon.co.uk>
Alex Rhomberg <rhomberg@ife.ee.ethz.ch> wrote:
> Dhiraj Verma wrote:
>>
>> Hi,
>> How do I find the oldest file in the directory and delete that file.
>> Thanks
>
> system('ls -1 -t | tail -1 | xargs rm -f');
>
I can see you never learned to delegate responsibility :
ls -l | mail -s"Please delete the oldest file" doris@gellyfish.com
/J\
--
"Most big companies don't like you very much, except hotels, airlines
and Microsoft, which don't like you at all" - Bill Bryson
------------------------------
Date: Thu, 14 Oct 1999 08:24:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: finding the oldest file and deleting that
Message-Id: <MPG.126f9582e03ffe9998a091@nntp.hpl.hp.com>
In article <MDeN3.3$16.787@nsw.nnrp.telstra.net> on Thu, 14 Oct 1999
06:21:32 GMT, Martien Verbruggen <mgjv@comdyn.com.au> says...
> On Tue, 12 Oct 1999 09:03:41 -0500,
> Dhiraj Verma <dhiraj.verma@fmr.com> wrote:
> > How do I find the oldest file in the directory and delete that file.
...
> ... You could set up a while
> loop, and use stat on each file, and remember only the oldest one.
...
> I would normally do it a lot shorter than this (prolly with a map,
> sort and grep or so), but this might be instructive:
Thereby switching from an O(N) solution to an O(N log N) solution.
Admittedly this may not matter much in most situations, but ...
<SNIP> of reasonable O(N) code
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 15 Oct 1999 00:04:04 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: finding the oldest file and deleting that
Message-Id: <UbuN3.113$Kd.2786@nsw.nnrp.telstra.net>
On Thu, 14 Oct 1999 08:24:22 -0700,
Larry Rosler <lr@hpl.hp.com> wrote:
> In article <MDeN3.3$16.787@nsw.nnrp.telstra.net> on Thu, 14 Oct 1999
> 06:21:32 GMT, Martien Verbruggen <mgjv@comdyn.com.au> says...
>
> > I would normally do it a lot shorter than this (prolly with a map,
> > sort and grep or so), but this might be instructive:
>
> Thereby switching from an O(N) solution to an O(N log N) solution.
> Admittedly this may not matter much in most situations, but ...
I still have to read the first directory where N is of a large enough
order to worry about that (:)), but you're right.
Martien
--
Martien Verbruggen |
Interactive Media Division | That's funny, that plane's dustin' crops
Commercial Dynamics Pty. Ltd. | where there ain't no crops.
NSW, Australia |
------------------------------
Date: Wed, 13 Oct 1999 03:39:51 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Finding the PID of a process
Message-Id: <s07vo7pcbhk59@corp.supernews.com>
I use the "system" command to execute a command on the OS level. I need to
know the PID so that I can kill the process if it goes bad. This is with
conjunction with Alarm command.
(After scanning the www.perl.com FAQ, I could not find the answer, apparently
the FAQ needs to be upgraded. It especially seemed like it should be found at
www.perl.com/pub/doc/manual/html/pod/perlfaq8.html.)
TIA
===========================================================================
Money, when considered as the fruit of many years' industry, as the reward
of labor, sweat and toil, is not to be sported with, or trusted to the airy
bubble of paper currency. -- Thomas Paine
===========================================================================
------------------------------
Date: Tue, 12 Oct 1999 23:53:21 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Finding the PID of a process
Message-Id: <Pine.GSO.4.10.9910122352000.14462-100000@crusoe.crusoe.net>
> I use the "system" command to execute a command on the OS level. I need to
> know the PID so that I can kill the process if it goes bad. This is with
> conjunction with Alarm command.
Hey Ilya, if it is a possibility, use open(). It does not just return
true or false, it returns the PID of the process started. But this is a
mild long shot; perhaps you need system() for its special doings.
--
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
Date: Wed, 13 Oct 1999 17:37:47 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Finding the PID of a process
Message-Id: <s09grbb7bhk60@corp.supernews.com>
Jeff Pinyan <jeffp@crusoe.net> wrote:
>> I use the "system" command to execute a command on the OS level. I need to
>> know the PID so that I can kill the process if it goes bad. This is with
>> conjunction with Alarm command.
> Hey Ilya, if it is a possibility, use open(). It does not just return true
> or false, it returns the PID of the process started. But this is a mild
> long shot; perhaps you need system() for its special doings.
How would I use open with:
$sar_output=`/bin/sar -u -f file.sar`;
===========================================================================
Money, when considered as the fruit of many years' industry, as the reward
of labor, sweat and toil, is not to be sported with, or trusted to the airy
bubble of paper currency. -- Thomas Paine
===========================================================================
------------------------------
Date: 13 Oct 1999 14:36:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Finding the PID of a process
Message-Id: <slrn809nq1.nk2.abigail@alexandra.delanet.com>
Ilya (ilya@speakeasy.org) wrote on MMCCXXXIV September MCMXCIII in
<URL:news:s09grbb7bhk60@corp.supernews.com>:
&& Jeff Pinyan <jeffp@crusoe.net> wrote:
&& >> I use the "system" command to execute a command on the OS level. I need to
&& >> know the PID so that I can kill the process if it goes bad. This is with
&& >> conjunction with Alarm command.
&&
&& > Hey Ilya, if it is a possibility, use open(). It does not just return true
&& > or false, it returns the PID of the process started. But this is a mild
&& > long shot; perhaps you need system() for its special doings.
&&
&& How would I use open with:
&&
&& $sar_output=`/bin/sar -u -f file.sar`;
$pid = open SAR, "/bin/sar -u -f file.sar |" or die $!;
{local $/; $sar_output = <SAR>}
close SAR or die $!;
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 13 Oct 1999 20:06:51 GMT
From: dmeyer@news.bellatlantic.net (Dave Meyer)
Subject: Re: Finding the PID of a process
Message-Id: <7u2oic$mbs$1@jhereg.dmeyer.org>
According to Ilya <ilya@speakeasy.org>:
> I use the "system" command to execute a command on the OS level. I need to
> know the PID so that I can kill the process if it goes bad. This is with
> conjunction with Alarm command.
Instead of using
system("mycommand");
do
my $pid=fork();
die "Could not fork: $!" unless defined($pid);
if ($pid == 0) {
# child
exec("mycommand");
# NOT REACHED (exec does not return)
}
# back in parent
waitpid($pid,0);
This basically reproduces the system() function but gives you finer
control - the pid is available and you can use combinations of waitpid
and $SIG{'CHLD'} to accomplish all sorts of interesting parallelism.
HTH.
Dave
--
David M. Meyer
dmeyer0@bellatlantic.net
--
David M. Meyer
dmeyer0@bellatlantic.net
------------------------------
Date: Wed, 13 Oct 1999 20:24:50 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Finding the PID of a process
Message-Id: <s09qkisubhk33@corp.supernews.com>
Abigail <abigail@delanet.com> wrote:
> $pid = open SAR, "/bin/sar -u -f file.sar |" or die $!;
> {local $/; $sar_output = <SAR>}
> close SAR or die $!;
You mean this wasn't in the FAQ? Amazing.
===========================================================================
Money, when considered as the fruit of many years' industry, as the reward
of labor, sweat and toil, is not to be sported with, or trusted to the airy
bubble of paper currency. -- Thomas Paine
===========================================================================
------------------------------
Date: Wed, 13 Oct 1999 21:14:13 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Finding the PID of a process
Message-Id: <s09th5asbhk63@corp.supernews.com>
Abigail <abigail@delanet.com> wrote:
> $pid = open SAR, "/bin/sar -u -f file.sar |" or die $!;
> {local $/; $sar_output = <SAR>}
> close SAR or die $!;
Cool. Thanks. I got it to work. Except that I really needed "exec /bin/sar" so
that it executes directly instead of leting shell execute it. Then I can use
the "system" command to kill the pid if it times out.
===========================================================================
Money, when considered as the fruit of many years' industry, as the reward
of labor, sweat and toil, is not to be sported with, or trusted to the airy
bubble of paper currency. -- Thomas Paine
===========================================================================
------------------------------
Date: 13 Oct 1999 16:30:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Finding the PID of a process
Message-Id: <slrn809uf9.nk2.abigail@alexandra.delanet.com>
Ilya (ilya@speakeasy.org) wrote on MMCCXXXIV September MCMXCIII in
<URL:news:s09th5asbhk63@corp.supernews.com>:
&& Abigail <abigail@delanet.com> wrote:
&&
&& > $pid = open SAR, "/bin/sar -u -f file.sar |" or die $!;
&& > {local $/; $sar_output = <SAR>}
&& > close SAR or die $!;
&&
&&
&& Cool. Thanks. I got it to work. Except that I really needed "exec /bin/sar" so
&& that it executes directly instead of leting shell execute it. Then I can use
&& the "system" command to kill the pid if it times out.
No you won't. Learn what exec does.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 13 Oct 1999 21:30:36 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Re: Finding the PID of a process
Message-Id: <7u2tls$c88$1@nnrp1.deja.com>
In article <Pine.GSO.4.10.9910122352000.14462-100000@crusoe.crusoe.net>,
japhy@pobox.com wrote:
>> I use the "system" command to execute a command on the OS level. I
>> need to know the PID so that I can kill the process if it goes bad.
>> This is with conjunction with Alarm command.
> Hey Ilya, if it is a possibility, use open(). It does not just
> return true or false, it returns the PID of the process started. But
> this is a mild long shot; perhaps you need system() for its special
exec is just like system w/o the fork, try:
$pid = fork or
exec ... or
die "dammit: $!";
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 13 Oct 1999 15:01:55 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Finding the PID of a process
Message-Id: <m1wvsqncmk.fsf@halfdome.holdit.com>
>>>>> "Dave" == Dave Meyer <dmeyer@news.bellatlantic.net> writes:
Dave> my $pid=fork();
Dave> die "Could not fork: $!" unless defined($pid);
Dave> if ($pid == 0) {
Dave> # child
Dave> exec("mycommand");
Dave> # NOT REACHED (exec does not return)
Egah! You should still put:
die "cannot exec mycommand: $!";
there. If Perl is doing the exec (the command is simple enough to not
need the shell, and "mycommand" is not found in PATH), Perl is still
running after the failed exec.
Dave> }
Dave> # back in parent
Dave> waitpid($pid,0);
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 13 Oct 1999 22:37:06 GMT
From: dmeyer@news.bellatlantic.net (Dave Meyer)
Subject: Re: Finding the PID of a process
Message-Id: <7u31c5$q83$1@jhereg.dmeyer.org>
According to Randal L. Schwartz <merlyn@stonehenge.com>:
> >>>>> "Dave" == Dave Meyer <dmeyer@news.bellatlantic.net> writes:
>
> Dave> my $pid=fork();
> Dave> die "Could not fork: $!" unless defined($pid);
> Dave> if ($pid == 0) {
> Dave> # child
> Dave> exec("mycommand");
> Dave> # NOT REACHED (exec does not return)
>
> Egah! You should still put:
>
> die "cannot exec mycommand: $!";
>
> there. If Perl is doing the exec (the command is simple enough to not
> need the shell, and "mycommand" is not found in PATH), Perl is still
> running after the failed exec.
Interesting. I used to put something like
print "exec failed: $!";
exit(1);
after execs like that, but stopped because of the irritating
"Statement unlikely to be reached" warning that you get when you run
it under -w. I just discovered that if the command immediately after
the exec is a die or exit, you don't get the warning. Cool.
Dave
--
David M. Meyer
dmeyer0@bellatlantic.net
------------------------------
Date: Thu, 14 Oct 1999 00:07:43 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Finding the PID of a process
Message-Id: <s0a7mf4nhu245@corp.supernews.com>
Abigail <abigail@delanet.com> wrote:
> && Cool. Thanks. I got it to work. Except that I really needed "exec
> /bin/sar" so && that it executes directly instead of leting shell execute
> it. Then I can use && the "system" command to kill the pid if it times out.
> No you won't.
Which means what?
I already did use it successfully.
> Learn what exec does.
Do you actually enjoy being condescending? I am just curious.
===========================================================================
Money, when considered as the fruit of many years' industry, as the reward
of labor, sweat and toil, is not to be sported with, or trusted to the airy
bubble of paper currency. -- Thomas Paine
===========================================================================
------------------------------
Date: 14 Oct 1999 00:42:50 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Finding the PID of a process
Message-Id: <7u38ua$a6i$1@rguxd.viasystems.com>
Ilya <ilya@speakeasy.org> wrote:
:>Do you actually enjoy being condescending? I am just curious.
You smell like Jempty. Is that you George? If so, you are probably
going to have to burn through yet another identity.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Thu, 14 Oct 1999 02:04:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Finding the PID of a process
Message-Id: <bTaN3.309$Bu4.5193@nsw.nnrp.telstra.net>
On 14 Oct 1999 00:42:50 GMT,
lt lindley <ltl@rgsun40.viasystems.com> wrote:
> Ilya <ilya@speakeasy.org> wrote:
> :>Do you actually enjoy being condescending? I am just curious.
>
> You smell like Jempty. Is that you George? If so, you are probably
> going to have to burn through yet another identity.
No, it isn't. This one deserved a spot in my killfile for another reason.
Martien
--
Martien Verbruggen |
Interactive Media Division | Think of the average person. Half of the
Commercial Dynamics Pty. Ltd. | people out there are dumber.
NSW, Australia |
------------------------------
Date: Wed, 13 Oct 1999 12:55:04 GMT
From: Scott Beck <scott_beck@my-deja.com>
Subject: flock question
Message-Id: <7u1vf2$k4g$1@nnrp1.deja.com>
Is there a list somewhere of which systems support flock
or do I need to do an eval on all my flock statements
for portability?
--
Thanks Much
Scott Beck
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 13 Oct 1999 14:50:48 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: flock question
Message-Id: <c%0N3.613$IZ5.15157@news.rdc1.ct.home.com>
Scott Beck <scott_beck@my-deja.com> wrote:
> Is there a list somewhere of which systems support flock
> or do I need to do an eval on all my flock statements
> for portability?
Doesn't matter which ones do--the ActiveState build (and, AFAIK, all
windows builds) will flock on WinNT but not on Win9x, but there's no
way to easily tell which one you're on. ($^O's the same on both, and
the same executable runs on both)
Eval's you're only safe option. :(
Dan
------------------------------
Date: 13 Oct 1999 15:03:09 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: flock question
Message-Id: <7u26vd$8f$1@pegasus.csx.cam.ac.uk>
In article <7u1vf2$k4g$1@nnrp1.deja.com>,
Scott Beck <scott_beck@my-deja.com> wrote:
>Is there a list somewhere of which systems support flock
>or do I need to do an eval on all my flock statements
>for portability?
perldoc perlport gives info on this. Dunno how exhaustive it is, tho'.
Also, the various entries in Config.pm may provide some insight.
But in general, it's easier to do the eval {} rather than mucking
about testing $^O or whatever. You only need to do the eval {} once
at the start of the script, and set a flag $has_flock appropriately.
Mike Guy
------------------------------
Date: Wed, 13 Oct 1999 15:14:40 -0400
From: "Ethan H. Poole" <ehpoole@ingress.com>
Subject: Re: flock question
Message-Id: <3804DA20.FD6127D5@ingress.com>
Dan Sugalski wrote:
>
> Scott Beck <scott_beck@my-deja.com> wrote:
> > Is there a list somewhere of which systems support flock
> > or do I need to do an eval on all my flock statements
> > for portability?
>
> Doesn't matter which ones do--the ActiveState build (and, AFAIK, all
> windows builds) will flock on WinNT but not on Win9x, but there's no
> way to easily tell which one you're on. ($^O's the same on both, and
> the same executable runs on both)
>
> Eval's you're only safe option. :(
You can check for $ENV{OS} eq 'Windows_NT'. The result will be true for
NT and false (likely not even defined) for Windows 9x. Whether this value
will change when NT 5.0/2000 is released is anyone's guess (probably
won't, but make sure you place a comment at the top of the code as a
reminder in the future).
--
Ethan H. Poole **** BUSINESS ****
ehpoole@ingress.com ==Interact2Day, Inc.==
(personal) http://www.interact2day.com/
------------------------------
Date: Wed, 13 Oct 1999 15:14:52 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: flock question
Message-Id: <3805045C.3622D657@mail.cor.epa.gov>
Ethan H. Poole wrote:
>
> Dan Sugalski wrote:
> >
> > Scott Beck <scott_beck@my-deja.com> wrote:
> > > Is there a list somewhere of which systems support flock
> > > or do I need to do an eval on all my flock statements
> > > for portability?
> >
> > Doesn't matter which ones do--the ActiveState build (and, AFAIK, all
> > windows builds) will flock on WinNT but not on Win9x, but there's no
> > way to easily tell which one you're on. ($^O's the same on both, and
> > the same executable runs on both)
> >
> > Eval's you're only safe option. :(
>
> You can check for $ENV{OS} eq 'Windows_NT'. The result will be true for
> NT and false (likely not even defined) for Windows 9x. Whether this value
> will change when NT 5.0/2000 is released is anyone's guess (probably
> won't, but make sure you place a comment at the top of the code as a
> reminder in the future).
I think you'll be able to rely on the Win32::IsWinNT() function
regardless. See the ActivePerl FAQ.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 14 Oct 1999 10:00:41 +0100
From: "Scott Pritchett" <scott@salmon.ltd.uk>
Subject: Focus on that field
Message-Id: <7u461c$obg$1@lure.pipex.net>
How do you place the cursor in a particular field when a form is displayed,
I'm using CGI.pm.
TIA
------------------------------
Date: Thu, 14 Oct 1999 02:33:47 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Focus on that field
Message-Id: <mbudash-1410990233470001@ppp-216-101-156-52.dialup.snrf01.pacbell.net>
In article <7u461c$obg$1@lure.pipex.net>, "Scott Pritchett"
<scott@salmon.ltd.uk> wrote:
>How do you place the cursor in a particular field when a form is displayed,
>I'm using CGI.pm.
>
>TIA
javascript is one way... try something like this:
<body ... onLoad="document.yourFormName.yourFieldName.focus();">
hth -
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 14 Oct 1999 18:44:21 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Focus on that field
Message-Id: <slrn80cqm4.cso.abigail@alexandra.delanet.com>
Scott Pritchett (scott@salmon.ltd.uk) wrote on MMCCXXXV September
MCMXCIII in <URL:news:7u461c$obg$1@lure.pipex.net>:
|| How do you place the cursor in a particular field when a form is displayed,
You take your mouse, move the mouse pointer to the desired field,
and click button 1.
|| I'm using CGI.pm.
Well, that's fine, and my cows are green.
But what has your question to do with Perl?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 15 Oct 1999 11:13:06 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Focus on that field
Message-Id: <slrn80e332.qf9.mgjv@wobbie.heliotrope.home>
On Thu, 14 Oct 1999 02:33:47 -0700,
Michael Budash <mbudash@sonic.net> wrote:
> In article <7u461c$obg$1@lure.pipex.net>, "Scott Pritchett"
> <scott@salmon.ltd.uk> wrote:
>
> >How do you place the cursor in a particular field when a form is displayed,
> >I'm using CGI.pm.
> >
> >TIA
>
> javascript is one way... try something like this:
Another way is using C and some widget library for X to write your own
browser, and to invent some extension to HTML that will do it for your
particular browser.
But what has any of that to do with Perl?
Please do not encourage people to ask questions that are totally
unrelated to Perl here. There are other groups for that.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Can't say that it is, 'cause it ain't.
NSW, Australia |
------------------------------
Date: Fri, 15 Oct 1999 14:43:03 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Followup to SGML question
Message-Id: <slrn80efjq.59d.bmccoy@moebius.foiservices.com>
Thanks to the folks (Tad, Bennett, Randal) who helped me on my SGML
parsing question a couple days ago. Further investigation into the
standards group that developed the DTD for the data led me to some
documentation on the FDA website that had, lo and behold! some example
*Perl scripts* for extracting the data and getting it into an SQL schema.
Whoohoo! I think I hit the jackpot!
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 1059
**************************************