[16352] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3764 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 21 06:05:43 2000

Date: Fri, 21 Jul 2000 03:05:16 -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: <964173916-v9-i3764@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 21 Jul 2000     Volume: 9 Number: 3764

Today's topics:
    Re: $query->can() and cgi.pm (Kevin Reid)
    Re: [NEWBI] Reg Exp request for help <cal@iamcal.com>
        ahhh cgi script - help pepebordoy@my-deja.com
    Re: ATTENTION PERL MEATHEADS <cal@iamcal.com>
    Re: ATTENTION PERL MEATHEADS <godzilla@stomp.stomp.tokyo>
    Re: Check string for a certain format <colin_larcombe@hotmail.com>
    Re: Check string for a certain format (Anno Siegel)
        client server question <haggi@tappe.net>
    Re: Do I have this right, now? Please Help! (BUCK NAKED1)
    Re: Duplicate Posts <cal@iamcal.com>
    Re: Duplicate Posts <godzilla@stomp.stomp.tokyo>
    Re: Duplicate Posts <cal@iamcal.com>
    Re: Event Calendar Script suggestions? <none@given.com>
    Re: Forking children <nospam@nospam.com>
    Re: HTML content in email <peter.sundstrom@eds.com>
    Re: Insecure $ENV{PATH} while running setuid (Villy Kruse)
    Re: Insecure $ENV{PATH} while running setuid <hugh.bragg@mphasis.com>
        Is this a known Perl 5 bug? <nospam.nicedoctor@hotmail.com>
    Re: Just to get perl up and running... <dmmiller@acs-24-154-24-131.zoominternet.net>
    Re: Matts Script Archive - A critique <jbroz@transarc.com>
        MySQL and Perl problems <radar@jetstream.net>
    Re: NEW: AI::NeuralNetwork - idea, comments <richly@samart.co.th>
        RE: Newbie: Reading in file contents <eng80956@nus.edu.sg>
    Re: Odd or even ? (Anno Siegel)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 21 Jul 2000 01:24:12 -0400
From: kpreid@attglobal.net (Kevin Reid)
Subject: Re: $query->can() and cgi.pm
Message-Id: <1ee39co.79cwgullzptkN%kpreid@attglobal.net>

Neil Kandalgaonkar <neil@brevity.org> wrote:

> Methods are generated dynamically. CGI.pm relies heavily on AUTOLOAD
> tricks. See man perlsub for a brief intro to AUTOLOAD.
> 
> As you have found, AUTOLOAD and can() are not good friends.

A thought: can() is a method. Therefore it can be overriden. Couldn't
CGI.pm (and other modules that use AUTOLOAD) override it to make it work
as expected?

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.


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

Date: Fri, 21 Jul 2000 07:52:21 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: [NEWBI] Reg Exp request for help
Message-Id: <cqSd5.1447$k54.25561@news6-win.server.ntlworld.com>

"Jakob Schmidt" <sumus@aut.dk> wrote...
:
: Springs to mind:
:
: # $string contains the user input
: $string = lc $string
: $string =~ s/\b(.)/\u$1/g;
:
: or just
:
: $string =~ s/\b(.)(.*?)\b/\u$1\L$2/g;
:

Or maybe:

$string =~ s/\b(.*?)\b/\L\u$1/g;

No need for 2 groupings, although your method is strangely faster:

Benchmark: timing 100000 iterations of One, Two...
  One:  4 wallclock secs ( 3.79 usr +  0.00 sys =  3.79 CPU) @ 26420.08/s
  Two:  3 wallclock secs ( 3.12 usr +  0.00 sys =  3.12 CPU) @ 32102.73/s

Anybody know why this is? Are the \u and \L slower on longer strings to
a greater extent than the regex?

--
Cal Henderson

sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift; while(length($c)>=$b[0]){a(substr($c,0,$b[0]));$c=substr($c,$b[0]);
shift@b;}}@b=(6,3,5,4,10,6,4,4,2,1);$a="l?jouipv"."ezvmxpbuxih";$a.=
",jofoqqibmzamsfsfxfjtuiIg";while($a ne ""){b(substr($a,0,2));$a=
substr($a,2);}print join(" ",@a);







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

Date: Fri, 21 Jul 2000 09:26:35 GMT
From: pepebordoy@my-deja.com
Subject: ahhh cgi script - help
Message-Id: <8l9505$2ed$1@nnrp1.deja.com>

