[16861] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4273 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 9 18:05:26 2000

Date: Sat, 9 Sep 2000 15:05:11 -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: <968537111-v9-i4273@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 9 Sep 2000     Volume: 9 Number: 4273

Today's topics:
        2 versions of Perl <pgapro@eclipse.net>
    Re: 2 versions of Perl <jaap@stack.nl>
    Re: CGI.pm, taint & use strict?? <pdmos23@geocities.com>
    Re: CGI.pm, taint & use strict?? <jeff@vpservices.com>
    Re: CGI.pm, taint & use strict?? <anmcguire@ce.mediaone.net>
        close(STDIN) bad, but why? <chris@localhost.localdomain.invalid>
    Re: close(STDIN) bad, but why? (Clinton Pierce)
    Re: glob() feature = delightful japh <jeffp@crusoe.net>
        Help with number formatting needed... <jeffjohnson@earthlink.net>
    Re: Help with number formatting needed... (Clinton Pierce)
        Matching anything but a certain string <mnysurf@home.comREMOVE>
    Re: Matching anything but a certain string <mbudash@sonic.net>
    Re: Matching anything but a certain string <mnysurf@home.comREMOVE>
    Re: Matching anything but a certain string (Randal L. Schwartz)
    Re: Matching anything but a certain string <jaap@stack.nl>
    Re: Matching anything but a certain string <jeff@vpservices.com>
    Re: Matching anything but a certain string <tony_curtis32@yahoo.com>
        need advice on locale problem 104073.3433@compuserve.com
    Re: Restricting simultaneous file downloads in CGI prog (Randal L. Schwartz)
    Re: Restricting simultaneous file downloads in CGI prog <brad@smithart.net>
    Re: Restricting simultaneous file downloads in CGI prog (Maggert)
    Re: return values from system() function (David de Gruyl)
    Re: Scoping of symbolic references (variables) (Avast)
        strip carriage returns error <pirod@webdifusao.com>
        Tk::NumEntry for Win32 <carvdawg@patriot.net>
    Re: Tk::NumEntry for Win32 <randy@theory.uwinnipeg.ca>
    Re: what is the best way to get the lastest line from a <anmcguire@ce.mediaone.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 09 Sep 2000 15:14:12 -0400
From: john <pgapro@eclipse.net>
Subject: 2 versions of Perl
Message-Id: <39BA8C04.5B6538FF@eclipse.net>

I have found that I have two versions of Perl installed on my Redhat
Linux box.    The first is version 5.0 and is installed in the folder
/usr/lib/perl5/  The second in installed to /local/ActivePel-5.6

I would like to remove the 5.0 version.  It seems like my programs are
using these libraries instead of the more recent ActivePerl libraries.





------------------------------

Date: Sat, 09 Sep 2000 19:53:43 GMT
From: "Jaap" <jaap@stack.nl>
Subject: Re: 2 versions of Perl
Message-Id: <bzwu5.177249$LX4.1501395@nlnews00.chello.com>

And your question is?
I assume you want to knwo how to remove it.
1st try the command:
which perl
to figure out what perl version is in your path.

It'll probably say
/usr/lib/perl5

Then you'll have to update your .cshrc (or something) to change the path to
/local/ActivePel-5.6

good luck.

"john" <pgapro@eclipse.net> schreef in bericht
news:39BA8C04.5B6538FF@eclipse.net...
> I have found that I have two versions of Perl installed on my Redhat
> Linux box.    The first is version 5.0 and is installed in the folder
> /usr/lib/perl5/  The second in installed to /local/ActivePel-5.6
>
> I would like to remove the 5.0 version.  It seems like my programs are
> using these libraries instead of the more recent ActivePerl libraries.




------------------------------

Date: Sat, 09 Sep 2000 19:18:38 GMT
From: Pasquale <pdmos23@geocities.com>
Subject: Re: CGI.pm, taint & use strict??
Message-Id: <39BA8D7E.A2078DE3@geocities.com>

<snip>

>Written this way, it will not work, but if I replace the "-T" with "-w"
>on the shebang line, it works fine.  I don't understand what perl sees
>is "tainted"?

