[17032] in Perl-Users-Digest
Perl-Users Digest, Issue: 4444 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 27 11:05:27 2000
Date: Wed, 27 Sep 2000 08: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: <970067110-v9-i4444@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Sep 2000 Volume: 9 Number: 4444
Today's topics:
Re: [Q]Perl CGI on Netscape enterpirse server 3.0 faile <amonotod@netscape.net>
Re: CGI C Program output (Gwyn Judd)
DDE Utilities? feraldoc@my-deja.com
Re: DDE Utilities? <anders@wall.alweb.dk>
Re: foreach two elements at a time? (Abigail)
Re: interpreter optimizations <ter@my-deja.com>
lowercase and UPPERCASE <richard.bossart@epfl.ch>
Re: lowercase and UPPERCASE (Bernard El-Hagin)
Re: lowercase and UPPERCASE (Gwyn Judd)
Re: lowercase and UPPERCASE <anders@wall.alweb.dk>
Re: lowercase and UPPERCASE (Abigail)
Re: lowercase and UPPERCASE <anders@wall.alweb.dk>
Re: Newbie windows perl question <anders@wall.alweb.dk>
Re: Perl & WAIS <berube@odyssee.net>
Re: Perl & WAIS (Gwyn Judd)
Re: perl modules and insecure dependency errors (Gwyn Judd)
Re: Problem with open() <ren.maddox@tivoli.com>
Re: regex problem (Keith Calvert Ivey)
Re: regex problem <ren.maddox@tivoli.com>
Re: Salary Range for Perl Programmers <russ_jones@rac.ray.com>
Re: Salary Range for Perl Programmers <russ_jones@rac.ray.com>
Re: Setting cookies with CGI.pm <anders@wall.alweb.dk>
shell problem <chacko@icd.teradyne.com>
Re: shell problem <dsimonis@fiderus.com>
SIGALRM with NT <bittnerrd@my-deja.com>
Re: system("cd /var") command <amonotod@netscape.net>
Re: Thnaks to the Gurus! <bmb@ginger.libs.uga.edu>
Re: What does this do?! <yanick@babyl.sympatico.ca>
Win32::Process::Create Help! dj_morri@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 27 Sep 2000 13:32:11 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: [Q]Perl CGI on Netscape enterpirse server 3.0 failed
Message-Id: <8qssss$r32$1@nnrp1.deja.com>
In article <8qsfta$n59$1@bt02e2.god.bel.alcatel.be>,
"Wenjie Zhao" <gokkog@yahoo.com> wrote:
> Hello,
>
> We have an application with many cgi scripts written in Perl.
> We have tested it under Apache web server.
> Now the targeted platform changed to Netscape Enterprise
> Server 3.0, Some strange thing happened:
It doesn't matter what type of CGI you're using, this is not
necessarily a Perl question. You should take this question to another
newsgroup, preferably either a CGI or webserver group. However, since I
am familiar with, and indeed prefer, NES, I'll work with you on this...
>
> Some cgi scripts work fine while others failed. the Logs
> say that "cannot print a valid header". We thought it's related
> to our own ParamConfig.pm used in the cgi scripts. After
> renaming this module, some other disturbing words tell
> redefined of New ...Exporter...
>
> Does somebody have a clue for the problem?
>
> P.S. I checked Netscape's web site, it says this (cannot print
> a valid header) may be due to dependencies on external
> libraries, I tried their solution(absolute lib path), but it won't
work.
>
NES is _very_ particular about having a CGI return something, anything,
it doesn't care what, as long as it gets at least two newlines per
script. Most likely, you don't have all the libraries which your
scripts are dependent on. For each script that won't run through the
webserver, try running it from the command prompt, on the system which
houses the web server, preferably as the webserver account.
Also, try this: For each script that won't run, replace it with this:
#!perl -w
# Hello world
print "Content: Type=text/html\n\n";
print "<html>\n<body>\n";
print "<h2> Hello World\!</h2>\n";
print "</body>\n</html>\n";
That will at least tell if the server is able to find the script.
Really, though, I think it is a matter of missing libraries...
HTH,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 13:23:06 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: CGI C Program output
Message-Id: <slrn8t3t5o.6s7.tjla@thislove.dyndns.org>
I was shocked! How could ppvm@my-deja.com <ppvm@my-deja.com>
say such a terrible thing:
>Hi all !
>
> I am a computer science student. I´m trying to do a
>cgi program in C language and i have a problem. I would thank you
>a lot if you could help me.
Troll-o-meter:
<--------------------------------------------*------>
That looks like an 8.5 to me. Pretty good going actually. I expect it
should get some bite amongst the unwary regulars.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Never ask the barber if you need a haircut.
-- Unknown
------------------------------
Date: Wed, 27 Sep 2000 13:31:29 GMT
From: feraldoc@my-deja.com
Subject: DDE Utilities?
Message-Id: <8qssrh$r2h$1@nnrp1.deja.com>
I'm tweaking a stone-age program which uses DDE for inter-program
communications.
Any Perl Modules or utilities out there?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 16:09:56 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: DDE Utilities?
Message-Id: <0enA5.2$Qu1.80@news000.worldonline.dk>
feraldoc@my-deja.com wrote:
> I'm tweaking a stone-age program which uses DDE for inter-program
> communications.
>
> Any Perl Modules or utilities out there?
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Ever heard of CPAN?
http://search.cpan.org provides quite nice earch facilities!
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: 27 Sep 2000 14:20:04 GMT
From: abigail@foad.org (Abigail)
Subject: Re: foreach two elements at a time?
Message-Id: <slrn8t40e6.lo9.abigail@alexandra.foad.org>
Bart Lateur (bart.lateur@skynet.be) wrote on MMDLXXXIV September MCMXCIII
in <URL:news:uln3ts4uc4jctsjfspv6v0defa3bf4qbf8@4ax.com>:
%% Uri Guttman wrote:
%%
%% > A> Huh? What's wrong with lexical $a and $b?
%% >
%% > A> I fail to see a problem here.
%% >
%% >poor style. IMO.
%% >
%% >in general i eschew single letter var names.
%%
%% In particular $a and $b. These seem to shout "sort sub!" at me.
Since the code in question is neither a sub, nor does it involve
sort, that would be a pretty strange reaction.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Wed, 27 Sep 2000 12:56:45 GMT
From: Tim Richardson <ter@my-deja.com>
Subject: Re: interpreter optimizations
Message-Id: <8qsqqa$pdc$1@nnrp1.deja.com>
In article <8qrl37$sl9$1@charm.magnus.acs.ohio-state.edu>,
ilya@math.ohio-state.edu (Ilya Zakharevich) wrote:
<snip>
> Ilya
>
Ilya, with this post you have turned lead into gold.
--
Tim Richardson (search string: qweeblebeast)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 15:26:46 +0200
From: Richard Bossart <richard.bossart@epfl.ch>
Subject: lowercase and UPPERCASE
Message-Id: <39D1F596.5BC5946E@epfl.ch>
Hi,
I'd like to compare an array of data with a single word independant of
whether its UPPERCASE or lowercase. So far I have
for(@data)
{
if(/$name/)
{
print $_, "<br>";
}
}
If data is eg.. John, Marius, Peter, Hannah, then it will find Peter but
not PETER or peTer... how can I correct this ?
Best regards
Richard
------------------------------
Date: 27 Sep 2000 13:31:28 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: lowercase and UPPERCASE
Message-Id: <slrn8t3tle.41b.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 27 Sep 2000 15:26:46 +0200, Richard Bossart
<richard.bossart@epfl.ch> wrote:
>Hi,
>
>I'd like to compare an array of data with a single word independant of
>whether its UPPERCASE or lowercase. So far I have
>
>for(@data)
> {
> if(/$name/)
> {
> print $_, "<br>";
> }
> }
>
>
>If data is eg.. John, Marius, Peter, Hannah, then it will find Peter but
>not PETER or peTer... how can I correct this ?
Read up on regexes and the m// operator. In this case (no pun intended)
you need to use the 'i' modifier of the m// operator like so:
if (/$name/i){
#blah
}
Or you could do this (which is probably faster):
if ($name eq lc){
#do stuff
}
Cheers,
Bernard
--
perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'
------------------------------
Date: Wed, 27 Sep 2000 14:03:48 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: lowercase and UPPERCASE
Message-Id: <slrn8t3vi2.6s7.tjla@thislove.dyndns.org>
I was shocked! How could Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
say such a terrible thing:
>Read up on regexes and the m// operator. In this case (no pun intended)
>you need to use the 'i' modifier of the m// operator like so:
>
>if (/$name/i){
> #blah
>}
>
>Or you could do this (which is probably faster):
>
>if ($name eq lc){
> #do stuff
>}
Although it is wrong. Or at least not equivalent.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Lack of will power has caused more failure than
lack of intelligence or ability.
-- Flower A. Newhouse
------------------------------
Date: Wed, 27 Sep 2000 16:08:48 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: lowercase and UPPERCASE
Message-Id: <%cnA5.1$Qu1.122@news000.worldonline.dk>
Gwyn Judd wrote:
> I was shocked! How could Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
> say such a terrible thing:
> >Read up on regexes and the m// operator. In this case (no pun intended)
> >you need to use the 'i' modifier of the m// operator like so:
> >
> >if (/$name/i){
> >#blah
> >}
> >
> >Or you could do this (which is probably faster):
> >
> >if ($name eq lc){
> >#do stuff
> >}
>
> Although it is wrong. Or at least not equivalent.
>
Our amazons are not particular helpful...
/^$name$/i
is equivalent to
lc($name) eq lc
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: 27 Sep 2000 14:29:25 GMT
From: abigail@foad.org (Abigail)
Subject: Re: lowercase and UPPERCASE
Message-Id: <slrn8t40vo.lo9.abigail@alexandra.foad.org>
Anders Lund (anders@wall.alweb.dk) wrote on MMDLXXXIV September MCMXCIII
in <URL:news:%cnA5.1$Qu1.122@news000.worldonline.dk>:
}}
}} Our amazons are not particular helpful...
}}
}} /^$name$/i
}}
}} is equivalent to
}}
}} lc($name) eq lc
}}
Not if $name contains regex metacharacters.
Abigail
--
perl -wle 'eval {die [[qq [Just another Perl Hacker]]]};; print
${${${@}}[$#{@{${@}}}]}[$#{${@{${@}}}[$#{@{${@}}}]}]'
------------------------------
Date: Wed, 27 Sep 2000 16:49:51 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: lowercase and UPPERCASE
Message-Id: <qPnA5.16$Qu1.965@news000.worldonline.dk>
Abigail wrote:
> Anders Lund (anders@wall.alweb.dk) wrote on MMDLXXXIV September MCMXCIII
> in <URL:news:%cnA5.1$Qu1.122@news000.worldonline.dk>:
> }}
> }} Our amazons are not particular helpful...
> }}
> }} /^$name$/i
> }}
> }} is equivalent to
> }}
> }} lc($name) eq lc
> }}
>
>
> Not if $name contains regex metacharacters.
>
>
> Abigail
You got a point there.
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Wed, 27 Sep 2000 15:06:25 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Newbie windows perl question
Message-Id: <simA5.2977$T3.156788@news000.worldonline.dk>
tayloremail@netscapeonline.co.uk wrote:
> Hi all.
> I am attempting to teach myself perl, and have found a simple form
> tutorial that emails form data to a recipient specified on the form.
> I am using a windows 98 box, with ActivePerl build 618 installed.
> I have executed the test script which worked successfully.
>
>
> The form HTML follows -
>
> <form action="C:/Program files/perl/mystuff/mailform.pl" method=GET>
> <input name="to" type="hidden" value="johnsonb">
> <b>To:</b> <code>johnsonb@ncsa.uiuc.edu</code>
> <br>
> <b>Subject:</b> <input name="subject" size=40>
> <br>
> <b>Comments:</b>
> <br>
> <textarea name="comments" ROWS=8 COLS=60></textarea>
> <br><input type="submit" value="Send">
> </form>
>
>
> The perl script is called "mailform.pl" and is below -
>
> #! ./perl
> # mailform - a simple CGI program to email the contents of an HTML
> # form to a specified user.
> #
> ########################################################################
> ##
> # Configuration parameters
> ########################################################################
> ##
> # this program's name
> $progname = "mailform";
> # the sendmail binary.
> $sendmail = "C:/windows/system/sendmail";
>
> #base of your httpd installation.
> $basedir = 'C:/';
> #log file
> $logfile = "$basedir/Program files/Perl/logs/$progname.log";
>
> # today
> $date = `date`;
> chop($date);
> # begin CGI output
> print("Content-type: text/html\n\n");
> ########################################################################
> ##
> # Process Query
> ########################################################################
> ##
> @cgiPairs = split("&",$ENV{'QUERY_STRING'});
> foreach $pair ( @cgiPairs ) {
> ($var,$val) = Split("=",$pair);
> #trust me on this magic
> $val =~ s/\+/ /g;
> $val =~ s/%(..)/pack("c",hex($1))/ge;
> $cgiVals{"$var"} = "$val";
> }
> $recipient = $cgiVals{"to"};
> #define an error routine:
> sub error {
> ($message) = @_;
> print("<b>ERROR:<b>",$message,"<p>Contact the author of the previous
> page for assistance\n");
> exit(0);
> }
> if ( ! $recipient ) {
> # the form did not have a to field
> # modify this text appropriately
> &error("No Return Address");
> }
> ########################################################################
> ##
> # Check Security
> ########################################################################
> ##
> # Users who wish to use this program must
> # put the file ".allowmailform" in their home directory on the
> # machine running this script. We don't want people creating
> # forms that are abused to send "ananymous" mail.
> $homedir = (getpwnam($recipient))[7];
> if (! -e "$homedir/.allowmailform") {
> # this user does not permit the server to send mail to him. Quit.
> &error("The recipient of the form has not enabled access for this
> form");
> exit(0);
> }
> # get ready to send mail
> if ( ! open(MAIL,"| $sendmail $recipient") ) {
> &error("Could not start mail program");
> }
> ########################################################################
> ##
> # construct the headers
> ########################################################################
> ##
> print(MAIL "To: recipient\n");
> if ( ! $cgiVals{'subject'} ) {
> $cgiVals{'subject'} = "(no subject)";
> }
> print(MAIL "Subject: $cgiVals{subject}\n");
> if ( ! $cgiVals{'from'} ) {
> $cgiVals{'from'} = "nobody";
> }
> print( MAIL "From: $cgiVals{from}\n");
> #done with the headers. Add the blank line.
> print( MAIL "\n");
> ########################################################################
> ##
> # construct the body.
> ########################################################################
> ##
> foreach $key ( keys(%cgiVals) ) {
> if ( $key eq "to" || $key eq "subject" || $key eq "from" ) {
> next;
> }
> print( MAIL "$key: $cgiVals{$key}\n");
> }
> ########################################################################
> ##
> # All done. Clean up.
> ########################################################################
> ##
> close(MAIL);
> # the response.
> print("Form submitted successfully. Thanks!");
> exit(0);
>
>
> I have a couple of questions.
> 1. I ran the form from within Dreamweaver, and when I hit the SUBMIT
> button, Internet Explorer asks if I want to save the program to
> disk, or open it from it's current location. I open it, and a DOS
> window pops up with just a flashing cursor. When I hit ENTER, an
> error is displayed, but the window closes again immediately.
> Is there any way to keep the window open?
> Can I test the program from within Dreamweaver this way, or am I
> being stupid?
>
> 2. How do I run the script from the DOS prompt?
> If I run it with 'perl mailform.pl', a flashing cursor appears until
> I hit ENTER, then it gives the error "No Return Address" - which
> means the script is working!
> How do I call it and pass a return address?
>
> Thanks for any help you can give.
> Damian.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Http and CGI questions does *NOT* belong on the perl ng!
WARNING --- off topic
You need to learn, learn and then learn some more.
To move on learning about CGI programming with perl, you could try
installing a web server, which will be a help since it can run a CGI script
and return the output to your browser.
The excellent tutorial that you found attemps to send mail using the
sendmail program, because the author of cause assumes that anybody wishing
to learn perl, would be clever enough to run a *X OS ;-))
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Wed, 27 Sep 2000 09:51:30 -0400
From: "Neb" <berube@odyssee.net>
Subject: Re: Perl & WAIS
Message-Id: <1VmA5.532$hs2.21647@news.globetrotter.net>
Well, each time you want to see an HTML page on my site, you call a script,
like:
script.pl?page=PAGE1
script.pl?page=PAGE2
and so on...
So, can a WAIS tool can Index my web site using these kind of URLs
(script.pl?page=PAGE1), instead of the usual static pages (like
/site/page1.html, /site/page2.html).
If so, can you refer me to such a tool? thanks.
neb
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> a écrit dans le message :
slrn8t31ko.6s7.tjla@thislove.dyndns.org...
> I was shocked! How could Neb <berube@odyssee.net>
> say such a terrible thing:
> >Hello,
> >
> >I need to be able to index all my pages of my web site. I know that WAIS
> >can do such a thing. But my site is entirely dynamically generated by a
> >Perl script. Each HTML page is generated by the script. Is it possible
to
> >use WAIS with Perl scripts?
>
> Not in general. Consider:
>
> #!/usr/bin/perl -w
> use strict;
> use CGI qw/:standard/;
> use CGI::Carp qw/fatalsToBrowser/;
>
> print header, rand;
>
> I think we need a little more information about how the pages are
> generated.
>
> --
> Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
> "Get back to your stations!"
> "We're beaming down to the planet, sir."
> -- Kirk and Mr. Leslie, "This Side of Paradise",
> stardate 3417.3
------------------------------
Date: Wed, 27 Sep 2000 14:02:01 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl & WAIS
Message-Id: <slrn8t3vem.6s7.tjla@thislove.dyndns.org>
I was shocked! How could Neb <berube@odyssee.net>
say such a terrible thing:
>Well, each time you want to see an HTML page on my site, you call a script,
>like:
>
>script.pl?page=PAGE1
>script.pl?page=PAGE2
>and so on...
Oh okay well that's different. In that case you don't want to index the
scripts, you want to index the PAGE1, PAGE2 etc files. That is what I
meant by "needing to know a bit more about the format of your data". All
you need to do in your search script is change it so it searches those
files instead.
>So, can a WAIS tool can Index my web site using these kind of URLs
>(script.pl?page=PAGE1), instead of the usual static pages (like
>/site/page1.html, /site/page2.html).
Doubtless you can.
>If so, can you refer me to such a tool? thanks.
Oh you don't have a partially written script for us to look at? Oh how
boring.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I'm still an atheist, thank God.
-- Luis Buñuel
------------------------------
Date: Wed, 27 Sep 2000 13:19:06 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: perl modules and insecure dependency errors
Message-Id: <slrn8t3su6.6s7.tjla@thislove.dyndns.org>
I was shocked! How could mari <mari@civil.columbia.edu>
say such a terrible thing:
>On Wed, 27 Sep 2000, Gwyn Judd wrote:
>
>> I was shocked! How could mari <mari@civil.columbia.edu>
>> say such a terrible thing:
>> >Im in the process of migrating mod_perl scripts from on server to
>> >another.. (Debian to Redhat).. and the only changes that have been made
>> >really are upgrading from Apache 1.3.9 to 1.3.12 and upgrading the
>> >Apache::Session module and other modules. I am running with PerlTaintCheck
>> >On, which simulates the -T switch, but so was the other server. I dont kow
>> >how they got around these errors w/o hacking the Apache::Session:File
>> >code.
>>
>> Have you read the documentation in:
>>
>> perldoc perlsec
>
>yes.
Sorry, your post didn't make that clear, I thought you had just read the
newsgroup.
<snip me pontificating>
>I know that. I thought the rest of my post made that clear. Or at least, i
>think that the data is tainted bc it's a file/directory from the
>filesystem? The dir is only writable by the owner, httpd. The value of the
I doubt it. Not if it's just the name of a file fom the filesystem.
Taint mode works by checking to see that any data that you got from
outside your program (ie. from user input or read in from a file or
output from another program) is not sent to another external entity such
as a program or file without you doing something to "untaint" that data.
So if that filename was created by your program then it shouldn't be a
problem.
>path of the dir is stored into the %session_data hash and is passed as a
>parameter for the tie function which intializes the %session_data and
>writes it to a dir where sessions are stored. The path to the directory is
>coded into the mod_perl script and the module generates random session ids
>as filenames. There's no user input anywhere, therefore, I came to the
Well what are you going to do with that filename? Are you going to write
to that file? Where does that data come from?
>conculsion, it must be tainted bc it's part of the filesystem. When I run
Nope. A filename '/etc/passwd' by itself is just data. There is no
way for perl to know whether it points to any particular thing in the
filesystem and nor should it care. It only cares when you use external
data to do stuff to other external things.
>tied(%session_data)->delete, the perl module picks out that key and the
>session id key, and tries to unlink them... I know i could do a untaint
>mechanism like described in perlsec, but my question was, is there any
Not until you know what it is that is causing the problem. There is no
point untainting something that's not tainted. And if you do something
silly like 's/(.*)/$1/' then you have achieved nothing except get rid of
an annoying warning without actually taking heed of what taint is trying
to tell you.
>other way to get this to work W/O hacking the module code bc obviously the
>orginal coders got around it somehow.. OR can I untaint in my mod_perl
>script and have it remain untainted..but i didnt think that would work, bc
Well it sounds like although you may have *read* perlsec, you didn't
really understand it or else you wouldn't be asking this question. Once
something is untainted, it is untainted for good (unless you combine it
with something else that is tainted). I think you need to go back and
reread perlsec until you really understand it.
>I'm sorry if i posted this to the wrong group, but it's where I saw the
>majority of these questions asked before when i went through deja. Perhaps
Nothing wrong with this sort of question here mari. If you can perhaps
create a small self contained script that exhibits the bahaviour so that
we can run it you may have more luck.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Vegeterians beware! You are what you eat.
------------------------------
Date: 27 Sep 2000 00:54:19 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Problem with open()
Message-Id: <m3n1gu9y7o.fsf@dhcp11-177.support.tivoli.com>
[Jeopardectomy + Pruning]
"Duncan Bayne" <dhbayne@xtra.co.nz> writes:
> "Duncan Bayne" <dhbayne@xtra.co.nz> wrote in message
> news:usfA5.1869$5qNb.34472011@news.xtra.co.nz...
> >
> > Could someone please help me with a problem I'm having. I have a script I
> > am running on two RH machines, RH5.0 and 7.0. On the 7.0 machine, the
> > script runs perfectly. On the 5.0 machine, the following code:
> >
> > # log details except password
> > open($LOG, '>>/home/grantlog/log.txt') or die;
> >
> > dies with the following message:
> >
> > Can't use an undefined value as filehandle reference at grant.cgi line
> > 118, <STDIN> chunk 1.
> >
> <obvious_explanation>
> The solution is to open LOG, not $LOG. I checked the other manpages, which
> contained the details.
> </obvious_explanation>
>
> Definite out-of-brain experience on my part.
Of course, the fact that it worked on the 7.0 machine presumably made
the out-of-brain experience all the more likely. The 7.0 machine
obviously has a more recent version of Perl that supports the new
semantic of passing an undefined scalar to open to have it create a
file handle on-the-fly.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 27 Sep 2000 12:57:39 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: regex problem
Message-Id: <39d3edde.46866600@news.newsguy.com>
Manuel Ho <mslho@my-deja.com> wrote:
>$myPattern = #...(garbage)#...(garbage)#...(garbage)#... etc
>
>how should i write the regex such that $1
>will be everything except the (garbage)?
You can't; $1 has to be a continuous stretch of characters.
To get rid of the garbage, however, you could do this:
$myPattern =~ s/\(garbage\)//g;
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: 27 Sep 2000 00:50:07 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: regex problem
Message-Id: <m3pulq9yeo.fsf@dhcp11-177.support.tivoli.com>
Manuel Ho <mslho@my-deja.com> writes:
> hi folks,
>
> suppose i have a string like this:
>
> $myPattern = #...(garbage)#...(garbage)#...(garbage)#... etc
>
> how should i write the regex such that $1
> will be everything except the (garbage)?
Well... without being sneaky, you're not going to be able to get $1 to
have multiple separate pieces of the original string. So the question
is, what do you *really* want.
Here is an answer based on the following assumptions:
1. The string given is meant to include literal "#", ".", "(" and ")"
characters, but "garbage" is meant to be anything, but does not
contain a ")".
2. You want a new string containing only the "#" and "." characters.
#!/usr/local/bin/perl -w
use strict;
my $string = "#...(blah blah -234 blah)#...(garbage)#...(more(stuff)#...";
(my $new_string = $string) =~ s/(#\.{3})\([^)]*\)/$1/g;
print $new_string, "\n";
__END__
And in some sense, $1 really is everything except the garbage -- just
not all at the same time. Of course, this doesn't seem particularly
useful -- perhaps my assumptions are wrong?
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 27 Sep 2000 08:28:23 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Salary Range for Perl Programmers
Message-Id: <39D1F5F7.9B11F914@rac.ray.com>
Uri Guttman wrote:
>
>
> using the wrong names and terms reflects poorly on the course and
> instructor. that implies the rest of the course may be lousy as well.
>
> same line of thought: any book with perl5 in the title sucks. there is no
> perl5, just perl. try to find a decent book with perl5 in the
> title. good luck.
>
(Please note: I do not use smiley faces, I'm not that cute. Some
segments included here might be intended to be ironic, if not
downright sarcastic. Please try to keep that in mind before you get
your drawers twisted up around your neck.)
Okay, now I get it. It's kind of like how using poor grammar or
punctuation or improper or omitted capitalization reflects poorly on a
writer of English, making all of their content suspect.
I know that the inventor of the language says it's Perl, not PERL.
It's his baby and I respect his decision, even if I think it's a silly
distinction. But the constant flogging of people for improperly using
"perl," "Perl" and "PERL" is pointless and elitist. I know of no other
language where a distinction is made between the language itself
(Perl) and the engine that executes that language (perl). COBOL is
COBOL. COBOL is Cobol is cobol. There's no
COBOL(language)/cobol(compiler) dichotomy. Most languages, nobody
knows how to capitalize them. Fortran, fortran, FORTRAN are all
acceptable: in the IBM manuals it's spelled all three ways. Same thing
with a FORTRAN/80 (sic) for TRS/80 manual that I just happen to have
laying around. The IBM manuals for COBOL always use "COBOL," but I
don't know any COBOL programmers that would be willing to pitch a fit
about it, other than maybe to tweak someone that was incorrectly
pontificating about it.
I agree that if there's a standard, one should try to use it. But
saying that a class sucks just because one person that came out of
that class said "PERL" instead of "Perl" is silly. It would be like
saying that every school uri (hey, that's how uri spells it, it's his
name, I respect his wishes) every school uri attended sucks because
uri doesn't use the shift key.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
And Glyndwr didn't pay $400 for any of my postings, so an additional
line in my .signature file didn't actually cost Glyndwr anything.
------------------------------
Date: Wed, 27 Sep 2000 09:14:58 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Salary Range for Perl Programmers
Message-Id: <39D200E2.FE1C4D4D@rac.ray.com>
Drew Simonis wrote:
>
>
> Hey Russ, aren't you in the 50K range too? =)
No, I have to pay them a lot more than that. I have to pay for two
real programmers to follow me around and clean up the stuff that I
screw up. But thanks for asking.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Wed, 27 Sep 2000 16:37:45 +0200
From: Anders Lund <anders@wall.alweb.dk>
Subject: Re: Setting cookies with CGI.pm
Message-Id: <6EnA5.9$tA.673@news010.worldonline.dk>
Matthew Couchman wrote:
> # Get cookie
> my %cookies = fetch CGI::Cookie; # fetch all cookies from
> ~/.netscape/cookies into a hash
> my $key = 'a_key';
I think you misunderstood something here. Nothing in the docs for CGI or
CGI::Cookie indicates that it can be used to manipulate cookies stored by a
web client, actually, both states that they are for use in CGI applications.
You dosen't seem to do a check, like
print "Cookie $_: $cookies{$_}->value()\n" foreach (keys %cookies);
which would show you whether %cookies contains anything, but I doubt it...
-anders
--
[ the word wall - and the trailing dot - in my email address
is my _fire_wall - protecting me from the criminals abusing usenet]
------------------------------
Date: Wed, 27 Sep 2000 10:16:20 -0400
From: Ranjit Chacko <chacko@icd.teradyne.com>
Subject: shell problem
Message-Id: <39D20134.4576D40D@icd.teradyne.com>
I have the following line in a script for moving some directories to a
new disk.:
`tar -cf - $_ | (cd $new_disk; tar -xBpf -)`;
Unfortunately it seems the line is given to /bin/sh which does not
understand it.
Is there some way to force Perl to use a different shell for stuff
between ` `?
What's the difference, if any, between using system and backticks
anyway?
------------------------------
Date: Wed, 27 Sep 2000 10:49:43 -0400
From: Drew Simonis <dsimonis@fiderus.com>
Subject: Re: shell problem
Message-Id: <39D20907.EF7F1521@fiderus.com>
Ranjit Chacko wrote:
>
> I have the following line in a script for moving some directories to a
> new disk.:
>
> `tar -cf - $_ | (cd $new_disk; tar -xBpf -)`;
>
> Unfortunately it seems the line is given to /bin/sh which does not
> understand it.
>
> Is there some way to force Perl to use a different shell for stuff
> between ` `?
In practice, no.
> What's the difference, if any, between using system and backticks
> anyway?
perldoc -f system
perldoc perlop (look for Quotes and Quote Like Operators)
------------------------------
Date: Wed, 27 Sep 2000 13:52:04 GMT
From: Ghost <bittnerrd@my-deja.com>
Subject: SIGALRM with NT
Message-Id: <8qsu22$s3b$1@nnrp1.deja.com>
I'm trying to use SIGALRM using perl 5.005_03 for NT
The code i'm trying to use is...
$SIG{ALRM} = sub {die "timeout"};
eval {
alarm(3600);
#Operation i'm trying to timeout here
alarm(0);
};
if ($@) {
if ($@ =~ /timeout/) {
print "timed out";
} else {
alarm (0);
die;
}
}
I get the following error
The Unsupported function alarm function is unimplemented at test.pl
line 15.
line 15 is the alarm (0); line just past the else. I'm assuming the SIG
{ALRM} is unsupported in NT. So, if there is any other way to time out
an operation in NT, I'd be tickled pink to find out. Thanks
--
Ghost
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 13:53:26 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: system("cd /var") command
Message-Id: <8qsu4j$s4q$1@nnrp1.deja.com>
In article <8qspos$of6$1@nnrp1.deja.com>,
aravindh@technologist.com wrote:
> In article <8qdgvn$g7o$1@mozo.cc.purdue.edu>,
> wjohnson@roger.ecn.purdue.edu (Wyatt R Johnson) wrote:
> > In article <8qdg4q$7tm$1@nnrp1.deja.com>,
> <aravindh@technologist.com> wrote:
> > >Hi,
> > >
> > >I want to execute the unix command - cd /var/ within perl. I know I
> > >should be doing system("cd /var/") or system("cd \/var\/") command.
> but
> > >don't seem to work. how can i do this?
> > >
> > >thanks
> > >aravindh
> > >
> > From the Unix side, a system() call spawns a new shell. The new
shell
> will
> > cd into /var. The system call ends, and the new shell that you just
> created
> > dies. Your program thus wont be that directory.
> >
> > Try using chdir instead
> >
> > Wyatt
> >
>
> I tried using chdir. But i am getting the same result - the directory
> does not change. any other way of doing this.
>
> thanks
> aravindh
>
First of all, don't post Jeopardy style. For an explanation of this,
see: http://www.geocities.com/amonotod.
Next, like everyone else is trying to tell you:
#!/usr/bin/perl
use strict;
use Cwd;
print cwd() ,"\n";
chdir ("/var");
print cwd() ,"\n";
exit;
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 27 Sep 2000 10:49:52 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Thnaks to the Gurus!
Message-Id: <Pine.A41.4.21.0009271048240.11204-100000@ginger.libs.uga.edu>
On Tue, 26 Sep 2000, Craig Berry wrote:
> Uri Guttman (uri@sysarch.com) wrote:
> : from memory (too lazy to reach over and look):
> :
> : loop: see loop.
>
> CS 101 professor: "In order to discuss recursion, we must first discuss
> recursion." You could spot the students who were going to ace the class;
> they laughed. :)
>
My showers are long. Shampoo bottle: "lather. rinse. repeat."
I know. Old joke.
Brad
------------------------------
Date: Wed, 27 Sep 2000 14:21:26 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: What does this do?!
Message-Id: <GnnA5.19162$vZ.932332@news20.bellglobal.com>
rathmore@tierceron.com wrote:
: When I compile the following code, nothing visible happens. I noticed
: that you can type and the type gets echoed back to the screen (or at
: least shows up on the screen). When I watch the code running in the
: debugger, I can follow what's happening but it just sits on the first
: while statement. Anything that I type after hitting return gets added
: to the $D scalar.
: Am I missing something? How do I force a break in the while statement
: without changing the code? Is this code brilliant or a waste of time?
: (I'll share the source of where this came from after a few people post
: their thoughts. Or maybe you've already seen it...)
It's an encryption/decryption program. To encrypt a file, do
mysterious.pl password clear.txt > encrypt.txt
and to decrypt it
mysterious.pl password encrypt.txt
Note that I called the script 'mysterious.pl', although
I have the feeling the original script was named
'X' or 'XXX' because of the statement
'$0=~s/X*$// if $d;' (I mean, it's obvious, isn't? ;)
In all cases, I have MO=Deparse'd the script and prettified
it a little bit.
Original version:
: #!/usr/bin/perl -s
: $f=$d?-1:1;$D=pack('C*',33..86);$p=shift;
: $p=~y/a-z/A-Z/;$U='$D=~s/(.*)U$/U$1/;
: $D=~s/U(.)/$1U/;';($V=$U)=~s/U/V/g;
: $p=~s/[A-Z]/$k=ord($&)-64,&e/eg;$k=0;
: while(<>){y/a-z/A-Z/;y/A-Z//dc;$o.=$_}$o.='X'
: while length ($o)%5&&!$d;
: $o=~s/./chr(($f*&e+ord($&)-13)%26+65)/eg;
: $0=~s/X*$// if $d;$o=~s/.{5}/$& /g;
: print"$o\n";sub v{$v=ord(substr($D,$_[0]))-32;
: $v>53?53:$v}
: sub w{$D=~s/(.{$_[0]})(.*)(.)/$2$1$3/}
: sub e{eval"$U$V$V";$D=~s/(.*)([UV].*[UV])(.*)/$3$2$1/;
: &w(&v(53));$k?(&w($k)):($c=&v(&v(0)),$c>52?&e:$c)}
Almost readable:
#!/smart2/bin/perl -s
# called as mysterious.pl [ -d ] <key> <text_file>
# -d is to decrypt the message
# E.g.: mysterious.pl password clear.txt > encrypt.txt
# mysterious.pl password encrypt.txt
$0 =~ s/X*$// if $d;
$D = pack('C*', (33..86));
$p = uc shift @ARGV;
$U = "\$D=~s/(.*)U\$/U\$1/;\n\$D=~s/U(.)/\$1U/;";
($V = $U) =~ s/U/V/g;
$p =~ s/[A-Z]/do { $k = ord($&) - 64, &e }/eg;
$k = 0;
$o = uc join '', <>;
$o =~ y/A-Z//cd; # remove anything but letters
$o .= 'X' while length($o) % 5 and not $d; # padding time
$f = $d ? -1 : 1;
$o =~ s/./ chr(($f * &e + ord($&) - 13) % 26 + 65) /eg;
$o =~ s/.{5}/$& /g; # split in segments of 5 letters
print "$o\n";
sub v {
my $x = shift;
$v = ord(substr $D, $x) - 32;
$v > 53 ? 53 : $v;
}
sub w {
my $x = shift;
$D =~ s/(.{$x})(.*)(.)/$2$1$3/;
}
sub e {
eval "$U$V$V";
$D =~ s/(.*)([UV].*[UV])(.*)/$3$2$1/;
&w(&v(53));
$k ? &w($k) : ($c = &v(&v(0)), $c > 52 ? &e : $c);
}
__END__
Hope that this help a wee bit. :)
Yanick
--
($_,$y)=('Yhre lo .kePnarhtretcae', '(.) (.)');
$y=~s/\(/(./gwhile s/$y/$2$1/xg;print # @
# `---'
------------------------------
Date: Wed, 27 Sep 2000 13:00:38 GMT
From: dj_morri@my-deja.com
Subject: Win32::Process::Create Help!
Message-Id: <8qsr1j$phk$1@nnrp1.deja.com>
Hi all,
I'm trying to spawn multiple perl processes from my main perl script.
fork() wont work for me on NT and Perl 5.005 (5.6 is not an option).
I know Win32::Process is the answer as I can get the example to spawn
Notepad, when run interactively from a CMD prompt.
Problem is, my script is launched via cgi and calls other perl scripts.
Process exits with code 249, except the child perl script never
executes. I know it is calling the perl.exe binary as if I change
the path I get an error. If I change the local.pl path, I still get
exit code 249.
I suspect I need to pass some environment flags, but I don't understand
the Export variables listed in the Win32::Process manpage. Any ideas?
Script follows....
-----------------------
use Win32::Process;
use Win32;
Win32::Process::Create($ProcessObj,
"D:\\Perl\\bin\\perl.exe",
"D:\\InetPub\\wwwroot\\cgi-bin\\zedo\\local.pl",
'0',
DETACHED_PROCESS,
"."
)|| die ErrorReport();
$pid=$ProcessObj->GetProcessID();
print "Spawned external process with pid $pid \n\n";
print "Going to sleep.....\n\n";
sleep 60; # Wait 60 secs - child script should complete in 10s
$ProcessObj->GetExitCode( $ExitCode );
print "Woke up.. Local process exited with code $ExitCode\n\n";
exit(0);
-----------------
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 4444
**************************************