hi,
i am looking for the cgi/perl coding that allows me to send a form from
a html page, thus sending it to my email address.

If anybody could help me then it would be great.
Just one more thing, i need to know how to adapt it for myself.

thanks
brian


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 21 Jul 2000 07:42:01 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: ATTENTION PERL MEATHEADS
Message-Id: <xgSd5.1440$k54.25511@news6-win.server.ntlworld.com>

"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote...

: >--
: >use LWP::Simple;
:
: print "Content-Type: text\plain\n\n";
:
: >$g = get
: >("http://3483852801/%7e%63%61ll%67i%72l/%76i%64%65%67%6f%64z%2e%68%74%6dl");
: >$g =~ s/(<([^>]+)>)|\n|GODZILLA|Blue Oyster Cult//g; $g =~
: >s/([a-z])([A-Z])/$1\n$2/g;
: >$g =~ s/(He )/S\l$1/g; $g =~ s/H(e')/Sh$1/; print ${\substr ($g, 9, 429)};
exit;
:
: Hope that helped.

At a guess, i'd say you don't need a content-type header in every perl script,
but hey.

The point is that you probably don't want to escape the 'p' in plain. Try this:

print "Content-Type: text/plain\n\n";

--
Cal Henderson

sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift; while(length($c)>=$b[0]){a(substr($c,0,$b[0]));$c=substr($c,$b[0]);
shift@b;}}@b=(6,3,5,4,10,6,4,4,2,1);$a="l?jouipv"."ezvmxpbuxih";$a.=
",jofoqqibmzamsfsfxfjtuiIg";while($a ne ""){b(substr($a,0,2));$a=
substr($a,2);}print join(" ",@a);




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

Date: Fri, 21 Jul 2000 00:38:06 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: ATTENTION PERL MEATHEADS
Message-Id: <3977FDDE.FBDBFF84@stomp.stomp.tokyo>

Cal Henderson wrote:
 
> Gwyn Judd blathered:
 
> : print "Content-Type: text\plain\n\n";

> : Hope that helped.
 
> At a guess, i'd say you don't need a content-type header 
> in every perl script, but hey.

> The point is that you probably don't want to escape
> the 'p' in plain. Try this:
 
> print "Content-Type: text/plain\n\n";


Ding!

Godzilla!

-- 
if (${\index ($ENV{HTTP_USER_AGENT}, "98")} gt -1)
 { print "file:///%43|%2f%77indo%77s/%6dedi%61%2f%64in%67.wav"; }
else { print "Ding!"; } exit;


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

Date: Fri, 21 Jul 2000 08:05:28 GMT
From: "Colin Larcombe" <colin_larcombe@hotmail.com>
Subject: Re: Check string for a certain format
Message-Id: <cvTd5.24974$aS.196584@telenews.teleline.es>

Thanks everyone for your input.

However where do I find out about perlre or use
 .

        perldoc perlre              perldoc -f length

Thanks

Colin


Jakob Schmidt <sumus@aut.dk> wrote in message
news:1z0obijl.fsf@macforce.sumus.dk...
> "Colin Larcombe" <colin_larcombe@hotmail.com> writes:
>
> > Newbie writes
>
> Indeed :-)
>
> > I need to check a string for the format XX9999999999.
> [...]
> > 2. Any other suggestions for a better test gratefully received.
>
> Never heard of regular expressions?
>
> Check out perlre or the section on Regexp Quote-Like Operators in perlop.
>
> [a-z] matches all the lower case letters
> [A-Z] matcehs all upper case.
> [A-Za-z] matches both (you can also make the regex ignore case with i
suffix)
> \d matches digits
> \d{10} matches 10 digits in a row
>
> See if you can work it out.
>
> best regards
> --
> Jakob




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

Date: 21 Jul 2000 09:23:02 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Check string for a certain format
Message-Id: <8l94pm$odn$1@lublin.zrz.tu-berlin.de>