What I am trying to find out from the above question is, is "taint" having a
problem with my script or CGI.pm?  Is that possible, that it sees something
tainted with the CGI module?  Or are the modules written correctly to avoid
taintedness?
Thanks
Pasquale

Gwyn Judd wrote:

> I was shocked! How could Pasquale <pdmos23@geocities.com>
> say such a terrible thing:
> >Snippet of code:
>
> <snip>
>
> >Written this way, it will not work, but if I replace the "-T" with "-w"
> >on the shebang line, it works fine.  I don't understand what perl sees
> >is "tainted"?
>
> You need to read the documentation. Type:
>
> perldoc perlsec
>
> at the command line.
>
> >1. Can "CGI.pm", "taint", & "use strict" be used together as above?
>
> yes
>
> >2. Can I use both "-w" & "-T" on the shebang line?
>
> yes (that is to say, perl doesn't care, your operating system might from
> what it says in perlsec)
>
> >3. Can I use the %formdata parsing script(ie: require "formParse.pl";)
> >with "use strict" & "-T" to parse the form information instead of using
> >CGI.pm? When I was using this, I had the taint check working fine, but
> >when I introduced "use strict" I had problems.
>
> Well that depends, -T doesn't really care what you do, it just checks on
> your data and how you use it and all sorts of other stuff.
>
> --
> Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
> If any man wishes to be humbled and mortified, let him become president
> of Harvard.
>                 -- Edward Holyoke



------------------------------

Date: Sat, 09 Sep 2000 12:39:45 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: CGI.pm, taint & use strict??
Message-Id: <39BA9201.8A629B8E@vpservices.com>

Pasquale wrote:
> 
> <snip>
> 
> >Written this way, it will not work, but if I replace the "-T" with "-w"
> >on the shebang line, it works fine.  I don't understand what perl sees
> >is "tainted"?
> 
> What I am trying to find out from the above question is, is "taint" having a
> problem with my script or CGI.pm?  Is that possible, that it sees something
> tainted with the CGI module?  Or are the modules written correctly to avoid
> taintedness?

The module is written correctly to *NOT* avoid taintedness.  Taintedness
is your friend.  When you run a script in taint mode, perl (and CGI.pm)
will warn you (warn in the English sense of the word, not the perl
sense) whenever you try to take input from outside your program and use
it to impact something else outside your program.  For example, IIRC,
your script takes input from users and then creates a file with that
input.  Perl warns you (by dieing) that you are taking something you
have no control over and sending it out to do things to your file
system.  Perhaps you know that and want to do that, if so you must
purposely untaint the user input, thereby showing perl that you have at
least thought about the implications of what you are doing.  So think
through carefully what you are doing and remember that user input can be
anything at all and if you really want to do what you are doing with
"anything at all", then go ahead and untaint the data and your program
will run.  Yes you could make it work by removing the -T, but you can
also make it work by manually untainting and in the long run manually
untainting is much safer.  See perlsec for details on how to manually
untaint.

-- 
Jeff


------------------------------

Date: Sat, 9 Sep 2000 14:42:48 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: CGI.pm, taint & use strict??
Message-Id: <Pine.LNX.4.21.0009091421420.7642-100000@hawk.ce.mediaone.net>

On Fri, 8 Sep 2000, Godzilla! quoth:

G> Nicked Condom wrote:
G> 
G> > Another example: in a recent discussion on multitasking she
G> > was surprised to discover that a CPU can only handle one task
G> > at a time.
G> 
G> 
G> You will be surprised to learn of your illiteracy.
G> Study this expression "CPU" quite well and you...

[ snip raving lunacy ]

Sayoonara Gojira,

anm
-- 
BEGIN { $\ = $/; $$_ = $_ for qw~ just another perl hacker ~ }
my $J = sub { return \$just }; my $A = sub { return \$another };
my $P = sub { return \$perl }; my $H = sub { return \$hacker  };
print map ucfirst() . " " => ${&$J()}, ${&$A()}, ${&$P()}, ${&$H()};



------------------------------

