[16990] in Perl-Users-Digest
Perl-Users Digest, Issue: 4402 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 22 03:10:25 2000
Date: Fri, 22 Sep 2000 00:10:15 -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: <969606614-v9-i4402@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 22 Sep 2000 Volume: 9 Number: 4402
Today's topics:
Re: Pure perl encrypt/decryption? (Abigail)
Re: Pure perl encrypt/decryption? (Abigail)
Re: RecDescent bug? (Abigail)
Re: RecDescent bug? <ocschwar@mit.edu>
Regex standards: ranges <toddg@linux45.ma.utexas.edu>
regex <ar@toocan.com>
Re: regex <uri@sysarch.com>
Run C-Program from Perl <support@acay.com.au>
Re: Run C-Program from Perl (Gwyn Judd)
Re: Set Cookie and Redirect at same time ??? (Rafael Garcia-Suarez)
Setting all variables to null mike@mld.com
Re: Setting all variables to null (Gwyn Judd)
Re: Setting all variables to null (Mark-Jason Dominus)
statistics and anti-caching (Kevin)
Thanks all. <Chris%2BSaunders@one.net.au>
Writing info into a file on server side circuit_board@my-deja.com
Re: Writing info into a file on server side <jeff@vpservices.com>
XML::Parser file trouble <ghardisty@asia-net.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Sep 2000 01:43:59 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Pure perl encrypt/decryption?
Message-Id: <slrn8sle8n.5fq.abigail@alexandra.foad.org>
Logan Shaw (logan@cs.utexas.edu) wrote on MMDLXXVIII September MCMXCIII
in <URL:news:8qdqa8$g2t$1@provolone.cs.utexas.edu>:
`' In article <epjjsssqj3hsb4fen895aivqjafpq5kmn8@4ax.com>,
`' Bart Lateur <bart.lateur@skynet.be> wrote:
`' >If you don't have telnet access to your site, you can forget about
`' >installing modules that need compilation. Same thing if your ISP doesn't
`' >provide access to a C compiler.
`'
`' If you have CGI access, don't you almost by definition have shell
`' access? I mean, you can always write a CGI that fork()s itself,
`' daemonizes its child, happily returns an HTML page in the parent, and
`' then has the daemonized child essentially emulate telnet and/or a shell
`' as necessary.
`'
`' Or, simpler, make a Perl CGI shell. Just have a text blank called
`' "command", in which you type commands, and then have Perl run whatever
`' "command" is as a shell command and return the prettified HTML results.
`'
`' That is, you can do all this as long as your ISP doesn't build a
`' customized version of Perl that doesn't have system(), fork(), exec(),
`' connect(), accept(), syscall(), etc.
Well, if the ISP is smart, the server has been chroot()ed to an
environment that doesn't have a shell. That of course doesn't mean
you can fork(), listen to a socket, and on incoming connections,
fork() again and emulate a shell.... It just takes a little bit more.
OTOH, the ISP might run Perl 5.005 on NT, and hence, no fork().
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
------------------------------
Date: 22 Sep 2000 01:54:37 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Pure perl encrypt/decryption?
Message-Id: <slrn8slesj.5fq.abigail@alexandra.foad.org>
Bart Lateur (bart.lateur@skynet.be) wrote on MMDLXXVIII September
MCMXCIII in <URL:news:ivvkssclm3c2ti2ufg3n080n3cshgifjhu@4ax.com>:
&& Logan Shaw wrote:
&&
&& >If you have CGI access, don't you almost by definition have shell
&& >access? I mean, you can always write a CGI that fork()s itself,
&& >daemonizes its child, happily returns an HTML page in the parent, and
&& >then has the daemonized child essentially emulate telnet and/or a shell
&& >as necessary.
&&
&& It still runs as "nobody", so there's a limit to what you can do.
Oh, really? In most (all?) Unices, the only special uid is 0, root.
"nobody" isn't special in any way, it's just a convention. Unix doesn't
have any priviledge requirements on fork(). There are some restrictions
on port usuage; the first 1024 ports are off limits for anyone but root.
But that still leaves 64512 for nobody to bind to.
Of course, a properly configured host doesn't allow connections to ports
other than necessary to perform its task, so it might very well be that
any port other than 80 is firewalled out.
&& I don't think FTP even supports setting the SUID bit; and even then,
&& some OSes are configured by default to ignore the SUID bit on scripts.
&& The next choice is to use a cgi-wrap program, but: you need to compile
&& it on your server. Full circle.
Well, there's always the possibility to compile on your machine, and
upload a binary. You don't even need to have the same kind of machine as
your ISP has. If gcc runs on your platform, and gcc runs on your ISP's,
you can always build a gcc that emits binaries suitable for your ISP's
machine.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
------------------------------
Date: 22 Sep 2000 01:38:50 GMT
From: abigail@foad.org (Abigail)
Subject: Re: RecDescent bug?
Message-Id: <slrn8sldv2.5fq.abigail@alexandra.foad.org>
Omri Schwarz (ocschwar@mit.edu) wrote on MMDLXXVIII September MCMXCIII in
<URL:news:39CA5DBE.68A3DA95@mit.edu>:
?? Hi, all. I have a rule that goes like this:
??
?? [ SNIP ]
??
?? And yet when I turn on RD_TRACE,
?? I get this:
??
?? [ SNIP ]
??
?? Warning: Undefined (sub)rule "ordinal" used in a
?? production.
??
??
?? And parsing ends.
??
?? The grammar begins with:
??
?? my $Grammar = q[
?? ...
??
?? Could anyone guess why this breaks?
No. You didn't show us all the code, and if I add 'my $Grammar = q['
and an appropriate '];', it parses; issueing the expected warnings
for missing rules.
Abigail
--
BEGIN {my $x = "Knuth heals rare project\n";
$^H {integer} = sub {my $y = shift; $_ = substr $x => $y & 0x1F, 1;
$y > 32 ? uc : lc}; $^H = hex join "" => 2, 1, 1, 0, 0}
print 52,2,10,23,16,8,1,19,3,6,15,12,5,49,21,14,9,11,36,13,22,32,7,18,24;
------------------------------
Date: Thu, 21 Sep 2000 23:23:02 -0400
From: Omri Schwarz <ocschwar@mit.edu>
Subject: Re: RecDescent bug?
Message-Id: <39CAD096.5066F988@mit.edu>
Abigail wrote:
>
> Omri Schwarz (ocschwar@mit.edu) wrote on MMDLXXVIII September MCMXCIII in
> <URL:news:39CA5DBE.68A3DA95@mit.edu>:
> ?? Hi, all. I have a rule that goes like this:
> ??
> ?? [ SNIP ]
> ??
> ?? And yet when I turn on RD_TRACE,
> ?? I get this:
> ??
> ?? [ SNIP ]
> ??
> ?? Warning: Undefined (sub)rule "ordinal" used in a
> ?? production.
> ??
> ??
> ?? And parsing ends.
> ??
> ?? The grammar begins with:
> ??
> ?? my $Grammar = q[
> ?? ...
> ??
> ?? Could anyone guess why this breaks?
>
> No. You didn't show us all the code, and if I add 'my $Grammar = q['
> and an appropriate '];', it parses; issueing the expected warnings
> for missing rules.
>
> Abigail
The whole 1300 script is at
http://www.mit.edu/~ocschwar/recss.pl
The rule changed a bit, is at the end,
and the problem is acting very much like a heisenbug.
------------------------------
Date: 22 Sep 2000 05:21:37 GMT
From: Todd Gillespie <toddg@linux45.ma.utexas.edu>
Subject: Regex standards: ranges
Message-Id: <8qeq91$pju$1@geraldo.cc.utexas.edu>
I'm trying to write a regex that takes a user string with their bizarre
concept of ranges: 'R1..8','R1-R8','R[1-8]',etc,etc (I might not be
creative enough to think of more parser-breaking combos).
Question: is there functionality in a CPAN module to tokenize something
like this problem; or is there a written theory on what generally
constitutes legal ranges?
just a pointer to somewhere; many thanks.
------------------------------
Date: Tue, 19 Sep 2000 15:47:06 -0700
From: "ash" <ar@toocan.com>
Subject: regex
Message-Id: <8q8qdd$lgc$1@sand.ccsf.cc.ca.us>
------------------------------
Date: Fri, 22 Sep 2000 04:00:58 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regex
Message-Id: <x7aed1cbyd.fsf@home.sysarch.com>
>>>>> "a" == ash <ar@toocan.com> writes:
/^\z/
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Fri, 22 Sep 2000 14:11:22 +1000
From: "Support" <support@acay.com.au>
Subject: Run C-Program from Perl
Message-Id: <39caccfe.0@news.acay.com.au>
Hi All,
I write a C program then compile it, it creates a output file of "a.out".
Now I would like to run "a.out" from perl. Does anyone know the way or other
ways? Please tell me.
Thanks
------------------------------
Date: Fri, 22 Sep 2000 03:19:57 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Run C-Program from Perl
Message-Id: <slrn8sljum.bq9.tjla@thislove.dyndns.org>
I was shocked! How could Support <support@acay.com.au>
say such a terrible thing:
>Hi All,
>
>I write a C program then compile it, it creates a output file of "a.out".
>Now I would like to run "a.out" from perl. Does anyone know the way or other
>ways? Please tell me.
>Thanks
Sure, the documentation is here:
perldoc -f system
perldoc -f exec
perldoc perlop # look for 'backtick'
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
It is my ambition to say in ten sentences; what others say in a whole
book.
-Friedrich Nietzsche
------------------------------
Date: Fri, 22 Sep 2000 06:24:52 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Set Cookie and Redirect at same time ???
Message-Id: <slrn8slv5t.2tb.rgarciasuarez@rafael.kazibao.net>
Papyros Brandmand wrote in comp.lang.perl.misc:
>Can someone help here...
>
>i'am trying på make some CGI (Not that good to perl)...
>
>I need to set a cookie and Redirect to another site at the same time...
>Put i can only do one of the thing... only one of them will work ???
Use the module CGI::Cookie to create the cookie :
my $cookie = new CGI::Cookie(-name => 'foo', -value => 'bar);
Then print the headers:
print "Set-Cookie: $cookie\n";
my $q = new CGI;
print $q->redirect('http://somewhere/');
or:
print "Set-Cookie: $cookie\n";
print "Status: 302 Moved\n";
print "Location: http://somewhere/\n\n";
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
sub AUTOLOAD { $AUTOLOAD =~ /:(\w+)$/; print $1,($_[0]||' '); }
&Just; &another; &Perl; &hacker(",\n");
------------------------------
Date: Fri, 22 Sep 2000 16:41:44 GMT
From: mike@mld.com
Subject: Setting all variables to null
Message-Id: <39cb8b54.93181122@news.webperception.com>
Is there a simple way to set all variables in an executing perl script
to null without actually listing them?
Thanks
Mike
------------------------------
Date: Fri, 22 Sep 2000 05:19:36 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Setting all variables to null
Message-Id: <slrn8slqv1.c5t.tjla@thislove.dyndns.org>
I was shocked! How could mike@mld.com <mike@mld.com>
say such a terrible thing:
>
>Is there a simple way to set all variables in an executing perl script
>to null without actually listing them?
perldoc -q "How do I clear a package?"
Does that help?
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
You have an unusual magnetic personality. Don't walk too close to
metal objects which are not fastened down.
------------------------------
Date: Fri, 22 Sep 2000 05:37:45 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Setting all variables to null
Message-Id: <39caf028.401$213@news.op.net>
In article <39cb8b54.93181122@news.webperception.com>, <mike@mld.com> wrote:
>Is there a simple way to set all variables in an executing perl script
>to null without actually listing them?
Use the 'reset' function.
------------------------------
Date: Fri, 22 Sep 2000 07:22:59 GMT
From: REMOVEMEmelonmisc@iname.com (Kevin)
Subject: statistics and anti-caching
Message-Id: <39cb086f.20697180@news.ozemail.com.au>
Hi All
I am implementing some html emails for an organisation.
What I need is a counter script of sorts, one that preferably can get
arround any caching issues, that is, be as accurate as possible, does
anyone have any ideas, points to free or paid scripts and services
would be appreciated.
Regards,
Kevin
------------------------------
Date: Fri, 22 Sep 2000 11:24:59 +1000
From: "Chris Saunders" <Chris%2BSaunders@one.net.au>
Subject: Thanks all.
Message-Id: <39cab4b9@pink.one.net.au>
Many thanks to all who provided me with feedback.
------------------------------
Date: Fri, 22 Sep 2000 06:21:47 GMT
From: circuit_board@my-deja.com
Subject: Writing info into a file on server side
Message-Id: <8qetpg$ts1$1@nnrp1.deja.com>
Here, I'm opening a file for appending. This is in a cgi script,
uploaded to the server. When I run it, it gives an error message and
nothing is written to the file.
Hope you can help.
open(FH, ">>info.dat");
foreach $fieldname ($formdata->param) {
print FH $formdata->param($fieldname) . ":";
}
close(FH);
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 21 Sep 2000 23:38:35 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Writing info into a file on server side
Message-Id: <39CAFE6B.FFF794B@vpservices.com>
circuit_board@my-deja.com wrote:
>
> Here, I'm opening a file for appending. This is in a cgi script,
> uploaded to the server. When I run it, it gives an error message
Without knowing what the error message is, how could we begin to help?
If you get a generic 500 message, then you should run the script from
the command line or add "use CGI::Carp qw(fatalsToBrowser)" to send most
error messages to the browser.
> open(FH, ">>info.dat");
You don't check to see if your open succeeds. Change that to
open( FH, ">>info.dat" ) or die "Can't open info.dat: $!";
--
Jeff
------------------------------
Date: Fri, 22 Sep 2000 06:02:34 GMT
From: "George Hardisty" <ghardisty@asia-net.com>
Subject: XML::Parser file trouble
Message-Id: <_BCy5.24342$3y3.309241@typhoon.austin.rr.com>
The following bit of code is giving the error below it...
my $parser = new XML::Parser(ErrorContext => 2);
$parser->setHandlers(Start => \&start_handler,
Char => \&char_handler);
$parser->parsefile($file);
>>>>>
Can't locate object method "read" via package "FileHandle" at
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/XML/Parser/Expat.pm line
464, <STDIN> chunk 260.
I installed XML::Parser using perl -MCPAN -e shell ... and everything said
it installed properly. The $file does exist .... am I missing a module or
something that is causing this?
Thanks in advance,
George
------------------------------
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 4402
**************************************