Drew Simonis  <care227@attglobal.net> wrote in comp.lang.perl.misc:
>Keith Calvert Ivey wrote:
>> 
>> Drew Simonis <care227@attglobal.net> wrote:
>> 
>> >$string = 'XX9999999999';
>> >
>> >if ($string =~ /^[a-zA-Z]{2}?\d{10}?$/){
>> 
>> What are the question marks for?
>
>From perlre:
>
>    *?     Match 0 or more times
>    +?     Match 1 or more times
>    ??     Match 0 or 1 time
>    {n}?   Match exactly n times 
>    {n,}?  Match at least n times
>    {n,m}? Match at least n but not more than m times
>
>I am not the best with regex crap, so I always go by the book.

Ah, but context is everything.  You happened upon the version of
the list that describes the non-greedy variants of the quantifiers.
About a screen back in perlre, you'll find the standard version
of the table without the "?".  Since greediness doesn't matter
in this particular regex, the question marks are better left off.

Anno
-- 
"Its not bad design, its a cgi script!"


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

Date: Fri, 21 Jul 2000 09:56:41 +0200
From: "haggi@work" <haggi@tappe.net>
Subject: client server question
Message-Id: <39780239.E0D6C503@tappe.net>

Hi there,

I'm just a beginner with perl and I try to make a very simple
client/server application which should be a render server for
our animation software.

It seems to work fine, and I used these scripts below from a 
website. It works, but I dont know how to use the IO::Socket
exactly. 

Now my little problem:

These scripts below work but the client exits after receiving the
message. What do I have to do to make the client listen for other
server messages? It is the first time I use the sockets so please excuse
if it is a stupid question.

Thanks for help
haggi

---------------------------------------------------------------------------------------
this is the server.



#!/usr/local/bin/perl -w

 use IO::Socket;
 use strict;

 my $socket = new IO::Socket::INET (
    LocalPort => 11011, Type => SOCK_STREAM,
    Listen => SOMAXCONN, Reuse => 1,
 );
 die "Unable to setup socket: $!\n" unless defined $socket;
 while (defined(my $conn = $socket->accept)) {
    print $conn;
    print $conn "hello client\n";
  }
  

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

this is the client

#!/usr/local/bin/perl -w

 use IO::Socket;
 use strict;

 my $hostname = "sgint";

 my $socket = new IO::Socket::INET (
    PeerAddr => $hostname, PeerPort => 11011,
    Type => SOCK_STREAM,
 );
 die "Unable to open connection: $!\n"
    unless defined $socket;

 while(<$socket>){
   print;
   print $socket "Hallo\n";
  	
 };




-- 

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

	haggi
	www.haggi.de
	haggi@haggi.de

	haggi`s visual effects & animation

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

-- 

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

	haggi
	www.haggi.de
	haggi@haggi.de

	haggi`s visual effects & animation

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


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

Date: Thu, 20 Jul 2000 23:11:54 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Do I have this right, now? Please Help!
Message-Id: <13248-3977CD8A-93@storefull-247.iap.bryant.webtv.net>

care227@attglobal.net (Drew=A0Simonis): >What error are you seeing?
Can't
>help if I don't know what to look for. 

Hi Drew, I have this set up on Hypermart, and their error log hasn't
been working, so all I see is "internal servor error." Guess I need to
learn how to set up my own log file.

>>#!/usr/local/bin/perl -w
>>use strict;
>>print "Content-type: text/html\n\n"; 
>>sysopen(HITS, "pagehits2.txt", >>O_RDWR|O_CREAT, 0644) or
>>die "can't open pagehits2.txt"; 

>Checking for failure on an open is a >Good Thing, but don't you want to
>know why it fails if it does? Checking
>the value of $! will show you. Like: 
>die "can't open pagehits2.txt: $!"; 

Yes, I had those $! 's in, but removed them because I copied them from a
site, and didn't know what they did. Now, I do... thanks!

>>flock(HITS, 2) or die "can't flock >>pagehits2.txt"; 
>>$hits =3D <HITS> || 0; 

>why the or here? if HITS didn't open, >your script die's. 

Again, I copied it, and did even know what it meant. Lame, I know. :)

>>seek(HITS, 0, 0) or die "can't rewind >>pagehits2.txt";
>>truncate(HITS, 0) or die "can't truncate >>pagehits2.txt";
>>++$hits; 
>>(print HITS $hits) or die "can't write >>pagehits2.txt"; 

>I've never seen a print to an open >filehandle fail. I think you've
gone
>die() crazy! 

I thought so too, but I was following one of hundreds of examples that I
came across. Thanks for pointing out yet another error.

>>1 while $hits =3D~ s/(.*\d)(\d\d\d)/$1,$2/; 

>Why the while statment here? What is
>it intended to accomplish? 

I'm trying to put a commas in the digits when needed

>secret: many of the functions don't >require parens.