Date: 09 Sep 2000 19:03:17 +0100
From: Chris Martin <chris@localhost.localdomain.invalid>
Subject: close(STDIN) bad, but why?
Message-Id: <8pduu7$af2$1@tualatin.shef.ac.uk>

A colleague has sent me the following question -- he accepts that
closing STDIN is a bad thing to do but wants to know why.

Can anybody help?

   Here is the problem in a very simple form...
   
   #! /usr/bin/perl
   print glob('*.pl'), "\n";
   close(STDIN);
   print glob('users*'), "\n";
   
   The two filename globs are for different patterns which both match
   a number of files in the directory where the program is run but the
   second line of output is blank.  If the close(STDIN); is removed
   then the program works as expected.


------------------------------

Date: Sat, 09 Sep 2000 20:54:20 GMT
From: clintp@geeksalad.org (Clinton Pierce)
Subject: Re: close(STDIN) bad, but why?
Message-Id: <0sxu5.36174$QW4.445001@news1.rdc1.mi.home.com>

[mail witheld because of stupid munging]

In article <8pduu7$af2$1@tualatin.shef.ac.uk>,
	Chris Martin <chris@localhost.localdomain.invalid> writes:
> A colleague has sent me the following question -- he accepts that
> closing STDIN is a bad thing to do but wants to know why.

STDIN is the default filehandle used by Perl to receive data from 
the outside world.  (Through user-input, pipes, etc...)

Closing that covers Perl's ears.  You can get another STDIN but 
it's just not the same.  :)

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


------------------------------

Date: Sat, 9 Sep 2000 15:09:19 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: glob() feature = delightful japh
Message-Id: <Pine.GSO.4.21.0009091508410.23350-100000@crusoe.crusoe.net>

On Sep 9, Mark-Jason Dominus said:

>In article <Pine.GSO.4.21.0009091049160.23350-100000@crusoe.crusoe.net> you write:
>>$_ *= $_ ++;
>
>That's excellent.  Thanks.
>
>I thought that the option to use a letter as the delimiter for q() had
>been removed, but I guess not!

If you'd like, the last line can be the more vexing

  print q...reverse;

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/



------------------------------

Date: Sat, 09 Sep 2000 20:44:54 GMT
From: "Jeff Johnson" <jeffjohnson@earthlink.net>
Subject: Help with number formatting needed...
Message-Id: <ajxu5.32753$K4.1388147@newsread1.prod.itd.earthlink.net>

I have managed to re-write the basic formmail.pl, found on many sites and at
Matt's Script Archive, to include a "confirmation page" that shows users the
data they have input on a form, totals their order, and asks them to
finalize the order by selecting a "Purchase" button. Since I know a bit
about database but nothing about PERL it took me a while to write. I am left
with two final problems to solve.

1.) How do I format numbers to always appear with two figures after the
decimal point?
                Example: 15.90 appears as 15.9

2.) How do I "clear" memory arrays and variables before exiting a PERL
script?
                 Example: Once my script "prints" parts of an array to HTML
I want to
                 then "clear" that array to be used again later.

Thanks for any suggestions,
Jeff Johnson





------------------------------

Date: Sat, 09 Sep 2000 20:52:33 GMT
From: clintp@geeksalad.org (Clinton Pierce)
Subject: Re: Help with number formatting needed...
Message-Id: <lqxu5.36173$QW4.445001@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <ajxu5.32753$K4.1388147@newsread1.prod.itd.earthlink.net>,
	"Jeff Johnson" <jeffjohnson@earthlink.net> writes:
> I have managed to re-write the basic formmail.pl, found on many sites and at
> Matt's Script Archive, to include a "confirmation page" that shows users the
> data they have input on a form, totals their order, and asks them to
> finalize the order by selecting a "Purchase" button. Since I know a bit
> about database but nothing about PERL it took me a while to write. I am left
> with two final problems to solve.

Ouch.  You're scaring me.  You did all that, and you missed these?  :)

> 1.) How do I format numbers to always appear with two figures after the
> decimal point?
>                 Example: 15.90 appears as 15.9

perldoc -f sprintf

> 2.) How do I "clear" memory arrays and variables before exiting a PERL
> script?
>                  Example: Once my script "prints" parts of an array to HTML
> I want to
>                  then "clear" that array to be used again later.

