[25930] in Perl-Users-Digest
Perl-Users Digest, Issue: 8150 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 5 18:05:19 2005
Date: Sun, 5 Jun 2005 15:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 5 Jun 2005 Volume: 10 Number: 8150
Today's topics:
Anybody know a script or method to achieve this? (authe <me@privacy.net>
Re: Anybody know a script or method to achieve this? (a <cdsmith@twu.net>
Re: Anybody know a script or method to achieve this? (a <john@castleamber.com>
Re: Anybody know a script or method to achieve this? (a <nobull@mail.com>
Re: Converting a big perl script which is called over a <example@microoft.com>
Re: Converting a big perl script which is called over a <dv@mailtag.com>
Re: counting word occurances <dont@mail.me>
Re: counting word occurances <abigail@abigail.nl>
Re: counting word occurances <abigail@abigail.nl>
Env export in perl <appumail@gmail.com>
Re: Env export in perl <1usa@llenroc.ude.invalid>
How to find a perl programer hope@hope.com
Re: How to find a perl programer <1usa@llenroc.ude.invalid>
Re: How to find a perl programer <john@castleamber.com>
Re: How to find a perl programer <sbryce@scottbryce.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 05 Jun 2005 16:33:20 +0000
From: Jim J <me@privacy.net>
Subject: Anybody know a script or method to achieve this? (authentication/access related)
Message-Id: <42a32326$0$6531$8a667849@news.ak47.org>
I have been trying to find some kind of authentication method or
script (PHP/perl/javascript or other) to achieve the following, with
no luck.
Say there are 100 files at a site. A person can choose which file to
download from a list, and to do so has to enter a code or password.
When a valid code or password is used they are redirected to a page
with a direct link to download the file.
Once that code or password has been used to download that one file
(and the same code/password can be used to access any one of the 100
files), it is then expired/deleted/made invalid and can't be used
again to download any other file.
Does anybody know a method or script somewhere that can do this?
Thanks.
Jim
------------------------------
Date: Sun, 5 Jun 2005 10:48:57 -0600
From: Chris Smith <cdsmith@twu.net>
Subject: Re: Anybody know a script or method to achieve this? (authentication/access related)
Message-Id: <MPG.1d0cdae3bdec3b789899d9@news.altopia.net>
Jim J <me@privacy.net> wrote:
> I have been trying to find some kind of authentication method or
> script (PHP/perl/javascript or other) to achieve the following, with
> no luck.
Don't bother looking at JavaScript in traditional client-side
environments. JavaScript can be run on a server, but it's somewhat
rare. You're probably better off with one of the other languages.
> Say there are 100 files at a site. A person can choose which file to
> download from a list, and to do so has to enter a code or password.
> When a valid code or password is used they are redirected to a page
> with a direct link to download the file.
>
> Once that code or password has been used to download that one file
> (and the same code/password can be used to access any one of the 100
> files), it is then expired/deleted/made invalid and can't be used
> again to download any other file.
>
> Does anybody know a method or script somewhere that can do this?
This is going to require server-side code, a database (relational or
otherwise), and some mechanism for giving out codes/passwords. It's
also a fairly specific and unusual requirement. This is probably beyond
anything you're going to find pre-written.
As far as writing it, this should be fairly trivial in any server-side
web environment. However, you haven't told us what you're having
problems with, so help will be difficult to come by.
--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
------------------------------
Date: 5 Jun 2005 17:01:16 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Anybody know a script or method to achieve this? (authentication/access related)
Message-Id: <Xns966C7A2D2AC4Ecastleamber@130.133.1.4>
Jim J wrote:
> Once that code or password has been used to download that one file
> (and the same code/password can be used to access any one of the 100
> files), it is then expired/deleted/made invalid and can't be used
> again to download any other file.
How do you know the download went ok? I wouldn't waste to much effort in a
copy protection scheme (that is how it sounds)
What sounds better: give a code that makes it possible to download one file
during 24 hrs. So, as soon as you hand out the access code, you register it
in a database + current time. When a file link is clicked, you store the
name of the file unless the user/password combo has already something
assigned. If it's the same file, and within the 24hrs, allow it, otherwise
deny.
Every day you delete all entries that are older than 24 hrs.
You can use 2 stamps, one for moment of user/password creation, and one for
the first download attempt. You can do then something like: if combo older
than 3 days, delete it. If first download attempt was more then 8 hrs ago,
the combo no longer can be used.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Sun, 05 Jun 2005 20:12:11 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Anybody know a script or method to achieve this? (authentication/access related)
Message-Id: <d7viqc$n8b$1@redhat2.bham.ac.uk>
John Bokma wrote:
> Jim J wrote:
>
>
>>Once that code or password has been used to download that one file
>>(and the same code/password can be used to access any one of the 100
>>files), it is then expired/deleted/made invalid and can't be used
>>again to download any other file.
>
>
> How do you know the download went ok? I wouldn't waste to much effort in a
> copy protection scheme (that is how it sounds)
>
> What sounds better: give a code that makes it possible to download one file
> during 24 hrs. So, as soon as you hand out the access code, you register it
> in a database + current time. When a file link is clicked, you store the
> name of the file unless the user/password combo has already something
> assigned. If it's the same file, and within the 24hrs, allow it, otherwise
> deny.
>
> Every day you delete all entries that are older than 24 hrs.
>
> You can use 2 stamps, one for moment of user/password creation, and one for
> the first download attempt. You can do then something like: if combo older
> than 3 days, delete it. If first download attempt was more then 8 hrs ago,
> the combo no longer can be used.
I agree with everything John said. I would add that your script
should not deilver the content directly but rather perform an
internal redirect within the server so that the server will
cope with restartable download properly.
------------------------------
Date: Sun, 5 Jun 2005 15:13:56 +0200
From: "John Smith" <example@microoft.com>
Subject: Re: Converting a big perl script which is called over and over to a module ?
Message-Id: <tUCoe.677$vS6.142@amstwist00>
"OdedDV" <dv@mailtag.com> wrote in message
news:42a1ddc2@news.bezeqint.net...
>
> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnda3eok.8en.tadmc@magna.augustmail.com...
>> How will the module launch the new instance?
>>
>> Using system()?
>
> Nope, sorry if I wasn't clear enough. The idea is to convert the system
> call to a function call.
> Thus I'm calling code which was already "compiled/interpreted".
> Am I saying something stupid ? Maybe it's not possible ?!
>
> Is it possible to have some instances of the same function at the same
> time ?
> Maybe I do need to fork/exec, but then again, I want to make sure I don't
> ask Perl to recompile/reinterpret the code.
>
> Can this be done ?
>
> Thanks,
> Oded
How is the "mother prosess" that calls system() today being called itself?
Is it at CGI-script? (handles only one request and then dies)
A mod_perl httpd process? (probably handles more than one request)
What I'm really asking is: Are the mother process being startet once each
request or not?
If it are, you probably woudn't get much better performance by converting
the child
to a module. It could even be worse if the child doesn't get called each
time.
To turn a .pl into a .pm I think you have two alternatives:
Both includes finding all global variables in the .pl
Alt. 1
For the object oriented alternative, let the .pl globals become
instance variables. Most likely keys in an blessed instance hash.
This requires knowledge of writing object oriented perl.
Alt. 2
For the non-object oriented alternative. Declare all globals in
the .pl as my $var1; my %hash2; my @arr3; and so on in the
top of your .pm. And then write a: sub clean_up { undef $var1;
undef %hash2; undef @arr3; ... } ...and so on. Call Module::clean_up
each time first thing where the old system() call was.
------------------------------
Date: Sun, 5 Jun 2005 21:13:45 +0200
From: "OdedDV" <dv@mailtag.com>
Subject: Re: Converting a big perl script which is called over and over to a module ?
Message-Id: <42a340bc$1@news.bezeqint.net>
Thanks for all who tried to explain. It looks like the issue is a little
bit more complicated.
Thanks for your patience, I will try to explain it better to answer the
questions I was asked:
Situation today:
I have a large Perl/Tk script called "myscript".
It is launched from the command line with arguments "arg1 arg2 arg3".
When executed, Perl fires up and "compiles" the code.
The code itself has an option (upon user request at a button click) to
launch ANOTHER instance of "myscript". It can be with the exact same
arguments (arg1 arg2 arg3) or with different values for these three
arguments.
Currently the NEW instance is launched using a background system call
(system "myscript .... &").
Of course more instances can be created whenever a user asks to (either from
the "original" instance or from new instances).
It is important that each instance is completely independent of the other
instances. When it is closed/killed - it should NOT affect any of the other
instances.
I would like to improve the performance of "myscript" such that new
instances created will NOT require Perl recompilation.
Can it be done ?
Thanks,
Oded
------------------------------
Date: Sun, 05 Jun 2005 16:21:48 +0200
From: "Kjetil Skotheim" <dont@mail.me>
Subject: Re: counting word occurances
Message-Id: <op.srwh6mxr3z78ff@edelweiss.upc.no>
On Sat, 04 Jun 2005 23:57:05 +0200, Abigail <abigail@abigail.nl> wrote:
> Rodrick Brown (rodrick.brown@gmail.com) wrote on MMMMCCXCIV September
> MCMXCIII in <URL:news:c7Qne.4832$jU5.1473111@twister.nyc.rr.com>:
> [] Hello,
> []
> [] Just learning Perl so bare with me.
> []
> [] I have the following output file:
> []
> [] pear
> [] apple
> [] apple
> [] orange
> [] mango
> [] mango
> [] pear
> [] cherry
> [] apple
> []
> [] ill would like the count the ammount of occurances for each fruit.
>
>
> No need for perl here. Just some standard shell tools will do a fine job:
>
> grep -v '^ ' input_file | sort | uniq -c
>
> Abigail
No, that will not count " apple" and " orange" or any other lines
starting
with one or more spaces. This will work better:
perl -ple 's/^\s+//' input_file | sort | uniq -c
Or:
perl -nle 's/^\s+//;$c{$_}++;END{printf("%6d %s\n",$_,$c{$_}) for
sort{$c{$a}<=>$c{$b}}keys%c}' input_file
--
Kjetil Skotheim
------------------------------
Date: 05 Jun 2005 21:24:50 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: counting word occurances
Message-Id: <slrnda6rd2.ch.abigail@alexandra.abigail.nl>
Kjetil Skotheim (dont@mail.me) wrote on MMMMCCXCVI September MCMXCIII in
<URL:news:op.srwh6mxr3z78ff@edelweiss.upc.no>:
== On Sat, 04 Jun 2005 23:57:05 +0200, Abigail <abigail@abigail.nl> wrote:
==
== > Rodrick Brown (rodrick.brown@gmail.com) wrote on MMMMCCXCIV September
== > MCMXCIII in <URL:news:c7Qne.4832$jU5.1473111@twister.nyc.rr.com>:
== > [] Hello,
== > []
== > [] Just learning Perl so bare with me.
== > []
== > [] I have the following output file:
== > []
== > [] pear
== > [] apple
== > [] apple
== > [] orange
== > [] mango
== > [] mango
== > [] pear
== > [] cherry
== > [] apple
== > []
== > [] ill would like the count the ammount of occurances for each fruit.
== >
== >
== > No need for perl here. Just some standard shell tools will do a fine job:
== >
== > grep -v '^ ' input_file | sort | uniq -c
== >
== > Abigail
==
== No, that will not count " apple" and " orange" or any other lines
== starting
== with one or more spaces.
Oh, I though that was the intention of the OP.
== This will work better:
== perl -ple 's/^\s+//' input_file | sort | uniq -c
==
sed -e 's/^ *//' input_file | sort | uniq -c
Abigail
--
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/ xor !@ _?
exit print :
print and push @_ => shift and goto &{(caller (0)) [3]}}
split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
------------------------------
Date: 05 Jun 2005 21:26:52 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: counting word occurances
Message-Id: <slrnda6rgs.ch.abigail@alexandra.abigail.nl>
Abigail (abigail@abigail.nl) wrote on MMMMCCXCVI September MCMXCIII in
<URL:news:slrnda6rd2.ch.abigail@alexandra.abigail.nl>:
:: Kjetil Skotheim (dont@mail.me) wrote on MMMMCCXCVI September MCMXCIII in
:: <URL:news:op.srwh6mxr3z78ff@edelweiss.upc.no>:
:: == On Sat, 04 Jun 2005 23:57:05 +0200, Abigail <abigail@abigail.nl> wrote:
:: ==
:: == >
:: == > grep -v '^ ' input_file | sort | uniq -c
:: == >
:: ==
:: == No, that will not count " apple" and " orange" or any other lines
:: == starting
:: == with one or more spaces.
::
::
:: Oh, I though that was the intention of the OP.
And, indeed, it was. From the OP's attempt:
while(<LOG>)
{
next if(/^\s+/);
push(@fruits,$_);
}
It skips all lines starting with whitespace.
Abigail
--
#!/opt/perl/bin/perl -w
$\ = $"; $SIG {TERM} = sub {print and exit};
kill 15 => fork for qw /Just another Perl Hacker/;
------------------------------
Date: Sun, 05 Jun 2005 23:07:56 +0530
From: Murugesh <appumail@gmail.com>
Subject: Env export in perl
Message-Id: <X4Hoe.3$bi2.36@news.oracle.com>
HI,
I could not export Environmental varibles into the shell from a
perl script.
This is wat I have tried,
$ENV{PATH}="\/usr\/local\/bin:$ENV{PATH}";
Inside the program, when I print PATH, it is shown correctly.But, when
the program exits, the value of PATH expires and retains the old value.
How can we make it to retain the value, even after the program exits.
I ran the script in solaris .
Thanks in advance.
------------------------------
Date: Sun, 05 Jun 2005 17:57:44 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Env export in perl
Message-Id: <Xns966C8DCBB9F94asu1cornelledu@127.0.0.1>
Murugesh <appumail@gmail.com> wrote in news:X4Hoe.3$bi2.36
@news.oracle.com:
> $ENV{PATH}="\/usr\/local\/bin:$ENV{PATH}";
>
> Inside the program, when I print PATH, it is shown correctly.But, when
> the program exits, the value of PATH expires and retains the old value.
> How can we make it to retain the value, even after the program exits.
perldoc -q environment
You are supposed to check the FAQ before posting here.
> Thanks in advance.
*Sigh*
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sun, 05 Jun 2005 16:29:44 GMT
From: hope@hope.com
Subject: How to find a perl programer
Message-Id: <ip96a1te0f6nb3kdtqjjp6p9ga4o6rfm1l@4ax.com>
Hi all
Can anyone point me in the right places to find a perl programmer who can alter a existing
perl/cgi script in the UK
As always, any and all help is greatly appreciated.
Thank you in advance.
------------------------------
Date: Sun, 05 Jun 2005 16:52:09 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: How to find a perl programer
Message-Id: <Xns966C82AE68DD8asu1cornelledu@127.0.0.1>
hope@hope.com wrote in news:ip96a1te0f6nb3kdtqjjp6p9ga4o6rfm1l@4ax.com:
> Can anyone point me in the right places to find a perl programmer who
> can alter a existing perl/cgi script in the UK
http://jobs.perl.org/login?redir=%2Femployer%2Findex
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: 5 Jun 2005 17:02:00 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: How to find a perl programer
Message-Id: <Xns966C7A4CBF68Acastleamber@130.133.1.4>
wrote:
> Hi all
>
> Can anyone point me in the right places to find a perl programmer who
> can alter a existing perl/cgi script in the UK
http://www.google.com/search?q=perl%20programmer
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Sun, 05 Jun 2005 15:13:34 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: How to find a perl programer
Message-Id: <J_-dnSaFT-Rn9z7fRVn-tw@comcast.com>
hope@hope.com wrote:
> Hi all
>
> Can anyone point me in the right places to find a perl programmer who
> can alter a existing perl/cgi script in the UK
alt.comp.perlcgi.freelance
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 8150
***************************************