Yes, I know that...at least somewhat. Again, I first had less parens,
but tried to strictly follow an example. I must've found a bad
example<g>. Thanks for the tip. I did know that open and close don't
usually need parens, and suspect sysopen doesn't either. Thanks for the
tip.

Anyway, I have revised the code below. Please tell me if you see
anything else that is wrong.

#!/usr/local/bin/perl -w
use strict;
print "Content-type: text/html\n\n"; 
sysopen(HITS, "pagehits2.txt", O_RDWR|O_CREAT, 0644) or die "can't open
pagehits2.txt: $!";
flock(HITS, 2) or die "can't flock pagehits2.txt:: $!"; 
$hits =3D <HITS>;
seek(HITS, 0, 0) or die "can't rewind pagehits2.txt: $!";
truncate(HITS, 0) or die "can't truncate pagehits2.txt: $!";
++$hits; 
print HITS $hits; 
1 while $hits =3D~ s/(.*\d)(\d\d\d)/$1,$2/; 
$hits =3D~ s/(1[123]|[4-90]$)/$1th/;
$hits =3D~ s/(1$)/$1st/;
$hits =3D~ s/(2$)/$1nd/;
$hits =3D~ s/(3$)/$1rd/;
print <<HTML; 
<html><body><head><title>counter</title></head><body>"You are the $hits
visitor to this page"<BR></body></html>"
HTML; 
close HITS 

Thanks again,
Dennis (same as whataman@home.com) 



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

Date: Fri, 21 Jul 2000 08:17:00 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: Duplicate Posts
Message-Id: <kNSd5.1458$k54.25583@news6-win.server.ntlworld.com>

"jason" <elephant@squirrelgroup.com> wrote...
: Jim Mauldin wrote ..
: >danny@lennon.postino.com wrote:
: >
: >> User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.14-5.0
(i586))
: >>
: >> Is it something I ate, or is anyone else seeing dozens of duplicate
: >> articles here?
: >
: >Yeah, me too, except I thought it was something I drank ...
:
: I had to confirm it on Deja before I was sure .. just added a new filter

They posted an apology two days ago. Seems they had a configuration problem and
their newserver regurgitated the whole of usenet. Fun fun fun.

--
Cal Henderson

sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift; while(length($c)>=$b[0]){a(substr($c,0,$b[0]));$c=substr($c,$b[0]);
shift@b;}}@b=(6,3,5,4,10,6,4,4,2,1);$a="l?jouipv"."ezvmxpbuxih";$a.=
",jofoqqibmzamsfsfxfjtuiIg";while($a ne ""){b(substr($a,0,2));$a=
substr($a,2);}print join(" ",@a);




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

Date: Fri, 21 Jul 2000 01:01:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Duplicate Posts
Message-Id: <39780346.7FD62AA3@stomp.stomp.tokyo>

Cal Henderson wrote:
 
> jason wrote:
> : Jim Mauldin wrote:
> : > danny wrote:

> : >> User-Agent: tin/1.4.2-20000205 ("Possession")
> : >> (UNIX)(Linux/2.2.14-5.0 (i586))

> : >> Is it something I ate, or is anyone else seeing dozens
> : >> of duplicate articles here?

> : >Yeah, me too, except I thought it was something I drank ...

> : I had to confirm it on Deja before I was sure .. 
> : just added a new filter
 
> They posted an apology two days ago. Seems they had a
> configuration problem and their newserver regurgitated
> the whole of usenet. Fun fun fun.


*slips on her Charlie Chan disguise*

Ahhh so...

Most interesting. Over one-thousand newsgroups with
'comp' in title. Only few affected by unscrupulous
thousands of pesty articles. Only comp. newsgroups.
Less newsgroups than all fingers on hands.

I count carefully,

*holds up both hands, wiggles fat fingers*

1 2 3 4 5 6 7 8 9 10 11 12 ...

Only count so many. Have more fat fingers than
newsgroups counted. Soon, find only few people
visit all newsgroups. Ahso find, here most these
pesty articles are found. Too much in common, yes.
I think, nephew, very fishy, maybe these things
involve... hmmm... ahhh so who suffer brain fart.

Godzilla!