In 1 word: unnecessary.  If you exit the script, the memory is freed.
If you don't exit the script, then just let the variables fall out of scope or
initialize them to an empty value (like @a=();).

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


------------------------------

Date: Sat, 09 Sep 2000 18:13:51 GMT
From: "Thomas" <mnysurf@home.comREMOVE>
Subject: Matching anything but a certain string
Message-Id: <z5vu5.138262$6y5.91445238@news2.rdc2.tx.home.com>

Is there a way to match anything but a certain string?  For example, I want
to match anything but the word "pig".  If I used [^pig]* then it would not
match the letters "p", "i", and "g".  But I want those letters to be matched
unless they are in the word pig.  Does anybody know how to do this?




------------------------------

Date: Sat, 09 Sep 2000 11:43:55 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Matching anything but a certain string
Message-Id: <mbudash-326FC3.11435509092000@news.pacbell.net>

In article <z5vu5.138262$6y5.91445238@news2.rdc2.tx.home.com>, "Thomas" 
<mnysurf@home.comREMOVE> wrote:

> Is there a way to match anything but a certain string?  For example, I 
> want
> to match anything but the word "pig".  If I used [^pig]* then it would 
> not
> match the letters "p", "i", and "g".  But I want those letters to be 
> matched
> unless they are in the word pig.  Does anybody know how to do this?
> 
> 

if i understand your question, this should do it:

$word !~ /pig/

this expression will return true if $word does *not* contain the string 
'pig'.

hth-
michael
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


------------------------------

Date: Sat, 09 Sep 2000 19:23:27 GMT
From: "Thomas" <mnysurf@home.comREMOVE>
Subject: Re: Matching anything but a certain string
Message-Id: <P6wu5.138413$6y5.91562903@news2.rdc2.tx.home.com>


"Michael Budash" <mbudash@sonic.net> wrote in message
news:mbudash-326FC3.11435509092000@news.pacbell.net...
> In article <z5vu5.138262$6y5.91445238@news2.rdc2.tx.home.com>, "Thomas"
> <mnysurf@home.comREMOVE> wrote:
>
> > Is there a way to match anything but a certain string?  For example, I
> > want
> > to match anything but the word "pig".  If I used [^pig]* then it would
> > not
> > match the letters "p", "i", and "g".  But I want those letters to be
> > matched
> > unless they are in the word pig.  Does anybody know how to do this?
> >
> >
>
> if i understand your question, this should do it:
>
> $word !~ /pig/
>
> this expression will return true if $word does *not* contain the string
> 'pig'.
>
> hth-
> michael
> --
> Michael Budash ~~~~~~~~~~ mbudash@sonic.net

Thanks for the help, but I guess I did not make my question clear enough.

With this line I would want to match the words 'horse' and 'cow', with
anything between the 2 words except the word 'pig'.

    $word =~ /horse[^pig]*cow/

The problem is that the preceding line would match 'horse' and 'cow' with
anything but the letters 'p', 'i', and 'g' in between them.  Like I said
before, I want the individual letters to match, just not the complete word
'pig'.  So I want the strings

    "horse cow"
    "horse pi cow"
    "horse p ig cow"

to match, but not

    "horse pig cow"

Any help with this problem would be greatly appreciated.




------------------------------

Date: 09 Sep 2000 12:39:46 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Matching anything but a certain string
Message-Id: <m1hf7p2w3h.fsf@halfdome.holdit.com>

>>>>> "Thomas" == Thomas  <mnysurf@home.comREMOVE> writes:

Thomas> With this line I would want to match the words 'horse' and 'cow', with
Thomas> anything between the 2 words except the word 'pig'.

Thomas>     $word =~ /horse[^pig]*cow/

Thomas> The problem is that the preceding line would match 'horse' and
Thomas> 'cow' with anything but the letters 'p', 'i', and 'g' in
Thomas> between them.  Like I said before, I want the individual
Thomas> letters to match, just not the complete word 'pig'.  So I want
Thomas> the strings

Thomas>     "horse cow"
Thomas>     "horse pi cow"
Thomas>     "horse p ig cow"

