[17311] in Perl-Users-Digest
Perl-Users Digest, Issue: 4733 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 26 14:05:45 2000
Date: Thu, 26 Oct 2000 11:05:16 -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: <972583515-v9-i4733@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 26 Oct 2000 Volume: 9 Number: 4733
Today's topics:
Re: ActivePerl under Windoze 98 <camerond@mail.uca.edu>
Re: ActivePerl under Windoze 98 <camerond@mail.uca.edu>
BerkeleyDB install problem <zfido88@zr.ru>
Re: bidirectional communication (David Efflandt)
Big zip files handling (Jean-Marc)
Re: Big zip files handling <newsposter@cthulhu.demon.nl>
Re: Big zip files handling (Camille Sauvage)
Re: can hex crash my script? <xerxes_2k@my-deja.com>
Re: can hex crash my script? <ddunham@redwood.taos.com>
Changing a User's P/W on Win2K through browser <Roland@psychenet.co.uk>
Clean POST strings <r.fraser@student.murdoch.edu.au>
Re: complex (for me anyway) rexexp <brondsem@my-deja.com>
Re: complex (for me anyway) rexexp <brondsem@my-deja.com>
Re: complex (for me anyway) rexexp <brondsem@my-deja.com>
Re: concatenation txt files in one file <jeff@vpservices.com>
Re: Confused about behavior of sort command with functi <abe@ztreet.demon.nl>
Re: Confused about behavior of sort command with functi <ren.maddox@tivoli.com>
Re: emulating flock <themoriman@ntlworld.com>
Re: emulating flock (Randal L. Schwartz)
Re: emulating flock <ddunham@redwood.taos.com>
Form CGI help please <r.fraser@student.murdoch.edu.au>
Re: Form CGI help please <dsimonis@fiderus.com>
Re: Form CGI help please <tward10@jaguar.com>
Re: Form CGI help please nobull@mail.com
Re: help with system () <ren.maddox@tivoli.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Oct 2000 10:11:30 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: ActivePerl under Windoze 98
Message-Id: <39F849A2.DD57DA89@mail.uca.edu>
schnurmann@my-deja.com wrote:
>
> My Windoze 98 machine cannot use ppm to install, but another NT machine
> around here, running the same version of ActivePerl can. i think it is
> related to my being on Darwin, but I am not sure.
What is Darwin? A firewall or something? If you download the zipped
module from ActiveState (http://www.ActiveState.com/PPMPackages/zips/)
to your hard drive, you can PPM it from there on Win98 machine - read
the README. If the module is not available for your version/build, as Ed
said, and you have done, download and do it manually. I don't know where
Makefile.pl could be going wrong, I have been lucky enough as yet to
only need modules available as PPM or Perl-only ones, where I don't have
to go through all the manual steps.
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Thu, 26 Oct 2000 10:14:52 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: ActivePerl under Windoze 98
Message-Id: <39F84A6C.27D91700@mail.uca.edu>
schnurmann@my-deja.com wrote:
>
> Well, we can start here: DBI-1.14.
This one seems to be at AS. Why not just download, unzip, and PPM
locally?
What problems does it give you doing it that way?
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Thu, 26 Oct 2000 19:39:28 +0400
From: "Roman Chumakov" <zfido88@zr.ru>
Subject: BerkeleyDB install problem
Message-Id: <8t9j75$p5u$1@news.sovam.com>
FreeBSD-4.1.1
After installation of db-3.1.17 from ports collection
(/usr/ports/databases/db3)
I try to install perl module BerkeleyDB for accessing db3 from perl
language.
But the installation fails :(
I have:
wwwu# pwd
/usr/ports/databases/db3/work/db-3.1.17/perl.BerkeleyDB
wwwu# perl Makefile.PL
Parsing config.in...
Looks Good.
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -ldb
Writing Makefile for BerkeleyDB
wwwu#
Here is strange sting for me:
Note (probably harmless): No library found for -ldb
May be this is a clue?
So, when I do "make install" I get many errors.
Last string of output is:
BerkeleyDB.xs:3601: `DB_NEXT' undeclared (first use in this function)
BerkeleyDB.xs:3604: `DB_NOTFOUND' undeclared (first use in this function)
BerkeleyDB.xs:3605: structure has no member named `cursor'
BerkeleyDB.xs:3605: structure has no member named `cursor'
BerkeleyDB.xs:3606: structure has no member named `cursor'
BerkeleyDB.xs: In function `boot_BerkeleyDB':
BerkeleyDB.xs:3634: `DB_VERSION_MAJOR' undeclared (first use in this
function)
BerkeleyDB.xs:3635: `DB_VERSION_MINOR' undeclared (first use in this
function)
BerkeleyDB.xs:3635: `DB_VERSION_PATCH' undeclared (first use in this
function)
BerkeleyDB.xs:3651: `db_recno_t' undeclared (first use in this function)
BerkeleyDB.xs:3652: structure has no member named `flags'
*** Error code 1
Stop in /usr/ports/databases/db3/work/db-3.1.17/perl.BerkeleyDB.
wwwu#
May be somebody can help me please?
And does message "Note (probably harmless): No library found for -ldb" mean?
Thank you alot in advance,
Roman
------------------------------
Date: Thu, 26 Oct 2000 17:10:17 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: bidirectional communication
Message-Id: <slrn8vgpbm.7fh.efflandt@efflandt.xnet.com>
On Thu, 26 Oct 2000, AndreasKleiner <AndreasKleiner@compuserve.de> wrote:
>Hello all,
>
>I have a C-program which takes multi-line input and produces multi-line
>output. I have to run it in the background - as it compiles some info
>into the memory which takes some seconds - and now and then feed it with
>input and read and interpret the output - with some perl-skript of
>course.
>
>Under which headwords do I have to look for a solution:
>
>IPC::Open2
>
>Pipes
>
>fork
>
>other ?
Those and others are discussed in: perldoc perlipc
Two other methods to communicate with disconnected programs are sockets
and fifo (pipe that works like a file).
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: 26 Oct 2000 15:13:31 GMT
From: jmgeindre@ifrance.com (Jean-Marc)
Subject: Big zip files handling
Message-Id: <8FD9AF276Geindre@194.149.160.37>
Hi, I need to process huge log files with a Perl program. The size is about
1Gb of compressed data. The structure is :
1 Gb of compressed data inside a zip file
inside this huge file, I have 5 log files of 800 Mb size.
When I try a command like "unzip -p MyLogarchive.zip | more" it works and
it even works with grep (after the pipe) .
But when I pipe it to a Perl script that reads (and rewrite with no
computing) from the std input. It remains swapping for telling me that it
will stop because running out of memory.
I just want to find a technique where I can read the data line after line
and process it as is instead of reading everything and piping the huge
block on my poor script.
I've read that IO::Zlib could do as I liked but it does not seem to suit.
If someone has got a script to do so or the name of a module, I would be
eternally thankfull ;-)
Thank you in advance
--
Jean-Marc
------------------------------
Date: 26 Oct 2000 15:55:25 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Big zip files handling
Message-Id: <8t9k5d$f14$1@internal-news.uu.net>
In comp.lang.perl.misc Jean-Marc <jmgeindre@ifrance.com> wrote:
> When I try a command like "unzip -p MyLogarchive.zip | more" it works and
> it even works with grep (after the pipe) .
> But when I pipe it to a Perl script that reads (and rewrite with no
> computing) from the std input. It remains swapping for telling me that it
> will stop because running out of memory.
Sound as if your perl script does not process its input line by line,
or keeps every line it reads in memory, but without seeing your code
it's hard to tell.
Erik
------------------------------
Date: 26 Oct 2000 16:55:32 GMT
From: camille@fortunecity.fr (Camille Sauvage)
Subject: Re: Big zip files handling
Message-Id: <8FD9CDF52csauvagebigfotcom@194.149.160.37>
>Sound as if your perl script does not process its input line by line,
>or keeps every line it reads in memory, but without seeing your code
>it's hard to tell.
Yes perfectly right, and that's precisely what I'm trying to change. When I
make for exemple :
open IN, "-";
while (<IN>) {
nop
}
It is supposed to read on line after the other. It works (or seems to) when
I proceed 10 Mb compressed files, but when I attack the 1 Gb, out of memory
error !
>In comp.lang.perl.misc Jean-Marc <jmgeindre@ifrance.com> wrote:
>
>> When I try a command like "unzip -p MyLogarchive.zip | more" it works
>> and it even works with grep (after the pipe) .
>> But when I pipe it to a Perl script that reads (and rewrite with no
>> computing) from the std input. It remains swapping for telling me that
>> it will stop because running out of memory.
>
>
>Erik
>
------------------------------
Date: Thu, 26 Oct 2000 15:58:15 GMT
From: arse <xerxes_2k@my-deja.com>
Subject: Re: can hex crash my script?
Message-Id: <8t9kaj$lk7$1@nnrp1.deja.com>
"Godzilla!" wrote:
> Why don't you simply test this and discover? Duh?
i have been, and havent discovered anything. which is why i put it to
the forum.thinking that maybe someone else may know of a case where a
control code or somthing can crash scripts.
But of course theres always gonna be a clever dick who cant answer the
question but can try his/her hardest to be funny (and fail miserably).
--
[][][]{}{}~~';:.<<//?|1¬!"£$$%^^&*(())__+/*+
oooh random characters i must be coool!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 26 Oct 2000 17:55:30 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: can hex crash my script?
Message-Id: <me_J5.94$qs6.35612@news.pacbell.net>
arse <xerxes_2k@my-deja.com> wrote:
> on my latest script, if details are entered incorrectly, the script
> prints out all the details, into an array for the javascript to then put
> it back into the correct boxes on the form. a side efect of this is that
> if in one of the boxes i entered
> some really boring text\nyup
> when and an error in another field. this would then come back out to the
> browser ok.but then when JS puts it in the box it comes out like this:
> some really boring text
> yup
> anyway that was all the crappy background.what i want to know is is
> there anyway of crashing/cuasing faal errors on the script by entering ,
> for instance hex chars' in the form of \x22.
I'm afraid it depends on the script and what you do with the data.
Perl itself shouldn't have any problems dealing with binary data.
If this is a CGI script, you should already be using tainting and doing
excessive checking of all input data, with paranoia set appropriately
depending on what you're doing.
If you're printing it, well, what are they going to do? I guess they
could imbed <blink>codes to make their name look kew1</blink>.
Potentially they could crash the browser by sending some sort of
character/binary sequence. You can print "\rm -rf /" all day long and
it doesn't become dangerous.
If you're going to open a file based on the input, I'd be running
through a filter to make sure it had nothing other than characters I
expected in a format and size I expect. The system is starting to
operate on your behalf, so be careful.
If you're going to run an external program based on user data, then I'd
wonder why, and would expect that yes, it could crash something.
While all of these examples could diminish the experience of the user
(It crashed!), none of them should be construed as "hex causing perl to
crash". Hex (or other data) could cause your program to do unexpected
things.
--
Darren Dunham ddunham@taos.com
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< Please move on, ...nothing to see here, please disperse >
------------------------------
Date: Thu, 26 Oct 2000 16:17:50 +0100
From: "Roland Corbet" <Roland@psychenet.co.uk>
Subject: Changing a User's P/W on Win2K through browser
Message-Id: <39f84a83@news.myratech.net>
Does anyone know if it's possible to write a script that can be used to
change a user's NT password, under Windows 2000. The server is Win2K
Advanced server, running the latest version of Active Perl.
Maybe the script would need to log on as administrator, and change the
users' password?
This would be a useful feature to add to our intranet.
Any ideas would be greatly appreciated.
Could any responses be directed to my email addy please, as our news feed is
a bit worse-for-wear at the moment ;-) Thanks.
TIA
Roland
------------------------------
Date: Thu, 26 Oct 2000 22:58:02 +0800
From: Fraser <r.fraser@student.murdoch.edu.au>
Subject: Clean POST strings
Message-Id: <39F8467A.FC15FA5E@student.murdoch.edu.au>
Hi
Trying to tidy up a Query_string from a POST method in a HTML page. Doe
any one know how to do this. To remove all the escape characters that
are added to the posted string, to do operations on.
Please help
Fraser
------------------------------
Date: Thu, 26 Oct 2000 17:09:23 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: Re: complex (for me anyway) rexexp
Message-Id: <8t9ofs$pc3$1@nnrp1.deja.com>
In article <slrn8vff4d.e43.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> On Thu, 26 Oct 2000 04:19:39 GMT, Dave Brondsema <brondsem@my-
deja.com> wrote:
> >
> >
> >I have a string and I want to change every ", " to " . " if the ", "
is
> >between "print" and ";". I have some experience with regexps,
>
> And you still throw options on whilly nilly?
>
> You should only use options when you _need_ to use options.
I'm not good enough to create the best regexp, I'm happy when it works
at all.
> >$content =~ s/print([.]*?);/print ;/gomi;
>
> 'g' is good, probably
>
> 'o' is worthless, since there are no variables in your pattern
>
> 'm' is worthless, since there are no anchors in your pattern
>
> 'i' is probably not needed, unless you also want to find
> stuff between "PRINT" and a semicolon.
I'll start using my options more carefully.
> Why are you trying to match zero or more dot characters
> following "print"?
Doesn't . match any character except newline? But it doesn't matter
anyway because my regexp was way off from what I needed.
> --
> Tad McClellan SGML consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
--
Dave Brondsema
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 26 Oct 2000 17:21:06 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: Re: complex (for me anyway) rexexp
Message-Id: <8t9p5p$pv3$1@nnrp1.deja.com>
In article <m3zojsqk7k.fsf@dhcp11-177.support.tivoli.com>,
Ren Maddox <ren.maddox@tivoli.com> wrote:
> Dave Brondsema <brondsem@my-deja.com> writes:
>
> > I have a string and I want to change every ", " to " . " if
the ", " is
> > between "print" and ";". I have some experience with regexps, but I
> > haven't done anything like this before.
>
> Here's a quick-and-dirty solution...
>
> s/(print[^;]*;)/(my$x=$1)=~s!, ! . !g;$x/eg
DATA:
print qq(<tr>
<td><a href=\"hitcounting.pl?givenpage=),
$myactivity[$i],
urlformat($myactivity[$i]),
qq(\">$myactivity[$i]</a></td>
<td>$myactivity[$i+1]</td>
<td>$myactivity[$i+2]</td>
</tr>);
OUTPUT:
print qq(<tr>
<td><a href=\"hitcounting.pl?givenpage=),
$myactivity[$i],
urlformat($myactivity[$i]),
qq(\">$myactivity[$i]</a></td>
<td>$myactivity[$i+1]</td>
<td>$myactivity[$i+2]</td>
</tr>);
doesn't look like anything happened
> Note that this makes no attempt to handle cases such as a ";" embeded
> in a string. Or a ", " in a string for that matter.
>
It's only me and a friend working on this, so I'm not worrying about
anything like that.
> --
> Ren Maddox
> ren@tivoli.com
>
--
Dave Brondsema
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 26 Oct 2000 17:23:32 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: Re: complex (for me anyway) rexexp
Message-Id: <8t9pac$q16$1@nnrp1.deja.com>
In article <39F7CD40.F9576C1D@ot.com.au>,
Ian Boreham <ianb@ot.com.au> wrote:
> Dave Brondsema wrote:
>
> > In article <1DOJ5.163$7rc.170631168@news.frii.net>,
> > > >I have a string and I want to change every ", " to " . " if
the ", "
> > is
> > > >between "print" and ";". I have some experience with regexps,
but I
> > > >haven't done anything like this before.
> > > >
> > > >The closest I have so far is:
> > > >$content =~ s/print([.]*?);/print ;/gomi;
>
> This is a problem that crops up in many guises. Depending on what
sort of
> approximations you want to make, your solution can be either a simple
> substitution in a loop, or an equivalent of the perl interpreter.
>
> Your version, by the way, is not going to work .(Incidentally, did you
> know "gomi" is Japanese for garbage? Just thought you might like to
know.)
> The /g is only going to match each "print" once, so in order to match
> several commas in a single print statement, you'll need to loop or
find a
> way of expressing the idea differently.
>
> > I also want it to work for something like:
> >
> > print myfunc($test),
> > "hello",
> > $x,
> > "\n";
>
> But what about cases like:
>
> print STDERR "Big problem; errcode = ", $err, "; Unable to print
> value\n";
>
> or
>
> print join(", ", ($a, $b, $c)) . "\n";
>
> etc?
>
> You were right to classify it as a complex regex problem, and you will
> need to decide how detailed you want the solution to be. If you assume
> that all print statements are going to contain no semicolons
or "print"
> words, and the commas will only be those of the print statement
itself,
> you will have a relatively easy task:
I am assuming this, it's only me and a friend working on the website.
>
> #!/usr/bin/perl
>
> undef $/;
>
> $data = <DATA>;
> print "DATA: $data";
>
> $data =~ s/(print[^;]*;)/$rep = $1;$rep =~ s%,% .%g;$rep/eg;
Works great! Thanks.
> print "RESULTS:\n$data\n";
>
> __END__
> $x = 2;
> print "hello", $x, "goodbye";
> #random unaffected comment line
>
> print myfunc($test),
> "hello",
> $x,
> "\n";
>
> sort (@blah, $a, $b);
>
> print "hi ",$a,
>
> "\n";
>
> I'll leave the exact fiddling of whitespace around the "."s to you.
It came out fine. Thanks, again
>
> Regards,
>
> Ian
>
>
--
Dave Brondsema
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 26 Oct 2000 09:23:08 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: concatenation txt files in one file
Message-Id: <39F85A6C.62D31955@vpservices.com>
lrako@hotmail.com wrote:
>
> So I would like to create a kind of big txt file which is a
> concatenation of the contents of all files in a given directory.
>
> How can I do that in a NT environnement ? In UNIX it would be very
> easy...
>
> A colleague said a Perl script will do. But no one here knows Perl.
Yes, of course Perl can do it, but unless you are offering to pay
someone in this newsgroup to do it for you, I am unclear what good that
will do you.
Why don't you go to http://www.cygwin.com/ and get a copy of "cat" (and
many other common Unix utilities) that can run on windoze. You don't
need to install the bash environment to use cat and the rest, you can
use them straight from a DOS console.
--
Jeff
------------------------------
Date: Thu, 26 Oct 2000 18:03:22 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Confused about behavior of sort command with function returning list
Message-Id: <drjgvsg1dvfseh43jvk2sejs686dcb7v6p@4ax.com>
On Thu, 26 Oct 2000 02:16:09 GMT, tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
wrote:
> I was shocked! How could Thomas M. Payerle <payerle@Glue.umd.edu>
> say such a terrible thing:
> >I encountered some rather unexpected behavior from Perl's sort command when
> >trying to sort the return values of a subroutine returning a list. Since
> >the perl language interface is usually quite intuitive, I was wondering if
> >someone could enlighten me as to perl is not behaving as I would have
> >expected (or alternatively, why I should have been expecting what it did:)
>
> >I would have expected the line
> >@list2=sort(get_list) to result in @list2 containing ("a","b","c","d"), not
> >"get_list". I am also baffled as to the result of adding empty parentheses
>
> nope. You want:
>
> @list2 = sort(@get_list); # note the '@'
Nope:
Variable "@get_list" is not imported at sort10.pl line 18.
(Did you mean &get_list instead?)
Global symbol "@get_list" requires explicit package name at
sort10.pl line 18.
I think you wanted something like:
my @list2 = sort( @{ [ get_list ] } );
from perlfunc:
sort SUBNAME LIST
sort BLOCK LIST
sort LIST
Sorts the LIST and returns the sorted list value. If SUBNAME
or BLOCK is omitted, `sort's in standard string comparison
order. If SUBNAME is specified, it gives the name of a
subroutine that returns an integer less than, equal to, or
greater than `0', depending on how the elements of the list
are to be ordered.
> > my @list2=sort(get_list);
This means that 'get_list' should be used as the named sortsub and an
empty list is sorted and assigned to @list2. But in fact 'get_list' is
treated like a bareword. I'm surprised that Perl doesn't raise a warning
here.
The expected behaviour does occur when the extra parens are added
@list2 = sort(get_list());
If you insist on this you could always use a work-around:
my @list2 = sort map $_ => get_list;
or (faster)
my @list2 = sort grep 1 => get_list;
--
Good luck,
Abe
##
perl -Mstrict -wle 'sub Just{&$_}sub another{&$_}sub Perl{&$_}sub hacker{&$_}$_=sub{(split /::/,(caller $^W)[3])[-$^W].$"};print@{[Just,another,Perl,hacker]}'
------------------------------
Date: 26 Oct 2000 11:35:33 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Confused about behavior of sort command with function returning list
Message-Id: <m3bsw7zhka.fsf@dhcp11-177.support.tivoli.com>
Abe Timmerman <abe@ztreet.demon.nl> writes:
> On Thu, 26 Oct 2000 02:16:09 GMT, tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
> wrote:
>
> > I was shocked! How could Thomas M. Payerle <payerle@Glue.umd.edu>
> > say such a terrible thing:
> >
> > >I would have expected the line
> > >@list2=sort(get_list) to result in @list2 containing ("a","b","c","d"), not
> > >"get_list". I am also baffled as to the result of adding empty parentheses
> >
> > nope. You want:
> >
> > @list2 = sort(@get_list); # note the '@'
>
> Nope:
> Variable "@get_list" is not imported at sort10.pl line 18.
> (Did you mean &get_list instead?)
> Global symbol "@get_list" requires explicit package name at
> sort10.pl line 18.
>
> I think you wanted something like:
>
> my @list2 = sort( @{ [ get_list ] } );
>
Actually, our old friend "+" can disambiguate this very nicely:
my @list2 = sort +get_list();
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 26 Oct 2000 17:59:06 +0100
From: "The Moriman" <themoriman@ntlworld.com>
Subject: Re: emulating flock
Message-Id: <zpZJ5.999$sE.16052@news6-win.server.ntlworld.com>
Randal L. Schwartz <merlyn@stonehenge.com> wrote in message
news:m17l6vpu9d.fsf@halfdome.holdit.com...
> >>>>> "The" == The Moriman <themoriman@ntlworld.com> writes:
>
> Nope. You need an "atomic" operation, in which the "testing" and the
> "setting" occur in one indivisible amount of time.
Hi Randal and thanks
I was sort of figuring that was the case.
Does this "atomic" operation have to be a single insruction (eg flock) or
can it be a one-liner?
Is there anyway to do this part in one step
@temp = stat("shortfile.txt");
if ($temp[7] > 0) {
sort of a
if ($[7]stat("shortfile.txt") > 0) {.........
or am I tilting at windmills;-)
btw
How do you delete a file, I can't come across a command for it.
Thanks
TMMan
------------------------------
Date: 26 Oct 2000 10:25:12 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: emulating flock
Message-Id: <m1itqfms5j.fsf@halfdome.holdit.com>
>>>>> "The" == The Moriman <themoriman@ntlworld.com> writes:
The> I was sort of figuring that was the case.
The> Does this "atomic" operation have to be a single insruction (eg flock) or
The> can it be a one-liner?
It has to be an operating system primitive that says "this is an
atomic test-and-set operation". There are durn few of those. :)
The> Is there anyway to do this part in one step
The> @temp = stat("shortfile.txt");
The> if ($temp[7] > 0) {
The> sort of a
The> if ($[7]stat("shortfile.txt") > 0) {.........
The> or am I tilting at windmills;-)
Nope. Wrong tunnel. No cheese. Maybe you should look at the FAQ
entry for that.
The> How do you delete a file, I can't come across a command for it.
How hard did you stare at the table-of-contents at the beginning of
perlfunc? Hint: it's probably one of these....
Functions for filehandles, files, or directories
-X, chdir, chmod, chown, chroot, fcntl, glob, ioctl,
link, lstat, mkdir, open, opendir, readlink, rename,
rmdir, stat, symlink, umask, unlink, utime
Grepping the manpage for "delete.*file" took me right to it, by the
way. Use the tools!
--
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: Thu, 26 Oct 2000 18:01:36 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: emulating flock
Message-Id: <4k_J5.106$qs6.37232@news.pacbell.net>
The Moriman <themoriman@ntlworld.com> wrote:
> Hi,
> flock doesn't work on the server that I use.
Hmm. why not? What server is it? What OS are you using?
Some operating systems on *some* filesystems have the ability to
atomically create a file if it doesn't exist.
if (open (FILE, "lockfile", O_RDWR|O_CREAT|O_EXCL))
{ got lock; do stuff; close (FILE) ; unlink lockfile; }
else
{ don't got lock;}
But unlike flock, the locks don't get cleaned up when you die, and you
won't block just waiting for the lock if you'd like.
Also, I don't know how you could tell if this operation is atomic or not
on your platform (it is not on NFS).
--
Darren Dunham ddunham@taos.com
Unix System Administrator Taos - The SysAdmin Company
Got some Dr Pepper? San Francisco, CA bay area
< Please move on, ...nothing to see here, please disperse >
------------------------------
Date: Thu, 26 Oct 2000 23:04:56 +0800
From: Fraser <r.fraser@student.murdoch.edu.au>
Subject: Form CGI help please
Message-Id: <39F84818.E6494AE2@student.murdoch.edu.au>
How are you meant to "clean up" method POST forms where there is a
variety of INPUT TYPES such as radio buttons and several long text
fields, I want to clean up the string and be able to work on the strings
in a CGI script.
Fraser
------------------------------
Date: Thu, 26 Oct 2000 11:39:26 -0400
From: Drew Simonis <dsimonis@fiderus.com>
Subject: Re: Form CGI help please
Message-Id: <39F8502E.1BABC67B@fiderus.com>
Fraser wrote:
>
> How are you meant to "clean up" method POST forms where there is a
> variety of INPUT TYPES such as radio buttons and several long text
> fields, I want to clean up the string and be able to work on the strings
> in a CGI script.
> Fraser
wrong group....
follow-up set
------------------------------
Date: Thu, 26 Oct 2000 16:39:57 +0100
From: "Trevor Ward" <tward10@jaguar.com>
Subject: Re: Form CGI help please
Message-Id: <8t9j8c$lo613@eccws12.dearborn.ford.com>
Suggest you use CGI.pm
which allows you to look at the individual parameters.
Fraser <r.fraser@student.murdoch.edu.au> wrote in message
news:39F84818.E6494AE2@student.murdoch.edu.au...
> How are you meant to "clean up" method POST forms where there is a
> variety of INPUT TYPES such as radio buttons and several long text
> fields, I want to clean up the string and be able to work on the strings
> in a CGI script.
> Fraser
>
------------------------------
Date: 26 Oct 2000 17:37:12 +0100
From: nobull@mail.com
Subject: Re: Form CGI help please
Message-Id: <u9zojr5zk7.fsf@wcl-l.bham.ac.uk>
Fraser <r.fraser@student.murdoch.edu.au> writes:
> How are you meant to "clean up" method POST forms where there is a
> variety of INPUT TYPES such as radio buttons and several long text
> fields, I want to clean up the string and be able to work on the strings
> in a CGI script.
You are meant to use the standard modules.
Why have you asked this twice?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 26 Oct 2000 11:09:42 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: help with system ()
Message-Id: <m3g0ljzird.fsf@dhcp11-177.support.tivoli.com>
yhlee@red.seas.upenn.edu (Young H Lee) writes:
> Not to go too far off topic, but I have not been able to find a perldoc
> that explains the ' ' function in the unix version of perl.. For example:
You mean ``, not ''. It's in "perldoc perlop":
qx/STRING/
`STRING`
A string which is (possibly) interpolated and then
executed as a system command with `/bin/sh' or its
equivalent. Shell wildcards, pipes, and
redirections will be honored. The collected
standard output of the command is returned;
standard error is unaffected. In scalar context,
it comes back as a single (potentially multi-line)
string. In list context, returns a list of lines
(however you've defined lines with $/ or
$INPUT_RECORD_SEPARATOR).
> $date = "test the" . 'date ';
$date = "test the " . `date`;
> yields "test the 10/26/00" for $date in unix but gives
> "test the date " in DOS :(
This looks like you really did use the wrong quotes on DOS. But it
still isn't going to work. "date" is an external command that does
different things on UNIX and DOS. Most notably, on DOS it waits for
input from the user (to set the date).
--
Ren Maddox
ren@tivoli.com
------------------------------
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 4733
**************************************