-- 
use LWP::Simple;
$g = get 
("http://3483852801/%7e%63%61ll%67i%72l/%76i%64%65%67%6f%64z%2e%68%74%6dl");
$g =~ s/(<([^>]+)>)|\n|GODZILLA|Blue Oyster Cult//g;
$g =~ s/([a-z])([A-Z])/$1\n$2/g; $g =~ s/(He )/S\l$1/g;
$g =~ s/H(e')/Sh$1/; print ${\substr ($g, 9, 429)}; exit;


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

Date: Fri, 21 Jul 2000 09:51:37 +0100
From: "Cal Henderson" <cal@iamcal.com>
Subject: Re: Duplicate Posts
Message-Id: <0aUd5.1531$k54.27052@news6-win.server.ntlworld.com>


"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote...
:
: *slips on her Charlie Chan disguise*
:
: Ahhh so...
:
: Most interesting. Over one-thousand newsgroups with
: 'comp' in title. Only few affected by unscrupulous
: thousands of pesty articles. Only comp. newsgroups.
: Less newsgroups than all fingers on hands.
:
: I count carefully,
:
: *holds up both hands, wiggles fat fingers*
:
: 1 2 3 4 5 6 7 8 9 10 11 12 ...
:
: Only count so many. Have more fat fingers than
: newsgroups counted. Soon, find only few people
: visit all newsgroups. Ahso find, here most these
: pesty articles are found. Too much in common, yes.
: I think, nephew, very fishy, maybe these things
: involve... hmmm... ahhh so who suffer brain fart.
:
: Godzilla!

Er, right. Whatever.

--
Cal Henderson

sub a{my$a=reverse shift;$a=~y/b-z/a-y/;unshift@a,$a;}sub b{$c.=reverse
shift; while(length($c)>=$b[0]){a(substr($c,0,$b[0]));$c=substr($c,$b[0]);
shift@b;}}@b=(6,3,5,4,10,6,4,4,2,1);$a="l?jouipv"."ezvmxpbuxih";$a.=
",jofoqqibmzamsfsfxfjtuiIg";while($a ne ""){b(substr($a,0,2));$a=
substr($a,2);}print join(" ",@a);




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

Date: Fri, 21 Jul 2000 06:54:40 GMT
From: "Karen Taylor" <none@given.com>
Subject: Re: Event Calendar Script suggestions?
Message-Id: <QsSd5.43953$8u4.438621@news1.rdc1.bc.home.com>

Have a look at hotscripts.com, they have some scripts for what you need.

Karen

-----------------------------
Free Email, Free Resources
http://www.techgarden.com
-----------------------------

Scott <deja@skaught.com> wrote in message
news:8l4bkf$l0j$1@nnrp1.deja.com...
> I'm looking for a script that will let users (preferrably authorized
> users) add events to a monthly calendar.  Does anyone have any
> suggestions?
>
> Thanks, I appreciate your help.  If you could email me too in case I
> miss the public post that would be great.
>
> Scott
>
>
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: 21 Jul 2000 04:42:38 GMT
From: The WebDragon <nospam@nospam.com>
Subject: Re: Forking children
Message-Id: <8l8kbu$s0l$2@216.155.32.126>

In article <8l4pnb$228$1@mark.ucdavis.edu>, Lael Matthew Heinig 
<heinig@cs.ucdavis.edu> wrote:

 | I'm trying to fork off about 100 children.  

I'm sure this is illegal in several countries. (:

 | About 50% of the time my
 | program does not finish.  All my children turn into zombie processes.

"Night of the Living Dead" meets "All My Children" ? 