Thomas> to match, but not

Thomas>     "horse pig cow"

    $word =~ m{
      horse                 # start with a horse
      (?:                   # and between them
        [^pig]+             # permit a run of any uninteresting chars
        |                   # or
        (?!pig).            # any single character as long as we're not staring
                            # at our forbidden string
      )*                    # and that's ok 0 or more times
      cow                   # and end up at cow
    }six;                   # and that's the end

Others will probably have better optimizations, but this will do in a
pinch.

-- 
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: Sat, 09 Sep 2000 19:50:19 GMT
From: "Jaap" <jaap@stack.nl>
Subject: Re: Matching anything but a certain string
Message-Id: <%vwu5.177240$LX4.1501205@nlnews00.chello.com>

Why not try something like:

if (($word =~ /horse(.*?)cow/) && ($word !~ /pig/))

you could replace the second $word with $1 for the match in the 1st regexp




------------------------------

Date: Sat, 09 Sep 2000 12:57:57 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Matching anything but a certain string
Message-Id: <39BA9645.BEF351ED@vpservices.com>

Thomas wrote:
> 
> "Michael Budash" <mbudash@sonic.net> wrote in message
> news:mbudash-326FC3.11435509092000@news.pacbell.net...
> >
> > $word !~ /pig/
> >
> 
> Thanks for the help, but I guess I did not make my question clear enough.
> 
> With this line I would want to match the words 'horse' and 'cow', with
> anything between the 2 words except the word 'pig'.
> 
>     $word =~ /horse[^pig]*cow/
> 
> The problem is that the preceding line would match 'horse' and 'cow' with
> anything but the letters 'p', 'i', and 'g' in between them.  Like I said
> before, I want the individual letters to match, just not the complete word
> 'pig'.  So I want the strings
> 
>     "horse cow"
>     "horse pi cow"
>     "horse p ig cow"
> 
> to match, but not
> 
>     "horse pig cow"
> 
> Any help with this problem would be greatly appreciated.

I suspect you still haven't fully specified what you are trying to do
(for example what about 'horsepigcow' or 'horse rabbit pig cow' or
'horse pigmentation cow'?),  but to get the results you show above, you
could use:

  print if /horse(.+)cow/ && $1 !~ /pig/

-- 
Jeff


------------------------------

Date: 09 Sep 2000 15:06:56 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Matching anything but a certain string
Message-Id: <87hf7pfhy7.fsf@limey.hpcc.uh.edu>

>> On Sat, 09 Sep 2000 18:13:51 GMT,
>> "Thomas" <mnysurf@home.comREMOVE> said:

> Is there a way to match anything but a certain string?
> For example, I want to match anything but the word
> "pig".  If I used [^pig]* then it would not match the
> letters "p", "i", and "g".  But I want those letters to
> be matched unless they are in the word pig.  Does
> anybody know how to do this?

Well, you could match *for* the word pig and then invert
the logic of the code that handles the conditional,
e.g. in a loop you could "next" if you match that word.

If you gave an example of what the context is that would
help to clarify your purpose.

hth
t
-- 
WWNKD?


------------------------------

Date: Sat, 09 Sep 2000 13:52:15 GMT
From: 104073.3433@compuserve.com
Subject: need advice on locale problem
Message-Id: <8pebgq$cer$1@sshuraac-i-1.production.compuserve.com>
Keywords: locale

I have Mandarke Linux 7.0 w/ perl 5.004. Perl worked fine until I ungraded 
glibc to version 2.1.3-5, at which time perl started saying that locale 
could'nt be set. The three LANG environment variables are set to "en", and 
locale -a
has "en" as one of the locales. Also, xstart says locales are not supported.

Things seem to point to a locale problem in glibc. Does anybody know what is 
wrong and how to go about fixing it? A newer glic perhaps?

Thanks, Tom


------------------------------

Date: 09 Sep 2000 11:11:19 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Restricting simultaneous file downloads in CGI program
Message-Id: <m1snr9306w.fsf@halfdome.holdit.com>

>>>>> "news-east" == news-east newscene com <brad@smithart.net> writes:

