[19203] in Perl-Users-Digest
Perl-Users Digest, Issue: 1398 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 29 03:05:36 2001
Date: Sun, 29 Jul 2001 00: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: <996390309-v10-i1398@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 29 Jul 2001 Volume: 10 Number: 1398
Today's topics:
Re: Compiling Perl with DBM support <somewhere@in.paradise.net>
Re: Emal Options Robustness (Kev)
FAQ: How can I count the number of occurrences of a sub <faq@denver.pm.org>
FAQ: How do I capitalize all the words on one line? <faq@denver.pm.org>
FAQ: How to merge 2 homepage's content to 1 homepage <skso@cse.cuhk.edu.hk>
Game for Computer Pros <nospam@newsranger.com>
Re: How to loop over files whose names are listed in a <goldbb2@earthlink.net>
how to modify default @INC <news@grooky.com>
Re: How to sort old mailboxes <tony_curtis32@yahoo.com>
Re: I'm doing a script to append text to a file but do <godzilla@stomp.stomp.tokyo>
Re: I'm doing a script to append text to a file but do <tsee@gmx.net>
Re: I'm doing a script to append text to a file but do <mbudash@sonic.net>
Re: Large file upload through https <jeff@vpservices.com>
Re: Mod_perl-processes restarts to often <gnarinn@hotmail.com>
Re: SHEBANG ? <somewhere@in.paradise.net>
suid support in Perl <somewhere@in.paradise.net>
Re: User Authentication in Unix (Logan Shaw)
Re: User Authentication in Unix <william-news-102374@scissor.com>
Re: viewing input from a form <goldbb2@earthlink.net>
Re: viewing input from a form <goldbb2@earthlink.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 29 Jul 2001 11:33:24 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: Compiling Perl with DBM support
Message-Id: <ILJ87.8$z81.308257@news.interact.net.au>
"Tintin" <somewhere@in.paradise.net> wrote in message news:...
> I'm running Mandrake 8 and was originally running the Perl 5.6.0 RPM that
> came with the CD. As the RPM doesn't allow you to manually install
modules,
> I compiled up Perl 5.6.1
>
> I was successfully using neomail (http://neomail.sourceforge.net/) with
the
> RPM'ed Perl version, but when I installed Perl 5.6.1 it didn't work. This
> was due to it not finding the DBM libraries.
>
> It uses the AnyDBM_File module, ie:
>
> BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File) }
>
> I definately have the GDBM RPM installed (libgdbm1-1.8.0-14mdk), but when
I
> tried to run neomail, the AnyDBM_File module barfed with the message:
>
> "No DBM package was successfully found or installed"
>
> I chose all the defaults when compiling Perl 5.6.1, so I can't remember if
> there is a question in there about DBM support.
>
> I noticed in the previous Perl version there was a GBM object file:
>
> /usr/lib/perl5/5.6.0/i386-linux/auto/GDBM_File/GDBM_File.so
>
> so I copied it to the 5.6.1 location (in /usr/local) and that fixed the
> problem with AnyDBM_File.
>
> Now, obviously that is a hack workaround to fix the problem. Should I
just
> be compiling Perl 5.6.1 again, or are there some other settings I need to
> look at?
I found out that even though I had the gdbm rpm installed, I needed to have
the gdbm-devel rpm as well.
------------------------------
Date: Sun, 29 Jul 2001 03:54:15 GMT
From: NOSPAMlekkerinsydney@ozemail.com.au (Kev)
Subject: Re: Emal Options Robustness
Message-Id: <3b6388e5.68691548@news.ozemail.com.au>
Thanks for all the responses.
Your option B is what I thought the SMTP module is
doing when I specify my Web Hosting company's smtp
server. I assume it is just "handing over" the
mail to the isp's "mail program" which will take
care of all the bits and pieces.
I think conceptually I have a few holes which need
to be filled :-)
When I am connected to my ISP from home, and send
an email and connect to their smtp server, isn't
there email program handling all the lookups etc ?
So canit I assume my webhosting company are
running sendmail / qmail etc themselves, so if I
just hand over the email to them, it may be the
quickest most robust option ?
Thanks again everyone.
Kev
On 28 Jul 2001 15:14:33 GMT, Ilmari Karonen
<iltzu@sci.invalid> wrote:
: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: Sun, 29 Jul 2001 00:18:22 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How can I count the number of occurrences of a substring within a string?
Message-Id: <iDI87.131$os9.191104000@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 can I count the number of occurrences of a substring within a string?
There are a number of ways, with varying efficiency. If you want a count
of a certain single character (X) within a string, you can use the
"tr///" function like so:
$string = "ThisXlineXhasXsomeXx'sXinXit";
$count = ($string =~ tr/X//);
print "There are $count X characters in the string";
This is fine if you are just looking for a single character. However, if
you are trying to count multiple character substrings within a larger
string, "tr///" won't work. What you can do is wrap a while() loop
around a global pattern match. For example, let's count negative
integers:
$string = "-9 55 48 -2 23 -76 4 14 -44";
while ($string =~ /-\d+/g) { $count++ }
print "There are $count negative numbers in the string";
-
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.27
--
This space intentionally left blank
------------------------------
Date: Sun, 29 Jul 2001 06:18:28 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I capitalize all the words on one line?
Message-Id: <UUN87.136$os9.191619584@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 capitalize all the words on one line?
To make the first letter of each word upper case:
$line =~ s/\b(\w)/\U$1/g;
This has the strange effect of turning ""don't do it"" into ""Don'T Do
It"". Sometimes you might want this. Other times you might need a more
thorough solution (Suggested by brian d. foy):
$string =~ s/ (
(^\w) #at the beginning of the line
| # or
(\s\w) #preceded by whitespace
)
/\U$1/xg;
$string =~ /([\w']+)/\u\L$1/g;
To make the whole line upper case:
$line = uc($line);
To force each word to be lower case, with the first letter upper case:
$line =~ s/(\w+)/\u\L$1/g;
You can (and probably should) enable locale awareness of those
characters by placing a "use locale" pragma in your program. See the
perllocale manpage for endless details on locales.
This is sometimes referred to as putting something into "title case",
but that's not quite accurate. Consider the proper capitalization of the
movie *Dr. Strangelove or: How I Learned to Stop Worrying and Love the
Bomb*, for example.
-
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.28
--
This space intentionally left blank
------------------------------
Date: 29 Jul 2001 01:47:33 GMT
From: So Siu Keung <skso@cse.cuhk.edu.hk>
Subject: FAQ: How to merge 2 homepage's content to 1 homepage
Message-Id: <9jvpvl$c5j$1@eng-ser1.erg.cuhk.edu.hk>
How to use "lynx" in perl or get other homepage's information
in a perl script?
Actually, I just want to merge 2 homepage's content to 1 homepage
and show it in IEplorer or Netscape!
I have written the following for reading 1 homepage's content but
it always timeout.
I am very frustrated. Please help me! Thanks!
------------------------------------------------------------
$ENV{'http_proxy'} = 'http://proxy.xxxxx.xxx.xxx:8000/';
$ENV{'ftp_proxy'} = 'http://proxy.xxxxx.xxx.xxx:8000/';
$ENV{'gopher_proxy'} = 'http://proxy.xxxxx.xxx.xxx:8000/';
$site1 = "/usr/local/bin/lynx -accept_all_cookies ".
"-dump http://xxx.xxx.xxx/index.html |";
open SITE1, $site1 or die "Cannot open $site1 for read :$!";
print "$site1\n";
while (<SITE1>)
{
print "Line $. is : $_\n";
}
------------------------------------------------------------
Terry So
------------------------------
Date: Sun, 29 Jul 2001 07:02:17 GMT
From: Matt <nospam@newsranger.com>
Subject: Game for Computer Pros
Message-Id: <ZxO87.10283$ar1.32407@www.newsranger.com>
I downloaded this security game from Verado. I thought you
might get a kick out of it. It's about an overworked,
stressed out IT guy. You fight off attacks from hackers
and spammers using shredders, flamers, etc.
Here is the link:
http://www.verado.com/forms/get_verado_game_2.shtml
Cheers,
Matt
------------------------------
Date: Sat, 28 Jul 2001 22:02:00 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How to loop over files whose names are listed in a file
Message-Id: <3B636E98.14606532@earthlink.net>
Francois Boury wrote:
>
> Sorry if my question is obvious but I do not use Perl often an I just
> able to modify existing code.
>
> So I have a file (files_list.txt fro instance) that contains some file
> names.
>
> How to replace my actual piece of code that is :
> while(<*.html>)
> {
> my $fichier_out=$fichier . ".tmp";
> remplacerBreves($_,$fichier_out);
> }
>
> by the same thing for all the files listed in files_list.txt ?
There's two ways. The first is to read a line at a time, the second is
to slurp, then loop on the list.
This is a read a line at a time version:
open(my $filelist, "<", "files_list.txt")
or die "Couldn't open files_list.txt: $!\n";
while(<$filelist>) {
chomp;
my $fichier_out=$fichier . ".tmp";
remplacerBreves($_,$fichier_out);
}
close $filelist;
This is a loop over a list version:
foreach( do {
open(my $filelist, "<", "files_list.txt")
or die "Couldn't open files_list.txt: $!\n";
<$filelist> } ) {
chomp;
my $fichier_out=$fichier . ".tmp";
remplacerBreves($_,$fichier_out);
}
I don't bother to close $filelist in this version, because a lexically
scoped variable, and the file closes automagically when all references
go out of scope.
--
I need more taglines. This one is getting old.
------------------------------
Date: Sun, 29 Jul 2001 00:29:29 +0200
From: "Nicolas" <news@grooky.com>
Subject: how to modify default @INC
Message-Id: <9jve8k$8m3$1@neon.noos.net>
I used perl 5.6.0 until few days ago.
Then I installed 5.6.1 with CPAN. The new librairies have been installed in
/usr/local/lib/perl5/5.6.1
Unfortunately, the default @INC is still /usr/local/lib/perl5/5.6.0.
How can I modify the default @INC so it will point to my 5.6.1 directory.
Tks
Nicolas
------------------------------
Date: 28 Jul 2001 17:06:07 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How to sort old mailboxes
Message-Id: <87snfgemk0.fsf@limey.hpcc.uh.edu>
>> On 28 Jul 2001 13:46:37 -0700,
>> web_fm_1@libero.it (Marco F) said:
> 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.
There's Mail::Box. That might do what you want, or at
least do the hard work of reading the mailbox format.
http://search.cpan.org/doc/MARKOV/Mail-Box-1.318/Box.pm
hth
t
--
Beep beep! Out of my way, I'm a motorist!
------------------------------
Date: Sat, 28 Jul 2001 16:11:25 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <3B63469D.F8925B3B@stomp.stomp.tokyo>
Lawrence wrote:
(snipped)
> 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!
You have created a classic x-axis versus y-axis problem
when you should be looking at your z-axis.
Eliminate all three files and create one master list
of names and email addresses. Work from one simple
master list.
You really should not mix your format. Develop a single
format and use it consistently. Placing a y for yes in
some records and a blank for no in others, is illogical
although this will work. You are likely to create a
problem eventually with a null field.
masterlist.dat
y,name,email
n,name,email
n,name,email
y,name,email
while (<MASTERLIST>)
{
if (substr ($_, 0, 1) eq "y")
{ push (@Yes, $_); }
elsif (substr ($_, 0, 1) eq "n")
{ push (@No, $_); }
else
{ print "Boss, your database is FUBAR"; exit; }
}
You have two arrays, @Yes and @No , ready to be
used for whatever illogical thing you want to do.
Easy enough to change those push functions to
any function you want.
Consider looking at your problem's z-axis. You
are currently looking at a flat two-dimensional
picture rather than looking deep and discovering
where your true solution lies, upon the z-axis.
Godzilla Queen Of Xyaxis.
------------------------------
Date: Sun, 29 Jul 2001 01:17:29 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <9jvhqu$t8k$02$1@news.t-online.com>
"Lawrence" <lawrence@f-deans.freeserve.co.uk> schrieb im Newsbeitrag
news: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);
>
> }
You could read the yes/no files, store the data in memory and then compare.
Append if no match, don't append if there is a matching entry in the
appropriate file. If you have large files this will become very inefficient.
Depending on how you define 'duplicate' here, you could speed this up a
little bit. If 'duplicate' means same name, address and file (yes/no), then
you have to compare everything. If it means same name only you could
maintain a list of names (in a separate file) that you read in and compare
to.
Regards,
Steffen Müller
------------------------------
Date: Sat, 28 Jul 2001 23:59:10 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <mbudash-07859D.16530528072001@news.sonic.net>
In article <3b6327c7.22658935@news.freeserve.net>,
lawrence@f-deans.freeserve.co.uk (Lawrence) wrote:
> 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
try this (may not be best choice for large newlist.txt's):
my $data_file='newlist.txt';
# let perl tell you why if failed by using $!
open (DAT, $data_file) || die("Could not open $data_file!: $!");
my @raw_data = <DAT>;
close (DAT);
my ($newlist, $newname, $newemail, $entry, %yeshash, %nohash);
# no need for a temp var
foreach (@raw_data)
{
# chomp safer than chop: only chops a $/
chomp;
# get rid of leading/trailing spaces
($newlist,$newname,$newemail) = split(/\s*,\s*/);
# get the new entry ready
$entry = "$newname,$newemail,";
# put the new entry in the proper holding queue (hash)
if($newlist eq 'y')
{
$yeshash{$entry}=1;
}
else
{
$nohash{$entry}=1;
}
} # end foreach
append('yeslist.txt', \%yeshash);
append('nolist.txt', \%nohash);
sub append
{
my ($filename, $hashref) = @_;
open (FILE, "+>>$filename") || die("Could not open $filename!: $!");
# rewind
seek (FILE, 0, 0);
my ($name,$email);
# drop queue entries for exisiting records
while (<FILE>)
{
chomp;
($name,$email) = split /\s*,\s*/;
# delete this hash key (ignored if not defined)
delete $hashref->{"$name,$email"};
}
# append any remaining hash entries to file
foreach (keys %{$hashref})
{
print FILE "$_\n";
}
} # end sub append
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Sat, 28 Jul 2001 16:21:19 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Large file upload through https
Message-Id: <3B6348EF.5A721C52@vpservices.com>
S P Arif Sahari Wibowo wrote:
> 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.
As far as CGI.pm goes, read the section in the docs that came with it on
"Avoiding Denial of Service Attacks" which includes information on the
$CGI::POST_MAX variable as well as on why you might not want to set it
too high in some situations.
--
Jeff
------------------------------
Date: Sat, 28 Jul 2001 22:13:03 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Mod_perl-processes restarts to often
Message-Id: <996358383.96682146564126.gnarinn@hotmail.com>
In article <1105_996332481@f3bpc14>,
Haber Schabernackel <schabernackel@hotmail.com> wrote:
>
>I got two projects/webservers/systems where I use mod_perl.
(snip)
>But every third request or so starts a new process
>(according to $$).
>Experts, what is the most likely reason? Where can I look?
>How can I test to pinpoint the exact problem?
do the logs not say anything?
>Should I reconfigure my apache webserver?
>(MaxServers...KeepAlive...???)
>
maybe you configured MaxRequestsPerChild 3
gnari
------------------------------
Date: Sun, 29 Jul 2001 11:13:06 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: Re: SHEBANG ?
Message-Id: <GsJ87.7$Q71.293985@news.interact.net.au>
"Jeff and Trilby Kirkland" <jntkirk@nospam.mediaone.net> wrote in message
news:3B62ED95.8060409@nospam.mediaone.net...
> > 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?
>
> 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.
I think you misunderstood the OP question. They just wanted to know what
are the most common locations of perl.
/usr/bin/perl and /usr/local/bin/perl cover about 99% of Perl installations
on Unix (and similar) systems.
------------------------------
Date: Sun, 29 Jul 2001 16:34:58 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: suid support in Perl
Message-Id: <raO87.14$9f1.426087@news.interact.net.au>
I'm running Mandrake 8.0 that had a RPM version of Perl 5.6.0 installed. I
was using a script that had sgid bit set (to read mail). I then manually
installed Perl 5.6.1 and the sgid bit was being ignored.
What could cause this?
------------------------------
Date: 28 Jul 2001 18:03:33 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: User Authentication in Unix
Message-Id: <9jvgc5$ac9$1@charity.cs.utexas.edu>
In article <6YF87.103695$2V.23661401@news3.rdc1.on.home.com>,
Peter <peter@webcanada.com> wrote:
>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?
Well, first you have to look up the crypted version of the password,
which requires that you have access to it. You may not; it may be in
/etc/shadow, or on Solaris (and others) it could be in NIS+ and be
something you don't have access to. But if you can get it the crypted
version of the password, then the way to get it is probably with
getpwnam().
Once you have it, you use the crypt() function to encrypt the
supposedly-correct version and then compare the crypted string you
generated with the crypted version stored in the password file. If
they're the same, then the passwords match. (If they're not the same,
either the passwords don't match, or you didn't use the right salt.)
There's some example code that verifies a password in the output of
"perldoc -f crypt".
- Logan
--
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)
------------------------------
Date: Sat, 28 Jul 2001 18:23:41 -0700
From: William Pietri <william-news-102374@scissor.com>
Subject: Re: User Authentication in Unix
Message-Id: <tm6pctigb26m9e@corp.supernews.com>
Peter wrote:
> 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).
Note that this is not recommended, as it's a big security problem:
http://httpd.apache.org/docs/misc/FAQ.html#passwdauth
Under certain controlled circumstances you may be able to get away with it,
but you should only try this if you are a security expert and are sure the
risks are acceptable in your situation.
William
----
brains for sale: http://scissor.com/
------------------------------
Date: Sat, 28 Jul 2001 18:15:45 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: viewing input from a form
Message-Id: <3B633991.3D3C199B@earthlink.net>
rolf deenen wrote:
>
> Hi there,
>
> small question here. I'm fiddling around at the moment with cgi and
> forms en i have the following question: My forms use the POST method
> of sending data which is the fed into a certain script. But is it also
> possible to print this input to my console so I can seen what data
> enters the script?
If all you want is to learn what the POST contents look like, then the
following simple script will do:
#! perl
print "Content-type: text/plain\015\012\015\012";
while( my $cnt = sysread( STDIN, $_, 1024 ) ) {
print;
}
if( !defined( $cnt ) ) {
print "\n", ("*" x 70), "\n";
print "unexpected EOF: $!\n";
}
exit;
--
I need more taglines. This one is getting old.
------------------------------
Date: Sat, 28 Jul 2001 18:58:40 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: viewing input from a form
Message-Id: <3B6343A0.61386976@earthlink.net>
Thomas Bätzler wrote:
>
> On 26 Jul 2001, rdeenen@mollymail.com (rolf deenen) wrote:
> >small question here. I'm fiddling around at the moment with cgi and
> >forms en i have the following question: My forms use the POST method
> >of sending data which is the fed into a certain script. But is it
> >also possible to print this input to my console so I can seen what
> >data enters the script?
>
[snip suggestion for dumping params to a file]
>
> But if you're just fiddling with CGI, why don't you print those CGI
> params out on the result page, i.e:
>
> --------8<----( cut here )----8<--------
> #!/usr/bin/perl -wT
>
> use strict;
> use CGI qw(:standard);
>
> my $q = new CGI;
>
> my @keys = $q->param;
>
> my @tablebody = $q->Tr( $q->th(['Parameter','Value']) );
>
> foreach my $key ( sort @keys ){
> push @tablebody, $q->Tr( $q->td( [ $key, $q->param( $key ) ] ) );
> }
>
> print $q->header(),
> $q->start_html( -title => 'List of CGI Parameters' ),
> $q->h1("List of CGI Parameters"),
> $q->table( @tablebody );
> $q->end_html();
>
> __END__
There's usually no need to use the OO interface for CGI. It's ugly and
cumbersome.
#!/usr/bin/perl -wT
use strict;
use CGI qw(:standard);
print header,
start_html("List of CGI Parameters"),
h1("List of CGI Parameters"),
table( Tr [
th( [ "Parameter", "Value" ] ),
map {
td [ pre($_), pre(param $_) ]
} sort param
] ), end_html;
__END__
--
I need more taglines. This one is getting old.
------------------------------
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 1398
***************************************