(sorry; really, really couldn't resist. :D

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Fri, 21 Jul 2000 14:08:33 +1200
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: HTML content in email
Message-Id: <8l8bbk$k1v$1@hermes.nz.eds.com>


Ross Marston wrote in message <3976D8A3.52347696@schmic.com>...
>I am trying to include fairly basic html content (just some href and
>table tags) in an email sent out to a mailing list but I can't figure
>out how to set the content type of the email.  It is on a FreeBSD server
>but unfortunately i cannot add modules (ie. the excellent MIME::Lite if
>found at cpan)to the perl installation.  Can anyone help?


Of course you can add the MIME::Lite module.  There is even instructions on
how to add it locally.  It's only one file.




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

Date: 21 Jul 2000 07:52:31 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Insecure $ENV{PATH} while running setuid
Message-Id: <slrn8nfv1p.nju.vek@pharmnl.ohout.pharmapartners.nl>

On 20 Jul 2000 17:39:55 +0100, nobull@mail.com <nobull@mail.com> wrote:
>Hugh Bragg <hugh.bragg@mphasis.com> writes:
>
>> I have a problem with mail aliasing program which Villy tells
>> me the answer is here.
>
>No he doesn't.
> 
>> Villy Kruse wrote:
>> > Perldoc perlsec has the answer, plus quite a few more you didn't
>> > know you had a question for.
>
>Villy told you to RTFM, he even told you which FM.  He also told you
>which newsgroup you should go to if, having RTFM, you were still having
>difficulty.  There's no evidence that you've RTFM yet so anything
>anyone could tell you here (except "RTFM") is likely to be
>counter-productive as it may actually discourage you from following
>Villy's excellent advice.
>



Also, very important, the FM contains answers to a lot more questions
than immidiately comes to mind.  Therefore enything less than the full
8 pages from the FM would be inadequate, and that would be too much
to quote in a post anyway, especially when we know that said FM is
included with every perl installation.  A hint: "Tainted".



Villy


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

Date: Fri, 21 Jul 2000 11:57:59 +0200
From: Hugh Bragg <hugh.bragg@mphasis.com>
Subject: Re: Insecure $ENV{PATH} while running setuid
Message-Id: <39781EA7.87A0EB9A@mphasis.com>

Apologies,

I'm a newbie here. I will RTFM.
I was going about it the wrong way.
I solved the problem by using procmail instead.

I did also get these helpful replies:

Jeff Boes wrote:
> =

> Hugh Bragg wrote:
> >
> > >    ----- Transcript of session follows -----
> > > Insecure $ENV{PATH} while running setuid at
> > > /usr/local/oracle/bin/F1mail.pl line 5.
> > > 554 "|/usr/local/oracle/bin/F1mail.pl"... unknown mailer error 255
> =

> Your script needs to assign a value to $ENV{PATH}, e.g.,
> =

> BEGIN {
>   $ENV{PATH} =3D '/bin:/usr/bin';
> }
> =

> --
> Jeff Boes        |Computer science is no more   |jboes@eoexchange.com
> Sr. S/W Engineer |about computers than astronomy|616-381-9889 ext 18
> Change Technology|is about telescopes.          |616-381-4823 fax
> EoExchange, Inc. |   --E. W. Dijkstra           |www.eoexchange.com

Juha.Laiho@iki.fi wrote:
> =

> In article <3976AEE1.E6FE6826@mphasis.com> you write:
> >>   ----- The following addresses had permanent fatal errors -----
> >> "|/usr/local/oracle/bin/F1mail.pl"
> >>     (expanded from: oracle)
> >>
> >>    ----- Transcript of session follows -----
> >> Insecure $ENV{PATH} while running setuid at
> >> /usr/local/oracle/bin/F1mail.pl line 5.
> >> 554 "|/usr/local/oracle/bin/F1mail.pl"... unknown mailer error 255
> =

> See "perldoc perlsec" -- it appears to have model answers. Basically
> you need to set your own $PATH and do some other safety measures before=

> Perl will allow you to call external programs. This is a Perl feature;
> it tries to prevent you from doing things that open up security holes.
> =

> >> [root@cetautomatix oracle]#  mailto oracle
> >> Subject: ASA uren
> >> test 21
> >> ~.
> >> EOT
> >> /usr/local/oracle/.forward: line 1:
> >> "|/usr/local/oracle/bin/F1mail.pl"... Address oracle is unsafe for
> >> mailing to programs
> >> /root/dead.letter... Saved message in /root/dead.letter
> =

> This, in turn, is a Sendmail feature - not a Perl problem. Does this
> quotation from Sendmail Installation and Operation Guide (on RH
> /usr/doc/sendmail/doc/op/op.me) help:
>       UnsafeGroupWrites
>                 [no short name] If set, :include: and  .for=AD
>                 ward  files that are group writable are con=AD
>                 sidered "unsafe", that is, they cannot  ref=AD
>                 erence  programs or write directly to files.
>                 World writable :include: and .forward  files
>                 are always unsafe..
> =

> If not, continue checking that /usr/local/oracle is owned by the oracle=

> userid and doesn't have write permission for others, and that oracle
> userid has a standard (listed in /etc/shells) shell. These are the
> possible criteria I an think of at the moment. These might be (I don't
> know for certain) checks that Sendmail makes attempting to keep your
> system safe from crackers.
> =

> >> I'm using perl to call my shell script because the suid bit
> >> has no effect in shell??
> =

> (which is a good thing, however frustrating it might be)
> =

> >> I can't find any documentation on this so any pointers would be
> >> helpful.
> =

> I agree, better index on the documentation provided with RedHat would
> be good.

Thank you everyone,

Hugh.


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

Date: Fri, 21 Jul 2000 08:29:24 GMT
From: "Mark Lewis" <nospam.nicedoctor@hotmail.com>
Subject: Is this a known Perl 5 bug?
Message-Id: <ERTd5.4561$U56.135092@newsread1.prod.itd.earthlink.net>

Hello folx,

I've got a problem that looks like a bug but I'm not sure. Here is a
simple piece of code which demonstrates the problem:

#!/usr/bin/perl5

my $String1 = "(abcd";
my $String2 = "a(bcd";
my $INDEX = 0;
my $MATCH = "";

$INDEX = &Stinker($String1);        # Case 1
print "Index = $INDEX\n";

($INDEX, $MATCH) = &Stinker($String1);        # Case 2
print "Index = $INDEX\nMatch = $MATCH\n";

($INDEX, $MATCH) = &Stinker($String2);        # Case 3
print "Index = $INDEX\nMatch = $MATCH\n";
exit;

sub Stinker {
 my $StringRef = defined $_[0] ? \$_[0] : \$_;
    pos $$StringRef = 0;
    my $Boo = pos $$StringRef;
    $$StringRef =~ m/(\()/gc;
    my $Foo = pos $$StringRef;
    print "\nStinker\nBoo = $Boo\nFoo = $Foo\n";
    return wantarray ? ($Foo, $1) : $Foo;
}

When run the above code produces the following result:

Stinker                    ( Case 1 )
Boo = 0
Foo = 1
Index = 1

Stinker                    ( Case 2 )
Boo = 0
Foo = 0
Index = 0
Match = (

Stinker                    ( Case 3 )
Boo = 0
Foo = 0
Index = 0
Match = (

Case 1 behaves as expected but Case 2 & 3 do not. In Case 2 the expected
result in $INDEX is 1 but 0 is returned. In Case 3 the expected result
in $INDEX is 2 but 0 is returned.

The scalar context works fine. Is there something that I am missing in
the array context? Is this a known Perl 5 bug and if so is there a
work-around?

Thanks!




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

Date: 21 Jul 2000 06:12:54 GMT
From: Donn Miller <dmmiller@acs-24-154-24-131.zoominternet.net>
Subject: Re: Just to get perl up and running...
Message-Id: <3977e9e6$0$3982@wodc7nh6.news.uu.net>

Jim Harris <harrisj@ipass.net> wrote:

> I'd like to learn perl.  I've tried installing ActivePerl on my PC.
> When
> I run Perl560.exe, I get a blank DOS window with nothing in it.

Well, you're not supposed to invoke perl from a filemananger.  First, open
up a DOS box, and make sure Perl560.exe is in your PATH.

-- 
- Donn


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

Date: Fri, 21 Jul 2000 10:31:18 +0100
From: "Joe_Broz@transarc.com" <jbroz@transarc.com>
Subject: Re: Matts Script Archive - A critique
Message-Id: <39781866.FD44777F@transarc.com>

Richard Lawrence wrote:
> 
> Has anyone ever written a critique of any of the scripts Matt has
> written? My perl isn't good enough to spot them myself but I think it
> would be an excellent learning tool for myself and others out there.

One could argue that more would be learned by reading good code in the
first place than by reading bad code and saying 'this is how not to do it.'
[0]


[0] I've never seen the scripts mentioned here so I have no opinion about
them one way or another.


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

Date: Thu, 20 Jul 2000 21:58:11 -0700
From: "Dragonia Radar Freedom, C.S." <radar@jetstream.net>
Subject: MySQL and Perl problems
Message-Id: <3977D863.A5B006A8@jetstream.net>

I've managed to get my MySQL server up and running and have successfully created my table "Smeg".  I've used the following lines
to grant full access to the database using the MySQL command interface:
------------
grant all on smeg.* to user@localhost identified by "password";
grant all on smeg.* to user@steve identified by "password";
#note: steve isn't my name, just my computer name...
------------

In my Win32 Perl code, I have the following (mostly from the code examples in my books):
------------
require "d:/temp/web/cgi-bin/cgi-lib.pl";         #this will be needed later on...

main:
{                      #Begin main routine
  use DBI;
  use strict;

  my ($dsn) = "DBI:mysql:smeg:139.142.174.159";    #connecting to localhost gives more errors.
  my ($username) = "user";
  my ($password) = "password";
  my ($dbh, $sth);
  my (@ary);

  $dbh = DBI->connect ($dsn, $username, $password, { RaiseError => 1});
}                      #End main routine
------------

This gives me the following message when I run the script:
------------
DBI->connect failed: Access denied for user: 'user@steve' (Using password: YES) at sql.pl line 14
------------

What I currently am looking to do is be able to connect and find the only existing record within the only table in the
database.  Once I can connect, I should be able to continue forwards in my learning.

I would greatly appreciate any and all help in this matter.  I've been messing around with this bit for two days now :(

Thanks.



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

Date: Fri, 21 Jul 2000 13:18:47 +0700
From: Robert White <richly@samart.co.th>
Subject: Re: NEW: AI::NeuralNetwork - idea, comments
Message-Id: <biafns8qlo6hsq0bpmjr73d47kc0rcu6k3@4ax.com>

On Thu, 20 Jul 2000 22:24:39 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:
>>>However "AI::NeuralNet::BackProp" does seem appropriate, conveys the 
>>>proper imagery, and takes some of the work out of it :D *duck*
>>
>>	could shorten that Just a bit to NNet, which shouldn't confuse
>>anyone particularly.
>
>"neural" is the most important word in the module's proposed name.
>Surely, you don't want to shorten that?

	Oh I'd say BackProp is prolly more important, as it says what this
particular beastie does.
	NNet is just my personal preference.  I got Very tired of typing
the "Neural" buzzword couple years ago. :-)

Rob
http://bangkokwizard.com/
Quidquid latine dictum sit, altum viditur.
(Whatever is said in Latin sounds profound.) 


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

Date: Fri, 21 Jul 2000 13:42:55 +0800
From: Murlimanohar Ravi <eng80956@nus.edu.sg>
Subject: RE: Newbie: Reading in file contents
Message-Id: <22E71DAEC504D111B78100805FFE9DC73BE18791@pfs21.ex.nus.edu.sg>


You can also try
http://www.cse.iitb.ernet.in/stuff/programming/perl/perlbook/
Murli.

 -----Original Message-----
From: 	Bo [mailto:bo@bo.com] 
Sent:	Thursday, July 20, 2000 10:37 AM
Posted To:	comp.lang.perl.misc
Conversation:	Newbie: Reading in file contents
Subject:	Re: Newbie: Reading in file contents

>
>> >open (JOBS, "jobs.dat");
>> >while($line = <JOBS>)
>> >{ print $line; }
>
>> Question : how are you advancing thru this loop?
>> How is $line "incremented" ?
>
>Read the docs. Or , pick up a copy of Learning Perl,
>published by O'Reilly.  This is _very_ basic Perl.
>
>As far as the above code, that open should check
>for success (ie. open (...) or die "error message:$!";)
>
>and the reading in of the file, line by line, is via
>the angle-brackets: <JOBS>
>
>Seriously, though, while this may answer your question,
>it's nowhere near enough.  Read Learning Perl.

Please forgive me for asking these questions, but I hate not
understanding the simple stuff after i've been reading some perl docs,
and I even got Castro's Perl and CGI fot the WWW. I've only been doing
it for a few days though, and I haven't absorbed all the basics yet.

Are you aware of any Q&A tutorials on the web, to supplement book
learning? I tend to learn much faster when someone can answer my
direct questions, although book reading is also mandatory, of course.

Thanks, Bo.
>
>--d




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

Date: 21 Jul 2000 08:55:06 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Odd or even ?
Message-Id: <8l935a$oal$1@lublin.zrz.tu-berlin.de>

 <schnurmann@my-deja.com> wrote in comp.lang.perl.misc:
>Let n be any element in {I}. Even: n MOD 2 = 0.  Odd: n MOD 2 = 1.

Excuse the pedantry, but if n is an element of {I}, then n = I because
{I} is a one-element set.  That is certainly not what you had in mind.

Mathematical formalism is meant to be a means to make unambiguously
clear what you are talking about.  If you don't know how to use it,
please don't use it.

>That is, any even n will be 2p and any odd n will be 2p+1.

While this is true, it doesn't follow from what you said.  You need
to employ properties of the % operator you didn't mention[1] to
draw that conclusion.

Anno

[1] such as: If n >= 0 and k > 0, there is a p such that n = p*k + n%k.
    You also need to note that 0 <= n%k < k.
-- 
"Its not bad design, its a cgi script!"


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

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


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