news-east> 3) Of course, I could use file locking to restrict the
news-east> download to a single user.  Unfortunately, that's a little
news-east> *too* restrictive.

Have a series of flock sentinel files, equal to the number of streams
you want to provide.  When a new request comes in, try flocking each
one in sequence using a non-blocking flock.  If you get a flock, start
the download.  If you get all the way through the list without winning,
say "overloaded" and exit.

Even if the download is interrupted for unexpected reasons, the flock
gets released, and the "slot" becomes available again.

The sentinel files can be empty, so it's really just a namespace
you're using.

Hmm.  This sounds like my next WebTechniques column.  Thanks for the
idea, and I'll give you credit for posing the problem.  If you
(or anyone) wants to peruse past columns (or suggest new ideas),
see the archive at:

        http://www.stonehenge.com/merlyn/WebTechniques/

Thanks!

-- 
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: 9 Sep 2000 14:40:53 -0500
From: "news-east.newscene.com" <brad@smithart.net>
Subject: Re: Restricting simultaneous file downloads in CGI program
Message-Id: <39ba91b7$0$94156$45beb828@newscene.com>

Thanks, Randal.

I've actually used your column as a resource many times. I appreciate the
response; it looks like exactly what I need.

Brad
-----

"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m1snr9306w.fsf@halfdome.holdit.com...
> >>>>> "news-east" == news-east newscene com <brad@smithart.net> writes:
>
> news-east> 3) Of course, I could use file locking to restrict the
> news-east> download to a single user.  Unfortunately, that's a little
> news-east> *too* restrictive.
>
> Have a series of flock sentinel files, equal to the number of streams
> you want to provide.  When a new request comes in, try flocking each
> one in sequence using a non-blocking flock.  If you get a flock, start
> the download.  If you get all the way through the list without winning,
> say "overloaded" and exit.
>
> Even if the download is interrupted for unexpected reasons, the flock
> gets released, and the "slot" becomes available again.
>
> The sentinel files can be empty, so it's really just a namespace
> you're using.
>
> Hmm.  This sounds like my next WebTechniques column.  Thanks for the
> idea, and I'll give you credit for posing the problem.  If you
> (or anyone) wants to peruse past columns (or suggest new ideas),
> see the archive at:
>
>         http://www.stonehenge.com/merlyn/WebTechniques/
>
> Thanks!
>
> --
> 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: Sat, 09 Sep 2000 20:13:21 GMT
From: mag@ionet.net (Maggert)
Subject: Re: Restricting simultaneous file downloads in CGI program
Message-Id: <39ba9986.189815820@news.ionet.net>

On 09 Sep 2000 11:11:19 -0700, merlyn@stonehenge.com (Randal L.
Schwartz) wrote:


>Hmm.  This sounds like my next WebTechniques column.  Thanks for the
>idea, and I'll give you credit for posing the problem.  If you
>(or anyone) wants to peruse past columns (or suggest new ideas),
>see the archive at:
>
	Can't wait to read that one. Sounds like it could have a lot
of different applications!


MP


------------------------------

Date: Sat,  9 Sep 2000 14:02:09 EDT
From: degruyl@superlink.net (David de Gruyl)
Subject: Re: return values from system() function
Message-Id: <8pdtv1$2khq$1@earth.superlink.net>

On Thu 07 Sep, Chris Little <clittle@mmcable.com> wrote:
> system($return_code = "fsck -m ",$filesystem);
you have the right function (system) if you need to capture the return
code, you can use:

$return_code = system("program", "args");

for more information look at the perlfunc man page for the system
function. (or type perldoc -f system)

David

-- 
David de Gruyl <degruyl@superlink.net>
Perhaps you should compile your Perl with long doubles one of these
megaseconds.
             -- Larry Wall in <199806241734.KAA09652@wall.org>
 


------------------------------

Date: Fri, 08 Sep 2000 16:50:24 GMT
From: avast@hortonsbay.com (Avast)
Subject: Re: Scoping of symbolic references (variables)
Message-Id: <39b9183a.15865366@news.mco.edu>

