[19202] in Perl-Users-Digest
Perl-Users Digest, Issue: 1397 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 28 18:05:44 2001
Date: Sat, 28 Jul 2001 15:05:10 -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: <996357910-v10-i1397@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 28 Jul 2001 Volume: 10 Number: 1397
Today's topics:
Re: CGI:standard (Alan Barclay)
Re: CGI:standard (Alan Barclay)
Re: chess in perl (Alan Barclay)
Re: Emal Options Robustness <iltzu@sci.invalid>
Entire File Contents from Command line (Chandramohan Neelakantan)
Re: Entire File Contents from Command line <iltzu@sci.invalid>
FAQ: How do I change the Nth occurrence of something? <faq@denver.pm.org>
Re: Finding a word in a sorted list. <goldbb2@earthlink.net>
How to sort old mailboxes (Marco F)
Re: How to use setuid in perl? <nowhere@dot.com>
I'm doing a script to append text to a file but do not (Lawrence)
Re: Incomplete output from crontab email: running shell <goldbb2@earthlink.net>
Re: internationalization in perl <member@dbforums.com>
Large file upload through https <arifsaha@yahoo.com>
Mod_perl-processes restarts to often <schabernackel@hotmail.com>
Re: Mod_perl-processes restarts to often <carlos@plant.student.utwente.nl>
OFF-TOPIC (was Re: Stripping extention from a filename <mbudash@sonic.net>
Re: Perl and PL/SQL, which one is better? <no@spam.net>
Re: proc(@$var) v. &proc($var) with (\@) prototype (was <kevin@vaildc.net>
Re: SHEBANG ? <jntkirk@nospam.mediaone.net>
Re: Sorting problem <iltzu@sci.invalid>
Re: Striping out the string <schabernackel@hotmail.com>
Re: Striping out the string <gnarinn@hotmail.com>
Re: Striping out the string <NOSPAM.dogansmoobs@ctel.net>
Re: Stripping extention from a filename in a string <callgirl@la.znet.com>
User Authentication in Unix <peter@webcanada.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Jul 2001 19:42:59 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: CGI:standard
Message-Id: <996349377.360385@elaine.furryape.com>
In article <9jqf4a$ikr$2@bob.news.rcn.net>,
Eric Bohlman <ebohlman@omsdev.com> wrote:
>Eric Bohlman <ebohlman@omsdev.com> wrote:
>browser. While the current version of the HTML spec requires browsers to
>submit parameters in the same order as the form fields themselves, many
>commonly-used browsers were released before that provision made it into
>the spec, and we all know how well browsers comply with the spec in any
>case. So it's probably not a good thing to count on. You'd be better off
>making an explicit list of parameter names that you're expecting and
>iterating over that rather than the list result of param().
I'd say that it's a good idea to do this anyway. If you don't, then
any redesign of the HTML will result in a different order of paramaters
in the file. We all know that HTML tends to be redesigned just after
the program is finally working bugfree...
------------------------------
Date: 28 Jul 2001 19:46:47 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: CGI:standard
Message-Id: <996349604.839167@elaine.furryape.com>
In article <Pine.A41.4.33.0107271200300.37604-100000@dante24.u.washington.edu>,
Brian D. Green <greenbd@u.washington.edu> wrote:
>On Fri, 27 Jul 2001, Alan J. Flavell wrote:
>
>> On Jul 26, Brian D. Green delicately tapped the keys:
>>
>> > > > $netid = $ENV{'REMOTE_USER'};
>> > >
>> > > > open(SAVE, ">>$netid.out") || die("Can't open $netid.out for writing:
>> > > > $!\n");
>> > >
>> > > It's *not* a good idea to open a file for writing or appending when its
>> > > name comes from outside your program and you haven't checked the name to
>> > > make sure it's reasonable.
>> >
>> > Thanks for the reminder. The user id's in this situation are all limited
>> > to alphanumerics with a maximum of eight characters, so I think they're
>> > pretty safe.
>>
>> Don't do that. You're in a security-exposed situation here. Apply a
>> defensive strategy, rather than trying to think of excuses for not
>> doing so.
>
>How would someone manage to fake their $ENV{'REMOTE_USER'}? The University
>of Washington's authentication security is some of the best in the world,
>and I've further limited access to the site via .htaccess and .htgroup
>files. Only students enrolled in this simulation have their id's in the
A bug in the authorization system would do it. Are you 100% sure that
there aren't any? 100% sure that future revisions won't introduce any?
Assuming that the data is correct instead of making sure of it is why
Microsoft programs tend to have lots of security bugs, eg the worm
which went defacing sites around this week.
------------------------------
Date: 28 Jul 2001 20:05:57 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: chess in perl
Message-Id: <996350751.84403@elaine.furryape.com>
In article <abf786a.0107261006.3b9708c0@posting.google.com>,
Sean Mintz <stmintz@yahoo.com> wrote:
>The code is at http://www.coe.uh.edu/~smintz/goober/new/Goober.pm
>
>Please help me! Speed is -very- important and I don't know what else
>to do to make it faster.
The procedure for making any program faster is
1) Check the algorythmn. If you've got the wrong algorythmn, then you
want to replace it with one which will be faster. There is no point in
optimizing a bubblesort, when replacing it with a quicksort would give
a much better improvement.
2) Once you're sure that you've got the best algorythmn you can,
profile the code. Identify which sections of code are taking up
the most time. In most programs, this will probably be a minority
of the program, there isn't usally much savings in trying to optimize
the initialization routines, because they're typically only
called once.
With perl, the Devel::DProf module is the default profiler,
you can run your script with
perl -d:DProf script.pl
then analyze it with dprofpp, eg dprofpp -u produced on my program
this:
Total Elapsed Time = 7.247387 Seconds
User Time = 7.177588 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c Name
98.7 7.089 7.089 200 0.0354 0.0354 main::short
0.98 0.070 0.070 1 0.0700 0.0700 main::long
So in this case, I'd look at optimzing the short() subroutine. It's
where nearly all the execution time is being spent.
------------------------------
Date: 28 Jul 2001 15:14:33 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Emal Options Robustness
Message-Id: <996332109.9640@itz.pp.sci.fi>
In article <3b62688d.159036@news.ozemail.com.au>, Kev wrote:
>
>Can someone please explain to me why the perl SMTP
>module is not the quickest option ?
There are really several cases here that people seem to be mixing:
A) Using SMTP to connect directly to the remote MX.
B) Using SMTP to connect to your company/ISP/etc mail server.
C) Using SMTP to connect to the host the script's running on.
D) Invoking sendmail on a server that already handles mail.
E) Invoking (and installing, if necessary) sendmail on a system on
which it is not generally used.
There are probably more, and each of these could be split into
subcases. However, the point is that of these five choices, the
optimal ones are usually either B or D, depending on whether the host
your script is running on is already running sendmail too. So the
answer to "should I use SMTP or sendmail" is "whichever works better for
you."
Choice C can be sometimes useful, simply because the only difference
between B and C, from the script's point of view, is the mail server
name. So B/C can be the most portable approach.
I can't think of any good reason to do A or E, but apparently some
people do. I suppose flexibility could be one.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: 28 Jul 2001 07:55:14 -0700
From: grip62501@yahoo.com (Chandramohan Neelakantan)
Subject: Entire File Contents from Command line
Message-Id: <35fbdd3b.0107280655.2c968181@posting.google.com>
Hi
Im trying to let a variable eat the contents of a entire file from the command line
Whats the shortest way to do this?
regards
CM
------------------------------
Date: 28 Jul 2001 17:33:55 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Entire File Contents from Command line
Message-Id: <996341024.12694@itz.pp.sci.fi>
In article <35fbdd3b.0107280655.2c968181@posting.google.com>, Chandramohan Neelakantan wrote:
>
>Im trying to let a variable eat the contents of a entire file from the command line
>Whats the shortest way to do this?
Shortest? Almost certainly
my $variable = `cat $filename`;
The perl-only way of doing it would be
open FILE, $filename or die $!;
my $variable = do {
local $/; # temporarily undefine the record separator
<FILE>; # slurp!
};
You could make that into a subroutine and just call it for every file
you want to slurp.
sub slurp {
open FILE, $_[0] or die "Can't open $_[0]: $!\n";
local $/;
<FILE>;
}
Oh, and there's yet another way to do it
open FILE, $filename or die $!;
read FILE, my $variable, -s FILE;
This is probably the fastest of all, but only works for ordinary files.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Sat, 28 Jul 2001 18:18:15 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I change the Nth occurrence of something?
Message-Id: <HlD87.130$os9.194269184@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How do I change the Nth occurrence of something?
You have to keep track of N yourself. For example, let's say you want to
change the fifth occurrence of ""whoever"" or ""whomever"" into
""whosoever"" or ""whomsoever"", case insensitively. These all assume
that $_ contains the string to be altered.
$count = 0;
s{((whom?)ever)}{
++$count == 5 # is it the 5th?
? "${2}soever" # yes, swap
: $1 # renege and leave it there
}ige;
In the more general case, you can use the "/g" modifier in a "while"
loop, keeping count of matches.
$WANT = 3;
$count = 0;
$_ = "One fish two fish red fish blue fish";
while (/(\w+)\s+fish\b/gi) {
if (++$count == $WANT) {
print "The third fish is a $1 one.\n";
}
}
That prints out: ""The third fish is a red one."" You can also use a
repetition count and repeated pattern like this:
/(?:\w+\s+fish\s+){2}(\w+)\s+fish/i;
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
04.26
--
This space intentionally left blank
------------------------------
Date: Sat, 28 Jul 2001 17:31:11 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Finding a word in a sorted list.
Message-Id: <3B632F1F.771B5B2@earthlink.net>
Mario Rizzuti wrote:
>
> I have a fixed-length-records file where:
>
> * each record is 18 bytes made by an username (12 bytes) and a number
> (6 bytes).
> * the records are sorted alphabetically.
>
> I am wondering what is the fastest possible way to find the associated
> numbers of a given list of usernames?
If you can change your file format, I would suggest you do so. Using a
space padded fixed length field is innefficient, since most usernames
won't take up the whole field, and the space on the end will be wasted.
Also, you *definitely* shouldn't be using a pack field "A6" for
something which you *know* will be a number. Use "N", which is 4 bytes
(two bytes fewer), and can store larger values.
You would be best off using a DB_File, with usernames as keys, and
either normal numbers as values, or numbers packed with "N" as values.
#! perl -w
use strict;
use DB_File;
tie my %users, "DB_File", ....;
my @users = qw/mario john bill/;
my @results = @users{@users};
# or:
# my @results = map { unpack "N", $_ } @users{@users};
If you are stuck with your file format, then the method you use [or
something like it] should be reasonably fast, depending on the speed of
IO. However, you might get better results by slurping the whole file
into memory, and then either doing the binary search on it, or using a
hash.
Slurp method and hash:
my @names = qw/mario john bill/;
my %users = do {
open( my $ind, "<", "user.ind" )
or die "Can't open 'user.ind': $!\n";
local $/ = \18;
map { unpack "A12 A6", $_ } <$ind>;
};
my @results = @users{@names};
Using a hash is the preferred way to do it.
Slurp and array:
my @names = qw/mario john bill/;
my @users = do {
open( my $ind, "<", "user.ind" )
or die "Can't open 'user.ind': $!\n";
local $/ = \18;
<$ind>;
};
if( length( $users[-1] ) != 18 ) {
warn "Last record is truncated. Discarding it.\n";
pop @users;
}
# there's no need to search for any name more than once.
my @snames = do { my %seen; grep !$seen{$_}++, sort @names };
my %results;
my $min = 0;
while( @snames ) NAME: {
use integer; # avoid the need for int()
my $max = scalar @users;
# begin with an educated guess:
my $try = $min + ($max-$min) / (@snames+1);
my $name = shift @snames;
while( $min < $max ) BINARY_SEARCH: {
my ($name2, $number) = unpack("A12 A6", $users[$try]);
my $cmp = $name cmp $name2;
if( $cmp == 0 ) {
%results{$name} = $number;
$min = $try+1;
next NAME;
} elsif ( $cmp < 0 ) {
$max = $try;
$try = ($try + $min) / 2;
} else {
$min = $try+1;
$try = ($try + $max) / 2;
}
}
warn "User $name couldn't be found\n";
}
@results = @results{@names};
> Thanks for any suggestion.
>
> This is what I have so far:
[snip]
> my @stats = stat "user.ind";
> my $min = 0;
> my $max = $stats[7] / 18; # how many records
One problem with putting $max up here, is that you need to reset it to
the number of records, *after every search*, which you don't do (making
your algorithm wrong). Using the "-s" operator may be faster than using
the "stat" function (since you don't need all the fields). Also, you
can probably get a faster stat on the open filehandle, than on the
filename.
open INDEX, ....
my $min = 0;
my $size = ((-s INDEX) / 18);
stat(INDEX); # stores result so you can access it via _ filehandle.
foreach ....
my $max = $size;
While you do want to keep $min from the last search, you don't want keep
$max, but instead reset it to the end.
NB: none of this code is tested.
--
I need more taglines. This one is getting old.
------------------------------
Date: 28 Jul 2001 13:46:37 -0700
From: web_fm_1@libero.it (Marco F)
Subject: How to sort old mailboxes
Message-Id: <f97f0f80.0107281246.24afbba3@posting.google.com>
Hello everybody.
I have already looked around in CPAN and newsgroup archives without
success, as almost all scripts and documentation available are there
to send email or manage incoming message, not to put order in an
existing (completely messed up) collection of mailboxes.
Imagine having many mailboxes in mbox format, with many duplicated
messages, and not sorted at all by sender.
Is there any script that, with or without using the standard Mail modules
from CPAN:
for each mbox file
eliminates all duplicates
copies each remaining message into a new mbox file
corresponding to the year it was created, named
TEMP_YYYY
foreach TEMP_YYYY mbox
eliminates all duplicates
saves remaining messages by sender, i.e.:
saves all messages from addresses in the "friends"
list to mbox file FRIENDS_YYYY
saves all messages from addresses in the "linux"
list to mbox file LINUX_YYYY
.... same for all address lists
saves all messages left in mbox file UNSORTED_YYYY
Any help is appreciated.
Ciao,
Marco
------------------------------
Date: Sun, 29 Jul 2001 00:34:26 +1000
From: "Gregory Toomey" <nowhere@dot.com>
Subject: Re: How to use setuid in perl?
Message-Id: <mSz87.16310$a04.63186@newsfeeds.bigpond.com>
"ftp" <shyan@cse.cuhk.edu.hk> wrote in message
news:9ju5f2$e5u$3@eng-ser1.erg.cuhk.edu.hk...
> nobull@mail.com wrote:
> > ftp <shyan@cse.cuhk.edu.hk> writes:
>
> >> I don't know how to use setuid in Perl.
>
> > See perldoc and the descriptions of the $< $> $( $} variables in
> > perlvar.
>
> where can I find perldoc and perlvar?
>
> > --
> > \\ ( )
> > . _\\__[oo
> > .__/ \\ /\@
> > . l___\\
> > # ll l\\
> > ###LL LL\\
>
> --
The method I use is in perlsec (online version
http://www.perldoc.com/perl5.6/pod/perlsec.html )
Your web server may be running you scripts as a default user such as
"nobody".
The steps you need to do are:
Compile the wrapper C given above
Set the setuid bit in the executable (eg mode 6755).
Make sure the Perl program is readable by the C executable.
gtoomey
------------------------------
Date: Sat, 28 Jul 2001 21:34:07 GMT
From: lawrence@f-deans.freeserve.co.uk (Lawrence)
Subject: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <3b6327c7.22658935@news.freeserve.net>
I have a simple script I put together to solve a problem I had with my
mailing list addresses.
I have three text files with the names
newlist.txt
nolist.txt
yeslist.txt
I want to append the new data, on a weekly basis, from newlist.txt by
running a perl script to the relevant yeslist or nolist text file. I
have accomplished the append using the code pasted below but I don't
know how to stop duplicate entries being written to the 2 appended
files. Any help would be much appreciated!
The data on each line of the newlist file is 3 comma separated entries
like below
y, A Name, An email address,
y, Another Name, Another email,
,another name, another email,
,another no, another email
y, Another Name, Another email,
A yes response has a y, at the front a no response has no y
etc....
THE CODE SO FAR
$data_file="newlist.txt";
open(DAT, $data_file) || die("Could not open file!");
@raw_data=<DAT>;
close(DAT);
foreach $new (@raw_data)
{
chop($new);
($newlist,$newname,$newemail)=split(/\,/,$new);
if($newlist eq "y")
{
$listdata="yeslist.txt";
}
else
{
$listdata="nolist.txt";
}
open(DAT2,">>$listdata") || die("Cannot Open File");
print DAT2 "$newname\,$newemail\,\n";
close(DAT2);
}
Thanks
Lawrence
--
http://www.f-deans.freeserve.co.uk
http://www.flytyer.co.uk
------------------------------
Date: Sat, 28 Jul 2001 16:00:47 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Incomplete output from crontab email: running shell scripts from a perl script
Message-Id: <3B6319EF.5B4BBB06@earthlink.net>
John Gordon wrote:
>
> tenpercenter54@hotmail.com (tenpercenter) writes:
>
> > I am running a perl script from my crontab. The perl script that I
> > run executes shell scripts at the command line. My crontab sends me
> > the output from this perl script that runs shell scripts. However,
> > if I run the shell scripts directly from the crontab itself I get a
> > different output (the output that I want).
>
> > Why would a perl script that runs a shell script give me a different
> > "cron job" output then the shell script itself?
>
> jobs executed by cron can have a different environment than the same
> job executed in an interactive shell:
>
> + different $PATH
> + different current working directory
> + different shell (cron executes its jobs with sh. is sh your
> shell?)
Also:
+ no controlling terminal [tty or pty or whatever].
+ current uid, gid, and euid may be different (not sure on this).
The lack of a terminal is unlikely to cause problems, but you may have
permissions problems. This would be similar to when a program is called
via CGI.
--
I need more taglines. This one is getting old.
------------------------------
Date: 28 Jul 2001 17:57:47 -0500
From: tsourbier <member@dbforums.com>
Subject: Re: internationalization in perl
Message-Id: <3b63355b$1@usenetgateway.com>
You may want to check out www.i18ngurus.com it has a section of links
relating to Perl internationalization (Programming > Perl).
Cheers, Thierry www.i18ngurus.com editor.
Ramu Tubati wrote:
> How do you localize/internationalize sites written in Perl? Is there a
> concept of resource bundles?
--
Posted via dBforums, http://dbforums.com
------------------------------
Date: Sat, 28 Jul 2001 16:24:23 -0500
From: S P Arif Sahari Wibowo <arifsaha@yahoo.com>
Subject: Large file upload through https
Message-Id: <Pine.LNX.4.33.0107281621260.20186-100000@gede.parokinet.org>
Hi!
I am developing a web interface that - among other thing - allow people to
upload files to the server. These files can be quite large, up to several
hundred MBs at occassion.
Creating a upload page & upload CGI script using Perl and CGI.pm actually
not hard, in a short time I was able to develop a script that handle
upload beautifully using multipart form and form input type file. But it
only work for small file! On big file, after clicking the submit button,
the browser just stand still, the icon still rotating but nothing else
ever happen.
From what I read, this kind of behaviour may be a result of various
timeouts and limits in the browser, CGI.pm, or apache.
So here is my questions:
1. Do you have any idea which one causing it? The browser, CGI.pm, or
apache? The size of file causing the hanging seems depends of the speed of
connection (if it is faster, larger file can pass), so it must be a
timeout somewhere.
2. Is there any directives of apache may related to this issue?
Is there any variable in CGI.pm may related to this issue?
3. If the cause was the browser timeout, is there any way to solve this
problem?
4. I read before about the possibility to send some HTML to the browser
*while uploading the file* to avoid the browser timed out.
Is this possible? How?
5. Even if in some case the problem cannot be solved, is there any way for
the CGi script to force the browser to stop hanging and display some error
message?
6. A plus: is it possible to display the upload progress?
(maybe changing periodically)
Thank you!
--
S P Arif Sahari Wibowo
_____ _____ _____ _____
/____ /____/ /____/ /____ arifsaha@yahoo.com
_____/ / / / _____/ http://www.arifsaha.com/
------------------------------
Date: Sat, 28 Jul 2001 14:54:43 GMT
From: Haber Schabernackel <schabernackel@hotmail.com>
Subject: Mod_perl-processes restarts to often
Message-Id: <1105_996332481@f3bpc14>
I got two projects/webservers/systems where I use mod_perl.
On one project there is no problem. On the other the
processes seems to die off too soon and often. I prefered
mod_perl over cgi because I wanted to skip a a time
consuming initiation and store things in memory in front.
But every third request or so starts a new process
(according to $$). And I can not figure out the
difference in my two projects that causes this.
Experts, what is the most likely reason? Where can I look?
How can I test to pinpoint the exact problem?
Should I reconfigure my apache webserver?
(MaxServers...KeepAlive...???)
------------------------------
Date: Sat, 28 Jul 2001 22:19:19 +0200
From: "carlos" <carlos@plant.student.utwente.nl>
Subject: Re: Mod_perl-processes restarts to often
Message-Id: <9jv6o7$6p8$1@dinkel.civ.utwente.nl>
try something like:
MaxRequestsPerChild 1000
in your apache conf
--
c a ~ l () s
"Haber Schabernackel" <schabernackel@hotmail.com> wrote in message
news:1105_996332481@f3bpc14...
>
> I got two projects/webservers/systems where I use mod_perl.
>
> On one project there is no problem. On the other the
> processes seems to die off too soon and often. I prefered
> mod_perl over cgi because I wanted to skip a a time
> consuming initiation and store things in memory in front.
>
> But every third request or so starts a new process
> (according to $$). And I can not figure out the
> difference in my two projects that causes this.
>
> Experts, what is the most likely reason? Where can I look?
> How can I test to pinpoint the exact problem?
> Should I reconfigure my apache webserver?
> (MaxServers...KeepAlive...???)
>
>
------------------------------
Date: Sat, 28 Jul 2001 17:30:45 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: OFF-TOPIC (was Re: Stripping extention from a filename in a string)
Message-Id: <mbudash-E87B7D.10243928072001@news.sonic.net>
In article <3B62E833.E6E362F1@la.znet.com>, Kiralynne Schilitubi
<callgirl@la.znet.com> wrote:
> Tassilo von Parseval wrote:
>
> > Godzilla! wrote:
>
> > >Irrelevant. Your comments do not comply with the
> > >originating author's stated parameters.
>
> > Bogus. He said he wanted to remove extensions. He did _not_ say with one
> > single word that the extension would always consist of three letters.
> > The parameters as stated by the author were really just an example by
> > chance containing extensions with three letters.
> > [ ] You kow the meaning of 'abstraction'
>
> > >I find your articles to be consistently a detriment
> > >to this group. You serve no beneficial purpose here.
>
> >
> > While you only provide us with scripts that rather resemble qbasic than
> > Perl, but - interestingly enough - only in those case where you think
> > the task could be solved by involving substr or r?index.
>
>
> I am certain you sport a propeller equipped beanie.
>
oooo - where can i get one? i'd do just about *anything* to annoy
godzilla, after all the annoyance she's caused around here...
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Sat, 28 Jul 2001 21:40:13 GMT
From: "Misanthrope" <no@spam.net>
Subject: Re: Perl and PL/SQL, which one is better?
Message-Id: <1jG87.4128$bl1.600243@newsread1.prod.itd.earthlink.net>
You want to give us some more clues? This isn't enough data to order lunch
with.
<u518615722@spawnkill.ip-mobilphone.net> wrote in message
news:l.996089594.1705932617@[198.138.198.252]...
> We are running a perl scripts, in which we call several PL/SQL
> procedures.
>
> My question is, if we get rid of PL/SQL, use completely perl, will we get
any performance gain? In other word, is calling PL/SQL procedure
> expensive?
>
> Thanks
>
>
>
>
>
> --
> Sent by dbadba62 from hotmail in field com
> This is a spam protected message. Please answer with reference header.
> Posted via http://www.usenet-replayer.com/cgi/content/new
>
------------------------------
Date: Sat, 28 Jul 2001 13:21:50 -0400
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: proc(@$var) v. &proc($var) with (\@) prototype (was: Optimization Question)
Message-Id: <280720011321502696%kevin@vaildc.net>
In article <u9r8v1v7sr.fsf@wcl-l.bham.ac.uk>, <nobull@mail.com> wrote:
[chastises me with good reason]
Yes, I'm sorry. It was late, it was something I've been wondering
about for a while, I was reading Usenet...bad combination! Thank you
for answering anyway, because that's exactly the information I was
looking for: whether or not the copy of the array was created. That's
the question I should have asked.
I've changed the subject and edited the text to bring the question and
answer together in case some future person has a similar question.
Normally I wouldn't leave that much text in a followup just to say what
I did above. (And normally I wouldn't put the response above what I
was responding to, either. I'm only doing it now to get the text below
archived with a proper subject.)
> > If $var is a reference to an array, and there is a subroutine &proc
> > with a prototype of (\@), and I want to call &proc with $var as a
> > parameter and still satisfy the prototype, it's necessary to do
> > something like
> >
> > proc(@$var);
> >
> > which would be basically the same as &proc(\@$var). Does the \@$var
> > part get optimized back to $var, so that the latter is the same as
> > &proc($var)?
>
> No.
>
> sub proc (\@);
> &proc($var); # $var can be anything - passed directly
> proc(@$var); # error unless $var is usable as ARRAY-ref
>
> In the first case $_[0] within &proc will be an alias for $var.
>
> In the second case $_[0] will be an read-only copy of $var.
>
> This is unlikely to be significant unless $var is global.
>
> If $var is an ARRAY-ref then there's essentially no difference except
> speed and that will be small - no copy of the array itself is
> created.
>
> If $var is undef then in the second case it will be autovivified into
> an ARRAY-ref but in the first it won't.
>
> If $var is a reference to an object of a class that overloads @{}
> then in the first case proc will be passed a reference to the object
> but in the second it will be passed the result of calling the @{}
> overload method.
>
> To measure performance impact of this use Benchmark.
>
> If you care about speed that much you probably shouldn't be using
> Perl.
--
Kevin Michael Vail | a billion stars go spinning through the night,
kevin@vaildc.net | blazing high above your head.
. . . . . . . . . | But _in_ you is the presence that
. . . . . . . . . | will be, when all the stars are dead. (Rainer Maria Rilke)
------------------------------
Date: Sat, 28 Jul 2001 16:51:07 GMT
From: Jeff and Trilby Kirkland <jntkirk@nospam.mediaone.net>
Subject: Re: SHEBANG ?
Message-Id: <3B62ED95.8060409@nospam.mediaone.net>
The shebang tells the perl script where to find the perl executable. If
it is in /usr/bin/perl on your system, then put #!/usr/bin/perl. It
depends on the system.
-jlk
John P wrote:
> Hi there,
>
> Can anyone shed any light on the standard locations of perl ie what should
> be put in the SHEBANG line? I'm not talking about custom perl installations,
> just the normal stuff on most systems.
>
> I've got #!/usr/bin/perl and #!/usr/local/bin/perl
>
> Presumably there are others?
>
> Thanks in advance
>
> John
>
>
>
------------------------------
Date: 28 Jul 2001 14:47:59 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Sorting problem
Message-Id: <996331561.9442@itz.pp.sci.fi>
In article <3B61CB14.22B89759@wichita.boeing.com>, Jonathan Sala wrote:
>Is there a sort module that will sort the following first by
>alphanumerically and then the last part numerically.
>
>Example: Sort the following
> abc23 abc113 cde34 abc5 cde4 def77 abc1
>Into the following:
> abc1 abc5 abc23 abc113 cde4 cde34 def77
http://search.cpan.org/search?dist=Sort-Naturally
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Sat, 28 Jul 2001 14:32:13 GMT
From: Haber Schabernackel <schabernackel@hotmail.com>
Subject: Re: Striping out the string
Message-Id: <1104_996331131@f3bpc14>
On Sat, 28 Jul 2001 12:27:29 GMT, "Killiam" <Killiam@hotmail.com> wrote:
> I'm tying to strip out everything but a file extension of a variable "$file
> = c:\files\file.exe" and I what to end up with a variable of "$file = .exe"
$file = "c:\files\file.exe";
$file =~ s/^.+?(\.[^\.]+)$/$1/;
print "<$file>\n";
------------------------------
Date: Sat, 28 Jul 2001 15:40:11 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Striping out the string
Message-Id: <996334811.924326381180435.gnarinn@hotmail.com>
In article <Rcy87.17540$UH6.3293635@news02.optonline.net>,
Killiam <Killiam@hotmail.com> wrote:
>
> I'm tying to strip out everything but a file extension of a variable "$file
>= c:\files\file.exe" and I what to end up with a variable of "$file = .exe"
>I try $file =~ s/\.[^.]+$//; and that will strip out the ".exe" So shouldn't
>$file =~ s/\.[$.]+$//; strip out the "c:\files\file"
[
I am really curious, why do you think that?
is it because ^ means start of string in regexes, so $ (end of string)
must do the reverse?
]
the answer to your question is no, of course.
what you want is $file =~ s/[^.]+//;
gnari
------------------------------
Date: Sat, 28 Jul 2001 14:55:11 -0400
From: Mik Mifflin <NOSPAM.dogansmoobs@ctel.net>
Subject: Re: Striping out the string
Message-Id: <tm62jcp3clco54@corp.supernews.com>
> [
> I am really curious, why do you think that?
> is it because ^ means start of string in regexes, so $ (end of string)
> must do the reverse?
> ]
No, i believe you are wrong. ^ when with []'s means a reversal of the set,
so "everything not in the set".
--
- Mik Mifflin
dogansmoobs at ctel dot net
------------------------------
Date: Sat, 28 Jul 2001 09:28:35 -0700
From: Kiralynne Schilitubi <callgirl@la.znet.com>
Subject: Re: Stripping extention from a filename in a string
Message-Id: <3B62E833.E6E362F1@la.znet.com>
Tassilo von Parseval wrote:
> Godzilla! wrote:
> >Irrelevant. Your comments do not comply with the
> >originating author's stated parameters.
> Bogus. He said he wanted to remove extensions. He did _not_ say with one
> single word that the extension would always consist of three letters.
> The parameters as stated by the author were really just an example by
> chance containing extensions with three letters.
> [ ] You kow the meaning of 'abstraction'
> >I find your articles to be consistently a detriment
> >to this group. You serve no beneficial purpose here.
>
> While you only provide us with scripts that rather resemble qbasic than
> Perl, but - interestingly enough - only in those case where you think
> the task could be solved by involving substr or r?index.
I am certain you sport a propeller equipped beanie.
Godzilla!
------------------------------
Date: Sat, 28 Jul 2001 21:15:46 GMT
From: "Peter" <peter@webcanada.com>
Subject: User Authentication in Unix
Message-Id: <6YF87.103695$2V.23661401@news3.rdc1.on.home.com>
Hello:
I am trying to write a simple CGI to allow users to make a couple of changes
to their UNIX accounts via the web. I would like to authenticate them using
their UNIX username and passwords (for their UNIX username).
How do I verify the password as being correct?
Thanks,
Peter.
------------------------------
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.
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 1397
***************************************