[16623] in Perl-Users-Digest
Perl-Users Digest, Issue: 4035 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 16 14:10:39 2000
Date: Wed, 16 Aug 2000 11:10:24 -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: <966449423-v9-i4035@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 16 Aug 2000 Volume: 9 Number: 4035
Today's topics:
Re: Help in Parsing <yanoff@yahoo.com>
Re: Help in Parsing <abe@ztreet.demon.nl>
Re: Help in Parsing joellimardo@pocketmail.com
Re: Help in Parsing <ren.maddox@tivoli.com>
Re: Help: libs with Latin-1 or Unicode? <flavell@mail.cern.ch>
Re: How do I send data to another Server ??? (LMC)
HTML::Embperl::Execute won't recognise imported subrout <dpc29@hermes.cam.ac.uk>
Re: HTTP_REFERER <rmore1@my-deja.com>
Re: LWP question (Greg Bacon)
Re: LWP question <rmore1@my-deja.com>
Re: malformed header <admin@salvador.venice.ca.us>
Re: malformed header <red_orc@my-deja.com>
Re: Net::Dns broken, gethostbyname OK <undergronk@my-deja.com>
Re: newbie: regex-question <ren.maddox@tivoli.com>
Re: newbie: regex-question <ren.maddox@tivoli.com>
Re: Perl - Blinking Text (Steven M. O'Neill)
Reluctance to die (was: Replacing lines in a file) nobull@mail.com
Re: Replacing lines in a file <lr@hpl.hp.com>
reseting the "counter" in each jomagam@yahoo.com
rollback perlcc'd binary to perl code vi_2000@hotmail.com
Root Capability from a CGI Script <lithium@ev1.net>
Re: Root Capability from a CGI Script nobull@mail.com
Re: Root Capability from a CGI Script <care227@attglobal.net>
Re: Root Capability from a CGI Script <jeff@vpservices.com>
Re: translating tr/a-z/A-Z/ best or s/..... <bart.lateur@skynet.be>
Re: Use NT Logins in Perl? <gellyfish@gellyfish.com>
Re: what the heck is C<$_> ?? (John Stanley)
Re: Xemacs Perl menu <jeff@vpservices.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 Aug 2000 10:20:36 -0500
From: Scott Yanoff <yanoff@yahoo.com>
Subject: Re: Help in Parsing
Message-Id: <399AB144.F79F8531@yahoo.com>
sankarmukh@my-deja.com wrote:
>
> When I run this, it prints @listing, but nothing else;
> Obviously, I am confused about parsing the list.
> Any help is appreciated.
>
> **********************************************************
> #!/usr/local/bin/perl
> open (IN, " /u/ctssmuk/cntrlFilePL |") ;
> @listing = <IN>;
> print "@listing";
> $user =
> @listng[0];$hspw=@listing[1];$fppw=@listing[2];$jcpw=@listing[3];
> print "$user";
> print "$hspw";
> close (IN);
Why is there a pipe, or |, at the end of the open command there?
-Scott
------------------------------
Date: Wed, 16 Aug 2000 17:45:02 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Help in Parsing
Message-Id: <j2clpss4uu02la96efiandlvk08kp7l8dq@4ax.com>
[alt.perl removed]
On Wed, 16 Aug 2000 14:52:21 GMT, sankarmukh@my-deja.com wrote:
> When I run this, it prints @listing, but nothing else;
> Obviously, I am confused about parsing the list.
> Any help is appreciated.
>
> **********************************************************
> #!/usr/local/bin/perl
No -w and no 'use strict;'
Please use these as they help you.
#!/usr/local/bin/perl -w
use strict;
> open (IN, " /u/ctssmuk/cntrlFilePL |") ;
You should check the return value for that open():
open IN, "/u/ctssmuk/cntrlFilePL |" or die "Can't fork: $!"
You might want to read the section "Pipe Opens" in the perlopentut
manpage.
> @listing = <IN>;
my @listing = <IN>;
> print "@listing";
> $user =
> @listng[0];$hspw=@listing[1];$fppw=@listing[2];$jcpw=@listing[3];
^^^^^^^^^^
1. typo.
2. You're assigning array-slices to a scalars.
my $user = $listing[0];
or use list context:
my($user, $hspw, $fppw, $jcpw) = @listing;
NOW is a good time to start using -w and strict.
> print "$user";
> print "$hspw";
> close (IN);
With piped-opens you will want to check the result of that close().
Read about close() in the perlfunc manpage:
perldoc -f close
--
Good luck,
Abe
------------------------------
Date: Wed, 16 Aug 2000 16:09:17 GMT
From: joellimardo@pocketmail.com
Subject: Re: Help in Parsing
Message-Id: <8neeaq$239$1@nnrp1.deja.com>
Okay, there are obviously a few problems here. First, note that I
assumed the contents of your input file were comma delimited items.
Here is the input file contents of foob.txt:
mano,kako,listner,iko,ikoo
Now let's look at your code. First, you have forgotten to use the
warnings flag. If you had used the following in your file, you would
have noticed some strange things about your code, including that you
misspelled listing as 'listng' during an assignment statement. Next,
you forgot to use strict, which isn't a requirement for such a trivial
example but will make more sense as you start creating longer/larger
scripts.
Here is a quick, working rewrite of your code:
#!/usr/local/bin/perl
#use strict;
open (IN, "foob.txt") ;
@listing = split(/,/,<IN>);
print "Listing: ", "@listing\n";
$user =
@listing[0];$hspw=@listing[1];$fppw=@listing[2];$jcpw=@listing[3];
print "User: " ,"$user\n";
print "Hspw: ", "$hspw\n";
close (IN);
This example only reads in one line from the input file, the first
one. If you are looking for something more comprehensive, try opening
the file handle and following it with something like while(<IN>)
{...assignment statements ...}.
You should also put all of those assignments using successive members
of an array into a loop of some kind to clean up the code.
In article <399AB144.F79F8531@yahoo.com>,
yanoff@yahoo.com wrote:
> sankarmukh@my-deja.com wrote:
> >
> > When I run this, it prints @listing, but nothing else;
> > Obviously, I am confused about parsing the list.
> > Any help is appreciated.
> >
> > **********************************************************
> > #!/usr/local/bin/perl
> > open (IN, " /u/ctssmuk/cntrlFilePL |") ;
> > @listing = <IN>;
> > print "@listing";
> > $user =
> > @listng[0];$hspw=@listing[1];$fppw=@listing[2];$jcpw=@listing[3];
> > print "$user";
> > print "$hspw";
> > close (IN);
>
> Why is there a pipe, or |, at the end of the open command there?
> -Scott
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Aug 2000 10:53:57 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Help in Parsing
Message-Id: <m3sns59p7u.fsf@dhcp11-177.support.tivoli.com>
sankarmukh@my-deja.com writes:
> #!/usr/local/bin/perl
#!/usr/local/bin/perl -w
This will show warnings, which should help you to figure out the
problem. But to really figure things out, you'll also want:
use strict;
Which will require some additional modifications:
> open (IN, " /u/ctssmuk/cntrlFilePL |") ;
> @listing = <IN>;
my @listing = <IN>;
> print "@listing";
> $user =
> @listng[0];$hspw=@listing[1];$fppw=@listing[2];$jcpw=@listing[3];
my $user = @listng[0]; # [SIC]
my $hspw = @listing[1];
my $fppw = @listing[2];
my $jcpw = @listing[3];
> print "$user";
> print "$hspw";
These quotes are unnecessary, though they will become necessary by the
time we are through.
> close (IN);
With just the "-w" added, you get quite a number of warnings that may
or may not help you to determine the problem. But with the inclusion
of "use strict;" and appropriate use of "my", some of the warnings go
away and a new error appears that highlights one of the two main
problems with this script:
Global symbol "@listng" requires explicit package name at ...
Ah-ha! A typo. Fixing this, however, still does not give you the
output you are expecting, but it does give you a clue to the remaining
problem. Also, the remaining warnings should be heeded and all of the
"@listing[0]" type expressions should be changed to "$listing[0]",
which is the proper way to access a single element of an array.
The new output is:
prod alpha beta gamma
prod alpha beta gamma
Use of uninitialized value in string at ...
From this, it should be clear that the entire input data is being
assigned to $user. This is because the "@listing = <IN>" statement
reads in the entire input and assigns each line to an element of the
array. Since there is only one line of input, it is assigned to the
0th element of the array.
I expect that you want something more like:
my @listing = split(' ', `/u/ctssmuk/cntrlFilePL`);
The entire script with one or two additional changes is:
#!/usr/local/bin/perl -w
use strict;
my @listing = split(' ', `/u/ctssmuk/cntrlFilePL`);
print "@listing\n";
my($user, $hspw, $fppw, $jcpw) = @listing;
print "$user\n";
print "$hspw\n";
For more information, see:
perldoc perlrun
(look for -w, also "perldoc warnings" and "perldoc perllexwarn")
perldoc strict
perldoc perldata
perldoc -f split
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 16 Aug 2000 19:37:53 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Help: libs with Latin-1 or Unicode?
Message-Id: <Pine.GHP.4.21.0008161936070.18331-100000@hpplus03.cern.ch>
Once again my apologies for the accident with posting email...
On Tue, 15 Aug 2000, Alan J. Flavell wrote:
> According to HTML standards, the language of a document has absolutely
> no relationship to the character coding. They are two totally
> independent factors.
> Would you find this page helpful, I wonder?
> http://ppewww.ph.gla.ac.uk/~flavell/charset/quick
------------------------------
Date: Wed, 16 Aug 2000 11:34:43 -0400
From: "Mirko Bulovic (LMC)" <lmcmibu@lmc.ericsson.se>
Subject: Re: How do I send data to another Server ???
Message-Id: <399AB493.AFAF3792@lmc.ericsson.se>
Hi,
I am using LWP::UserAgent (actually LWP::Simple) that you mentioned below to
fetch web pages from. I have a problem that one of the servers I am trying to
fetch from requires a username and password. I can't find in LWP how to send
a username and password with my request?
Mirko
Jonathan Stowe wrote:
> On Fri, 04 Aug 2000 14:42:29 GMT aaron@preation.com wrote:
> > In article <8mehlq$nib$1@nnrp1.deja.com>,
> > hugo.b@derivs.com wrote:
> >> Hi.
> >>
> >> I need to send some stringvalues to another server for calculation and
> >> then receive them back to send it to the HTML Page.
> >>
> > Is there any way to submit a value, much
> > like the question above, but as a HTML form POST to a server through
> > PERL.
> >
>
> The module LWP::UserAgent will make this possible.
>
> /J\
> --
> yapc::Europe in assocation with the Institute Of Contemporary Arts
> <http://www.yapc.org/Europe/> <http://www.ica.org.uk>
------------------------------
Date: Wed, 16 Aug 2000 17:51:44 +0100
From: David Chan <dpc29@hermes.cam.ac.uk>
Subject: HTML::Embperl::Execute won't recognise imported subroutines
Message-Id: <Pine.SOL.4.21.0008161742001.5426-100000@red.csi.cam.ac.uk>
Hi,
I can't get Embperl 1.2.1 (on Debian potato, perl 5.005, apache 1.3.9) to
"see" subroutines which are imported from another file, using the
Execute({ ..., import => 1 }) statement.
Here's an example of the problem, using two Embperl files; main_file.epl
and sub_file.epl. It works, but if I uncomment either of the commented
lines in the first file, I get an error: "Unknown embperl macro:
sub_in_subs_file".
Any help would be greatly appreciated!
====================== main_file.epl ======================
[$ sub sub_in_main_file $]
<p>
sub_in_main_file was called, with argument [+ $param[0] or $_[0] +].
</p>
[$ endsub $]
[-
Execute({ inputfile => 'subs_file.epl', import => 1 });
# Execute({ sub => 'sub_in_subs_file', param => [ 'one' ] });
# Execute('#sub_in_subs_file', 'two');
sub_in_subs_file('three');
Execute({ sub => 'sub_in_main_file', param => [ 'four' ] });
Execute('#sub_in_main_file', 'five');
sub_in_main_file('six');
-]
===========================================================
====================== subs_file.epl ======================
[$ sub sub_in_subs_file $]
<p>
sub_in_subs_file was called, with argument [+ $param[0] or $_[0] +]
</p>
[$ endsub $]
===========================================================
Thanks,
--
David Chan
------------------------------
Date: Wed, 16 Aug 2000 16:05:33 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: HTTP_REFERER
Message-Id: <8nee3t$1pv$1@nnrp1.deja.com>
In article <8ne6n5$ocp$1@nnrp1.deja.com>,
zideon@my-deja.com wrote:
> Hello,
>
> Is it possible with a Perl script to receive the complete url with the
> $ENV{HTTP_REFERER} command?? It works fine when a website vistor
> enter 'http://www.xyzyx.com/index.html'. When a visitor
> enter 'http://www.xyzyx.com/' the %ENV-hash
> returns 'http://www.xyzyx.com/'. Is it possible that the script
> discovers the full url (like 'http://www.xyzyx.com/NAME.html')?? ($url
> = $ENV{HTTP_REFERER} . "index.html";) is not the solution I am
> searching for...
Try $ENV{SCRIPT_FILENAME}
--
=============================
Richard More
http://www.richmore.com/
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 16 Aug 2000 15:57:30 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: LWP question
Message-Id: <splefa1vr5j168@corp.supernews.com>
In article <8neab0$ea4$1@panther.uwo.ca>,
J.D. Silvester <jsilves@julian.uwo.ca> wrote:
: I was playing around with LWP to try it out and I was wondering something.
: I was able to use a script to retrieve the contents of a web page and
: display it in my browser however, no images were returned. I assume that
: I would have to parse the HTML as it is coming back, look for image tags
: and generate requests for the images. My question is this: If I didn't
: want to dump the web page to a file, but wanted to send it straight to the
: browser window, what would I use to hold the images? I couldn't use a
: scalar variable could I? What about all the other things that a web page
: can contain like java applets, video, sound, etc.? How would those be
: dealt with?
You're talking about writing a proxy. Visit
<URL:http://language.perl.com/misc/abiprox/>
Greg
--
It will be generally found that those who sneer habitually at human
nature and affect to despise it, are among its worst and least pleasant
examples.
-- Charles Dickens
------------------------------
Date: Wed, 16 Aug 2000 16:00:42 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: LWP question
Message-Id: <8nedqt$1ec$1@nnrp1.deja.com>
In article <8neab0$ea4$1@panther.uwo.ca>,
jsilves@julian.uwo.ca (J.D. Silvester) wrote:
>
> I was playing around with LWP to try it out and I was wondering
something.
> I was able to use a script to retrieve the contents of a web page and
> display it in my browser however, no images were returned. I assume
that
> I would have to parse the HTML as it is coming back, look for image
tags
> and generate requests for the images. My question is this: If I
didn't
> want to dump the web page to a file, but wanted to send it straight
to the
> browser window, what would I use to hold the images? I couldn't use a
> scalar variable could I? What about all the other things that a web
page
> can contain like java applets, video, sound, etc.? How would those be
> dealt with?
>
> Yeah I know, why not just go to the page with your browser, why have
an
> intermediary script? Simple...TIMTOWTDI.
>
That would be called a proxy ;-)
http://crypto.stanford.edu/~dabo/proxy/
--
=============================
Richard More
http://www.richmore.com/
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 16 Aug 2000 08:21:38 -0700
From: Pan <admin@salvador.venice.ca.us>
Subject: Re: malformed header
Message-Id: <399AB182.999CFBDE@salvador.venice.ca.us>
This is really more of a cgi question than a perl question, but I'll
answe it anyway. You are probably getting that error when testing from
a browser rather than the cli. The problem is that when you submit a
form, you are expected to return an html document. If you are not using
cgi.pm ( which is unclear given the fact that you tried throwing in 'use
cgi;' at the end ), do not give the 'use cgi;' declaration. Instead,
insert this print statment in your code:
print "Content-type: text/html\n\n
<html>
<head>
<title>Form Submitted Properly</title>
<BODY>
<H1>The form worked</H1>
</BODY></html>";
If you are using cgi.pm, try
print header(),
start_html(-title=>'Form Submitted Properly!'),
h1('The form worked'),
end_html();
For good info on how to properly use cgi.pm, go to the source:
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
GI812 wrote:
>
> I have written some perl scripts which grab text fields submitted from
> an online form. The error I am getting is "HTTPD: malformed header from
> script /usr/local/......". Any idea as to what would be causing it? I
> currently have "#!/usr/local/bin/perl5" (which is the correct path) in
> the header and have tried adding the line "use CGI;" but it makes no
> difference. I have a perl interpreter on my 98 machine right now
> (ActivePerl) and it works fine with that. Any help would be greatly
> appreciated.
--
Salvador Peralta
admin@salvador.venice.ca.us
http://www.la-online.com
------------------------------
Date: Wed, 16 Aug 2000 15:26:25 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: malformed header
Message-Id: <8nebq6$uqc$1@nnrp1.deja.com>
In article <399AAB77.7DFA7F02@mail.com>,
GI812 <mail@mail.com> wrote:
> I have written some perl scripts which grab text fields submitted from
> an online form. The error I am getting is "HTTPD: malformed header
> from script /usr/local/......". Any idea as to what would be causing
> it?
this often happens because you are sending NO headers. if you are
using CGI.pm, look at the documentaion for header. in the absence
any code sample, i imagine the error is on line 17 of your script ;^)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 16 Aug 2000 17:14:38 GMT
From: Scott Kirk <undergronk@my-deja.com>
Subject: Re: Net::Dns broken, gethostbyname OK
Message-Id: <8nei59$70a$1@nnrp1.deja.com>
Guys,
thanks for the tips. I have tried Michael Fuhr's latest version of
Net::DNS - but still have the same problem.
From what Michael says on his web pages, it might be worth using an
older version of Perl (e.g. 5.005). I'll give that a go.
If that doesn't work I know a Unix system admin who might be persuaded
to look the other way for half-an-hour for a large enough quantity of
beer.
Cheers
--
Scott Kirk
My deja.com mailbox is full of spam. Use this instead:
perl -e '$_ = "znvygb: haqretebax\@lnubb.pbz";
tr/A-Za-z/N-ZA-Mn-za-m/; print;'
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Aug 2000 11:14:46 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: newbie: regex-question
Message-Id: <m3n1id9o95.fsf@dhcp11-177.support.tivoli.com>
Ren Maddox <ren.maddox@tivoli.com> writes:
> 1. ($file_name = $string) =~ s|.*/||; # Simple
> 2. $file_name = substr($string, rindex($string, "/")+1); # Fast
>
> Note that the second is about twice as fast for relatively short
> strings, but is not dependent on the length of the string, so becomes
> enormously faster for very long strings.
Well, not dependent on the length of the string before the final "/",
that is....
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 16 Aug 2000 11:13:29 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: newbie: regex-question
Message-Id: <m3pun99oba.fsf@dhcp11-177.support.tivoli.com>
"Hubert Ming" <hubert.ming@iggi.lu.ch> writes:
> how can i extract the file-name at the end of a variable string into a new
> variable:
> my string looks like this.
>
> wget --proxy-user=hubi.ming --proxy-passwd=xabcdex
> http://www.download.com/act Files_new_V4x/fuu4090.exe
>
> my $file_name should only have: "fuu4090.exe"
There is a lot of ambiguity here, but I'm going to assume that
$file_name should include everything after the final slash.
1. ($file_name = $string) =~ s|.*/||; # Simple
2. $file_name = substr($string, rindex($string, "/")+1); # Fast
Note that the second is about twice as fast for relatively short
strings, but is not dependent on the length of the string, so becomes
enormously faster for very long strings.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 16 Aug 2000 13:12:36 -0400
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: Perl - Blinking Text
Message-Id: <8nei24$9k3$1@panix6.panix.com>
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>I was shocked! How could Steven M. O'Neill <steveo@panix.com>
>say such a terrible thing:
>>fvw <fvw+usenet@var.cx> wrote:
>>>You'd prolly want to put a $|=1; in front of that..
>>
>>$!=17; seems to work ok too!!
>
>No it doesn't
That's why I cancelled the post you quoted. Thanks a lot.
I meant $|=17; But thought I'd stop wasting time being silly. Thanks
again.
--
Steven O'Neill steveo@panix.com
------------------------------
Date: 16 Aug 2000 17:51:32 +0100
From: nobull@mail.com
Subject: Reluctance to die (was: Replacing lines in a file)
Message-Id: <u9bsytnp86.fsf_-_@wcl-l.bham.ac.uk>
Albert Dewey <timewarp@shentel.net> writes gibberish including:
> open(FILE,">$file") or print "ERROR: 404<br>Cannot open $file because $!<br>";
> As an aside, I have been told that using 'die' on a failure is not
> as good as using a print error message as I have done above. Not
> sure why, but this is what I have been led to believe so this is
> what I do and I have no problems with it.
As a general rule this is very bad advice.
Perhaps you should go back the the person who told you this had find
out if they were talking about some specific circumstance where it
makes sense to use print() to the currently select()ed output stream
rather than die().
One such circumstance would be when when you are writing GGI scripts
and you'd never heard of GCI::Carp and never use select().
If they tell you that die() should be avoid in general you should stop
using them as a source of Perl advice.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 16 Aug 2000 10:11:15 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Replacing lines in a file
Message-Id: <MPG.14046b0a312b6f0298ac83@nntp.hpl.hp.com>
In article <slrn8pl95e.73q.rgarciasuarez@rafael.kazibao.net> on Wed, 16
Aug 2000 14:21:16 GMT, Rafael Garcia-Suarez <rgarciasuarez@free.fr>
says...
> Lincoln Marr wrote in comp.lang.perl.misc:
> >> perl -nie 'BEGIN{$key='THEKEY'} print if /^$key|\/';
> >
> >that didn't help either; am I doing something wrong? :
>
> This is not a line of perl code, this is a shell command.
> The equivalent perl script would be:
>
> #!/usr/bin/perl -ni
> BEGIN{$key='THEKEY'} print if /^$key|\/
No one seems to have noticed the incorrect regex, which is unterminated
as shown. Switch the vertical bar and the backslash:
/^$key\|/
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 16 Aug 2000 16:59:33 GMT
From: jomagam@yahoo.com
Subject: reseting the "counter" in each
Message-Id: <8neh97$5qp$1@nnrp1.deja.com>
Guys,
is there any way to reset the variable that remembers whichh hash
element was last returned by each,keys or values ? The Camel book
suggests to use keys in scalar context, but that is too expensive
sometimes; for example if the hash is tied to a database with 10k
records in it.
If there's no such perl builtin, then I might write a small XS function
that just resets that variable. Can anyone tell me if there's an XS call
for that ?
Thanks a bunch.
-Balazs
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 16 Aug 2000 17:52:40 GMT
From: vi_2000@hotmail.com
Subject: rollback perlcc'd binary to perl code
Message-Id: <8nekcu$9lm$1@nnrp1.deja.com>
HELP....
My rcs hosed up and I have lost several code revisions
on a perl project. I perlcc'd the code into a binary but
lost the code. All I have is the binary.
Is it possible to rollback the compilation to obtain the
perl code and if so, how difficult is it? I don't want to
recode the entire project if I can help it!!!
Thanks for the advice!
vi
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 16 Aug 2000 10:21:46 -0500
From: "Lithium" <lithium@ev1.net>
Subject: Root Capability from a CGI Script
Message-Id: <splc84lsr5j38@corp.supernews.com>
May be more of a unix question than perl, but since it's in perl...
We have this nice beautiful little script we made that automates much of our
work. An excellent command-line tool to use from telnet. Because of what
this script does, you pretty much have to run it from root.
Our problem: the Powers That Be want this to be able to run from a web form,
via cgi. As near as I can tell, there's no way to give the script root
access (so it can execute the commands) and there seems to be no way to
allow the cgi script to pass parameters to another script that DOES have
root access.
Maybe someone has a somewhat simple solution. The only one I can come up
with so far involves having a seperate program running on the server on a
specific port, and use socket code to allow the weak-access cgi scripts to
send their requests to the root-driven script. This would suck, to put it
simply.
------------------------------
Date: 16 Aug 2000 17:44:37 +0100
From: nobull@mail.com
Subject: Re: Root Capability from a CGI Script
Message-Id: <u9d7j9np9c.fsf@wcl-l.bham.ac.uk>
"Lithium" <lithium@ev1.net> writes:
> Our problem: the Powers That Be want this to be able to run from a web form,
> via cgi. As near as I can tell, there's no way to give the script root
> access (so it can execute the commands) and there seems to be no way to
> allow the cgi script to pass parameters to another script that DOES have
> root access.
SUID Perl scripts should work OK if Perl is correctly installed. If
the underlying OS doesn't implements SUID scripts unsafely or id Perl
is incorrectly installed you need a wrapper (as described in then
perlsec manpage).
Note: There are dangers in writing any SUID programs but Perl is
actually one of the better languages from that point of view and so
long as you carefully read the perlsec manapage first you should be
resonably safe.
Note: CGI scripts that run under Apache+mod_perl cannot be SUID
because Perl modules can't be SUID and mod_perl effectively
transmutes CGI scripts into modules. Of course this doesn't prevent
them calling SUID programs.
> Maybe someone has a somewhat simple solution. The only one I can come up
> with so far involves having a seperate program running on the server on a
> specific port, and use socket code to allow the weak-access cgi scripts to
> send their requests to the root-driven script. This would suck, to put it
> simply.
Sometimes this solution is better than the SUID approach. Usually
when performance is a big issue. Sometimes it isn't. BTW if you do
go down this path you should probably use named Unix-domain sockets
for this not network sockets.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 16 Aug 2000 11:35:36 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Root Capability from a CGI Script
Message-Id: <399AB4C8.3B6C5A62@attglobal.net>
Lithium wrote:
>
> May be more of a unix question than perl, but since it's in perl...
This line will get you in a few killfiles...
>
> We have this nice beautiful little script we made that automates much of our
> work. An excellent command-line tool to use from telnet. Because of what
> this script does, you pretty much have to run it from root.
suid?
>
> Our problem: the Powers That Be want this to be able to run from a web form,
> via cgi. As near as I can tell, there's no way to give the script root
> access (so it can execute the commands)
suid? a suid wrapper maybe? sperl?
------------------------------
Date: Wed, 16 Aug 2000 10:41:34 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Root Capability from a CGI Script
Message-Id: <399AD24E.2F39B454@vpservices.com>
Drew Simonis wrote:
>
> sperl?
But first check the advisory on sperl that came out yesterday:
http://www.cpan.org/src/5.0/sperl-2000-08-05/sperl-2000-08-05.txt
--
Jeff
------------------------------
Date: Wed, 16 Aug 2000 17:16:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: translating tr/a-z/A-Z/ best or s/.....
Message-Id: <00jlpsgv2cvombdle0v276dukp1o7v9aq2@4ax.com>
Jimmy Lantz wrote:
>which is the fastet and the most secure /*reliable*/ way to do this(see
>code below)
>The correct values of $some_code could be as follow
>KIN231
>KIN221d
>OSH765
>OSH765h
Fastest? I'm not sure. But using tr/// fro a non-uniform conversion
isn't a good idea.
Try:
s/^([a-z]+)(.*)/\U$1\L$2/i;
It will convert the largest possible substring of letters, starting at
the start of the main string, to uppercase, and the rest to lowercase.
--
Bart.
------------------------------
Date: Wed, 16 Aug 2000 15:59:44 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Use NT Logins in Perl?
Message-Id: <QTym5.118$NE3.8075@news.dircon.co.uk>
On Wed, 16 Aug 2000 14:09:31 GMT, Micheal Wrote:
> Hi there,
>
> Is there any way that I can use the network logins for authentification
> using Perl? I'm on an NT network and I do this in ASP via IIS. I just
> don't want to create and maintain another DB of username/passwords for
> everyone, I don't think the users would appreciate it either, it's hard
> enough for them to remember their main logins already...
>
Authen::SMB ?
Or perhaps consult the documentation for your server about how to set up
authentication - or comp.infosystems.www.servers.ms-windows ...
/J\
------------------------------
Date: 16 Aug 2000 17:01:21 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: what the heck is C<$_> ??
Message-Id: <8nehd1$6ns$1@news.NERO.NET>
In article <8ncaoc$fm7$1@orpheus.gellyfish.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>On 14 Aug 2000 23:40:12 GMT John Stanley wrote:
>> Do YOU have an explanation why someone would use pod in the Subject of a
>> USENET article?
>
>I dont think that the OP was knowingly using POD in the article - I think
>that he was actually asking what the literal construct 'C<$_>' meant.
I wasn't referring to the OP when I asked this question. I was referring
to someone who actually deliberately used POD in the Subject of some of
his postings. Can YOU think of any reason to do this other than to make
reading them harder? Is there a POD-enabled newsreader that would
properly translate this markup, and is it more common than the HTML
capable readers that cannot be accomodated?
------------------------------
Date: Wed, 16 Aug 2000 08:27:43 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Xemacs Perl menu
Message-Id: <399AB2EF.DF8A85DA@vpservices.com>
Javier Hijas wrote:
>
> How can I switch on all the Perl tools I find there?, some of them as
> "run", "syntax"... are always off.
Dunno about Xemacs, but in Gnu Emacs, installing and byte-compiling
cperl-mode.el and mode-compile.el did the trick for me.
--
Jeff
------------------------------
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 4035
**************************************