On Fri, 08 Sep 2000 11:22:40 -0500, Tom Briles <sariq@texas.net>
wrote:
<snip>
>Read:
>
>http://www.plover.com/~mjd/perl/varvarname.html
>
>(Note that there are three parts.  And thanks to mjd.)

OK, got it!  Thanks for the link.  Again, this was simply an
experiment to understand symbolic references and how they work.  Part
of the learning curve and all that.  The link you provide adds a good
deal of additional insight - also partof the curve.   Thanks again!

Avast


------------------------------

Date: Sat, 09 Sep 2000 23:39:05 +0000
From: Pierre Rodrigues <pirod@webdifusao.com>
Subject: strip carriage returns error
Message-Id: <39BACA19.91D6FD7@webdifusao.com>

Hi,

sometimes I get the following error:
"Software error:
(Maybe you didn't strip carriage returns after a network transfer?) "

I tested the same script on 2 servers and only got this message in one.
What sort of error causes this message? is it the perl path?

I uploaded in ASCII and chmoded 755 the script...

thanks
Pierre




------------------------------

Date: Sat, 09 Sep 2000 14:42:23 -0400
From: H C <carvdawg@patriot.net>
Subject: Tk::NumEntry for Win32
Message-Id: <39BA848F.1FFA9F8E@patriot.net>

I have ActivePerl build 615, and the Tk::NumEntry widget isn't
included.  Does
anyone know where I can get one that works with Win32?

THanks

--
Q: Why is Batman better than Bill Gates?
A: Batman was able to beat the Penguin.




------------------------------

Date: Sat, 9 Sep 2000 13:48:14 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: Tk::NumEntry for Win32
Message-Id: <8pe0sg$631$1@canopus.cc.umanitoba.ca>

H C <carvdawg@patriot.net> wrote in
    message news:39BA848F.1FFA9F8E@patriot.net...
> I have ActivePerl build 615, and the Tk::NumEntry widget isn't
> included.  Does
> anyone know where I can get one that works with Win32?

It's in the Tk-GBARR distribution - see, eg,
http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?mod=Tk::NumEntry
for a link to the package. After unpacking, you can
install it with
    perl Makefile.PL
    nmake
    nmake test
    nmake install
(get the 'nmake' make program from
ftp://ftp.microsoft.com/softlib/MSLFILES/nmake15.exe
if you don't have it). Or, you can use the CPAN.pm
module to install things:
    perl -MCPAN -e shell
    [ possible configuration dialogue]
    cpan> install Tk::NumEntry

best regards,
randy kobes





------------------------------

Date: Sat, 9 Sep 2000 15:14:59 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: what is the best way to get the lastest line from a file?
Message-Id: <Pine.LNX.4.21.0009091508530.7714-100000@hawk.ce.mediaone.net>

On 9 Sep 2000, Abigail quoth:

A> Uri Guttman (uri@sysarch.com) wrote on MMDLXVI September MCMXCIII in
A> <URL:news:x7lmx2i4c4.fsf@home.sysarch.com>:
A> :: >>>>> "JJ" == Joe Johnston <jjohn@cs.umb.edu> writes:
A> :: 
A> ::   JJ> You have no doubt read the other responses about 
A> ::   JJ> File::Backward and using the external Unix command 
A> :: 
A> :: File::ReadBackwards.pm
A> :: 
A> ::   JJ> tail(1). I would choose tail(1) if it was most 
A> ::   JJ> convenient. I submit the code below for your
A> :: 
A> :: huh? it is much slower and not portable. how is that more convenient?
A> 
A> Much slower? It's faster.

[ snip benchmark ]

Here is another method, a spoof of your 'count the lines' one
-liner.  It is slower than tail as well, but cute (I think).

perl -wne '$l=$_}{print$l' file

anm
-- 
BEGIN { $\ = $/; $$_ = $_ for qw~ just another perl hacker ~ }
my $J = sub { return \$just }; my $A = sub { return \$another };
my $P = sub { return \$perl }; my $H = sub { return \$hacker  };
print map ucfirst() . " " => ${&$J()}, ${&$A()}, ${&$P()}, ${&$H()};



------------------------------

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 4273
**************************************


home help back first fref pref prev next nref lref last post