[18910] in Perl-Users-Digest
Perl-Users Digest, Issue: 1078 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 6 18:10:51 2001
Date: Wed, 6 Jun 2001 15:10:17 -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: <991865417-v10-i1078@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 6 Jun 2001 Volume: 10 Number: 1078
Today's topics:
Re: pack = lousy performance <abe@ztreet.demon.nl>
perl 5.6 install on vms vax <jy@dymaxion.ca>
Re: Perl debugger: specify lines within modules? <nospam-abuse@ilyaz.org>
Re: Perl is dead! Long live Perl! (Logan Shaw)
Re: perl/cgi and dynamic hyperlink (krakle)
Re: perl/cgi and dynamic hyperlink <lmoran@wtsg.com>
Re: PERL/HTML/IIS problems <rsherman@ce.gatech.edu>
Re: Process form WITHOUT feedback page PART 2 (GearGirl)
Re: Process form WITHOUT feedback page PART 2 <godzilla@stomp.stomp.tokyo>
Re: sortlen -- filter to sort text by line length (Greg Bacon)
Re: Storing fetched data?vvp nobull@mail.com
System call <dbohl@sgi.com>
Re: System call (Charles DeRykus)
Re: taint + netstat = error <joe+usenet@sunstarsys.com>
Re: Text::Autoformat (was Re: who is authentic?...) (Damian Conway)
Re: The difference between =~ and = <mjcarman@home.com>
Re: todo console script jmd2121@email.com
Re: using CGI and CGI::Cookie at the same time (dave)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 06 Jun 2001 20:43:15 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: pack = lousy performance
Message-Id: <84usht41b1n84ipbumpkevgjbgpl6ur4t5@4ax.com>
[Please, state your comments _after_ the trimmed text you reply to]
[rearranged]
On Tue, 05 Jun 2001 15:58:38 -0400, Spammer Killer
<NoSpam@SpammerKiller.com> wrote:
>
> Thorbjørn Ravn Andersen wrote:
>
> > Spammer Killer wrote:
> >
> > > Each index record reduces to 6 integers. Naturally, I thought the "best"
> >
> > The integers are stored as strings. This is the most likely reason for
> > the results you are getting.
>
> Say, What?
>
> Where are they stored as strings? If you are referring to $i{1-6} in:
> print pack 'LLCCSS', $i1, $i2, $i3, $i4, $i5, $i6;
> I should have mentioned they are originally set to the size of the hash ($i1 =
> %hash;) and no string operations are ever performed.
>
> Are you saying Perl converts the size of a hash to a string before assigning
> it to a scalar?
Try the next little program (mark the warning):
#!/usr/bin/perl -w
use strict;
my %hash = ( key1 => 1, key2 => 2, key3 => 3 );
my $i = %hash;
print "scalar \%hash = $i\n";
my $p = pack 'L' => $i;
print "packed: $p\n";
printf "Unpacked: %u\n", unpack 'L' => $p;
__END__
--
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -e '$_=sub{split//,pop;print pop while@_};&$_("rekcah lreP rehtona tsuJ")'
------------------------------
Date: Wed, 6 Jun 2001 17:41:04 -0300
From: "June Young" <jy@dymaxion.ca>
Subject: perl 5.6 install on vms vax
Message-Id: <BzwT6.245503$Z2.2803648@nnrp1.uunet.ca>
I try to compile perl-5_6_1 on VMS VAX 6.2 with DEC C version 6.0.
@configure seems OK.
I got link errors on command MMS for undefined symbols. The following
is part of the log
Link /NoTrace/NoMap/Trace/Exe=MINIPERL.EXE
miniperlmain.obj,libperl.olb/Library/Include=globals
,[]crtl.opt/Options
%LINK-W-NUDFSYMS, 17 undefined symbols:
%LINK-I-UDFSYM, DECC$DDRAND48
%LINK-I-UDFSYM, DECC$FCNTL
%LINK-I-UDFSYM, DECC$FTRUNCATE
%LINK-I-UDFSYM, DECC$H_ERRNO_GET_ADDR
%LINK-I-UDFSYM, DECC$SETENV
%LINK-I-UDFSYM, DECC$SIGACTION
%LINK-I-UDFSYM, DECC$SIGLONGJMP
%LINK-I-UDFSYM, DECC$SIGSETJMP
%LINK-I-UDFSYM, DECC$SRAND48
%LINK-I-UDFSYM, DECC$TRUNCATE
%LINK-I-UDFSYM, DECC$__UNIX_GETEUID
%LINK-I-UDFSYM, DECC$__UNIX_GETUID
%LINK-I-UDFSYM, DECC$__UTCTZ_GMTIME
%LINK-I-UDFSYM, DECC$__UTCTZ_LOCALTIME
%LINK-I-UDFSYM, DECC$__UTC_FSTAT
%LINK-I-UDFSYM, DECC$__UTC_STAT
%LINK-I-UDFSYM, DECC$__UTC_TIME
%LINK-W-USEUNDEF, undefined symbol DECC$__UNIX_GETUID referenced
in psect $CODE offset %X00001BFE
in module PERL file
DSA2:[DYMAX.PERL500601.PERL-5_6_1]LIBPERL.OLB;1
%LINK-W-USEUNDEF, undefined symbol DECC$__UNIX_GETEUID referenced
in psect $CODE offset %X00001C0C
Can anyone give me a hint?
Thanks,
June Young
------------------------------
Date: Wed, 6 Jun 2001 21:32:27 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Perl debugger: specify lines within modules?
Message-Id: <9fm7hb$1ajj$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Jeff Boes
<jboes@nexcerpt.com>], who wrote in article <20010606.103954.11614769.26368@takin.private.nexcerpt.com>:
> Is there a way to specify a breakpoint within another module? E.g.,
h f
With my latest patches, there is just enough exposed API to make an alias for
b File.name:123
> I want to set a breakpoint in Foo::stub at some line number, but I don't
> want to wait until stub() gets called before I set the breakpoint.
l Foo::stub
b #Number#
Hope this helps,
Ilya
------------------------------
Date: 6 Jun 2001 16:00:53 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Perl is dead! Long live Perl!
Message-Id: <9fm5m5$9m0$1@charity.cs.utexas.edu>
In article <slrn9hsjnj.4sh.tadmc@tadmc26.august.net>,
Tad McClellan <tadmc@augustmail.com> wrote:
>You can flip burgers with 22 characters of Perl.
>
> s/burgers/reverse$&/e;
>
>If anyone knows Java well, please post the guts of what it would
>take to get that done in Java.
I'm 100% clear on what the task is to be performed, but if it's to
reverse "burgers" and then print it, it's just this:
StringBuffer s = new StringBuffer("burgers");
s.reverse();
System.out.println (s);
If you want to be more compact, you can always do
System.out.println ((new StringBuffer("burgers")).reverse());
Actually, your example does something different -- it finds the first
occurence of "burgers" in $_ and then reverses that. That would be
more difficult in Java since Java doesn't have regular expressions. On
the other hand, there are things you can do much more concisely in Java
than you can in Perl. For instance, Java has built-in binary search
and built-in comparison for arrays.
- Logan
--
my your his her our their _its_
I'm you're he's she's we're they're _it's_
------------------------------
Date: 6 Jun 2001 13:08:23 -0700
From: krakle@visto.com (krakle)
Subject: Re: perl/cgi and dynamic hyperlink
Message-Id: <237aaff8.0106061208.30e31310@posting.google.com>
Joe Schaefer <joe+usenet@sunstarsys.com> wrote in message news:<m3r8wyj13h.fsf@mumonkan.sunstarsys.com>...
> krakle@visto.com (krakle) writes in reference to buggs' comment:
>
> >> "Newbies bitching is even worse than regulars bitching."
> >
> > I come sporadicly to this NewsGroup. Newbie to perl? No, I been
> > codingin Perl for a couple of years now. Newbie to this group? I dont
> > care if you classify me under that particular categlory. I only rarely
> > come here. I dont really have time to come here like Godzilla and post
> > under every thread. I have what us normal people call a life. A real
> > life.
> ^^^^
>
> Yes, and as I understood things, this is exactly what buggs was
> referring to.
People this is the internet.. Answer the questions posted or just
ignore the message... I find it very funny that you regulars will call
someone a Perl newbie because they are new to this NEWSGROUP but yet
still reside to insult them even though these "newbies" know more
about perl than they do....
I bet if Larry Walton came here under an alias (Lets just say
WaffleKing) you would probably call him a newbie as well... Humor
me...
------------------------------
Date: Wed, 06 Jun 2001 17:10:03 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: perl/cgi and dynamic hyperlink
Message-Id: <h07tht0c46tr3isgvcusfnm53iecujepim@4ax.com>
On 6 Jun 2001 13:08:23 -0700, krakle@visto.com (krakle) wrote
wonderful things about sparkplugs:
SNIP
>I bet if Larry Walton came here under an alias (Lets just say
>WaffleKing) you would probably call him a newbie as well... Humor
>me...
Who is Larry Walton?
--
BSOD? In my day we didn't have 0000FF!
lmoran@wtsg.com
------------------------------
Date: Wed, 06 Jun 2001 16:08:42 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: PERL/HTML/IIS problems
Message-Id: <3B1E0F3A.FEE77AE5@ce.gatech.edu>
David wrote:
> I am trying to use PERL on an NT server to generate HTML. My company
> has a huge network with lots of file servers. I want it to read a
> folder on a server
> to which the users have access, create a pull-down with all the files in
> that folder, and allow the user to pick and load a file.
> I want to provide a convenient interface for users to access files
> located on different servers without them having to remember the server
> name
> and share, map the server under windows, and navigate there. There are
> two problems:
>
> 1) The web server doesn't seem to be able to access the data server
> 2) I can't figure out what kind of JavaScript code should go into the
> onChange event to get it to load the file with the appropriate
> application.
> (This is easy using straight html).
>
> Any help would be appreciated.
>
> Here are some comments from a company Newsgroup:
>
> David wrote:
> >
> > I don't have my own account on the server, but I have access to it.
> I
> > can read and write the files for my website.
> > but that sounds like its running under the IIS/Server account.
> >
> > Shouldn't it still be able to read a public folder?
>
> Well that depends on how you define "public." If the permissions on
> the
> folder are such that group Everyone has access to it, then yes, it
> should work. But the account IIS uses when running your script is a
> local account that exists only on that NT web server. As such, you
> can't assign it permissions on another box since it's not viewable
> outside of the current server (it's not a domain account.)
>
> See URL below for more info.
>
>
> http://support.microsoft.com/support/kb/articles/Q188/7/12.ASP?LN=EN-US&SD=gn&FR=0&qry=iusr&rnk=11&src=DHCS_MSPSS_gn_SRCH&SPR=MSALL
>
> This is the PERL code.
> -----------------------------------------------------------------------------------------------------------------------
>
> use English; # English language OS error message module
> print "Content-type:text/html\n\n";
>
> # ---- Declarations -----
> # Base directory for files is dir. from which the .pl was loaded, but
> base dir for the HTML
> # generated by the .pl is the dir. .pl is located.
>
> # This is a valid file server on my company's network. I have access to
> it, but I'm not sure the server can access it.
> # I had to escape each of the backslashes
> $sepgDir =
> "\\\\filserver-0302\\share1\\folder_1\\subfolder_1\\WordTemplates";
>
> # $sepgDir = ".\\WEBSITES\\myWebsite"; # this one actually works. It
> references a valid folder on the NT server itself.
>
> print <<EOF;
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> # etc. etc.
> # this is all the stuff for an html header
> EOF
>
> # This always fails: It writes out this message: can't open
> \\fil-nw03-02\cscmm\SEPG_processes\core_SEPG\SEPG_process_tool_box\approved\templates:
> No such file or directory
> opendir (SEPGDIR, $sepgDir) or die "can't open $sepgDir: $OS_ERROR\n";
>
> # I can get to the following code if I use the following to reference to
> the web server itself
> # $sepgDir = ".\\CSIS\\procmgt";
>
> @sepgFiles = readdir (SEPGDIR);
>
> # I want to create a pull-down to select a file, but I can't figure out
> how to launch the file. Most of them will simply be .doc, .ppt, or .xls
> #
> print '<form name="sepgFiles">', "\n";
> print ' <select name="sepgSelect"', "\n";
> print '
> onChange="if(this.options[this.selectedIndex].value!=\'$\')', "\n";
> print ' {fileName = \'', $sepgDir, "'", ' + \'\\\\\' +
> this.options[this.selectedIndex].value; location.href = \'file:\' +
> fileName }', "\n";
> print ' ">', "\n";
> print ' <option selected value="\$">Templates for PMIP</option>',
> "\n";
>
> foreach (@sepgFiles)
> {
> print ' <option value=', $_, '>', $_, '</option>', "\n";
> };
> print ' </select>', "\n";
> print '</form>', "\n";
>
> print <<EOF;
> # etc. etc.
> # this is all the junk that finishes out the html
> EOF
neither of your problems would seem to be with perl...
1. has to do with server permissions
2. has to do with javascript
if this is not the case, please restate your problem emphasizing the perl aspects.
------------------------------
Date: 6 Jun 2001 12:47:35 -0700
From: m-m@lcc.net (GearGirl)
Subject: Re: Process form WITHOUT feedback page PART 2
Message-Id: <6f51e848.0106061147.51029d35@posting.google.com>
m-m@lcc.net (GearGirl) wrote in message news:<6f51e848.0106041249.1e41b58d@posting.google.com>...
[massive snippage]
FIRST: to nobull -- that's ok, I was wondering what happened. : )
I thought this NG would be ideal, since you guys deal with Perl all
the time and I didn't know if this was a limitation in the way the
script is interpreted or if there was a piece of a Perl script that
would stop the browser from opening a new window.
Regardless, I apologize now for any future boo-boos if I mispost.
SECOND: to Godzilla! -- yeah, I know the \n instead of \n\n was bad.
However, guess where I got it from?? O'Reilly. Go to the bottom of
the page in this link and check it out:
http://www.oreilly.com/openbook/cgi/ch03_07.html
That's also where I got the idea to use both "Content-type" AND
"Status". I'm still new enough to this that I trusted what was
written there. Maybe I shouldn't???
THIRD: to HELGI -- a little harsh, there, but I tried the CGI.pm call
and it worked. I don't really see how the code is THAT BAD, all I'm
doing is parsing the form, checking for a cookie (and getting the
cookie data and logging the pageview if a cookie exists), and
generating an HTML page if there isn't a valid cookie. How would you
write such a script?
~Melissa
------------------------------
Date: Wed, 06 Jun 2001 13:53:53 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Process form WITHOUT feedback page PART 2
Message-Id: <3B1E9861.D0F34254@stomp.stomp.tokyo>
GearGirl wrote:
> GearGirl wrote:
> [massive snippage]
> SECOND: to Godzilla! -- yeah, I know the \n instead of \n\n was bad.
Not really. I often forget both newlines. Very minor mistake
not worth worry. It would have gotcha sooner or later and
you would have fixed it.
> However, guess where I got it from?? O'Reilly. Go to the bottom of
> the page in this link and check it out:
> http://www.oreilly.com/openbook/cgi/ch03_07.html
> That's also where I got the idea to use both "Content-type" AND
> "Status".
It is an error in coding. Without the status 204 code,
an internal server error message will be generated.
The "no response" status, although it follows the
incorrect content type print, supercedes all else.
Their code doesn't cop an error purely by luck and,
fails to print anything because of this error.
Another "almost error" is indicating a print after providing
a "no response" status code. Logic is simple. If you send a
no response status, your response should only be that. The
very wording indicates what has happened; nada, zippo, nothing.
Some browsers will support what O'Reilly does, some will not.
It is illogical to write code which may or may not work.
Better off to provide needed header information and leave
well enough alone. This is especially true for what you
want to do; remain in place. If you provide a print, your
method won't work, a new page will be displayed, which
is not in keeping with no response. Very oxymoronic, yes?
I am very curious if your previous printing of a no response
status followed by html is what is messing up MSIE. I'm laying
odds it is; your html lacks a content type print.
On your comment on CGI.pm, use of this module would be
massive overkill and really slow down your script
along with forcing you to add a lot of code. You are
right, a simple read and parse is a better choice.
Do be careful about security however. A person could
replicate your form action, elsewhere. It would be
very difficult to compromise security but not impossible.
You need to pay attention to what your input holds along
with the content length.
> I'm still new enough to this that I trusted what was
> written there. Maybe I shouldn't???
I doubt you are new to this.
Any code pulled from literally anywhere, should be
exhaustively tested before assuming it is good code.
They say Matt Wright's code is buggy?
* laughs *
Godzilla!
------------------------------
Date: Wed, 06 Jun 2001 21:05:12 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: sortlen -- filter to sort text by line length
Message-Id: <tht6o88jok11ab@corp.supernews.com>
[Followups set.]
In article <9flop1$4plfn$1@ID-37382.news.dfncis.de>,
Andreas Krennmair <a.krennmair@aon.at> wrote:
: #!/usr/bin/perl
: # sortlen -- filter to sort text by line length
: # (c) 2001 Andreas Krennmair <a.krennmair@aon.at>
: # distribute after the terms of the GPL
:
: @lines = ();
: while ($line = <STDIN>) {
: @lines = (@lines, $line);
: }
Why? Perl has a push operator that is much more efficient:
push @lines, $line;
However, it's even easier to grab all input in one go:
@lines = <STDIN>;
: for ($i = 1; $i < @lines ; $i++) {
: $v = $lines[$i];
: $j = $i;
: while ($j > 0 && length($lines[$j-1]) > length($v)) {
: $lines[$j] = $lines[$j-1];
: $j--;
: }
: $lines[$j] = $v;
: }
I'd say the following is much clearer:
@lines = sort { length($a) <=> length($b) } @lines;
: foreach $lines (@lines) {
: print $lines;
: }
I would probably write that as
print for @lines;
but some people would simply say
print @lines;
TMTOWTDI!
Greg
--
Now, it might be true that www.mtv.com attracts more visitors and gets
more "hits" than a site that makes RFCs available. But who the fuck cares?
-- Abigail
------------------------------
Date: 06 Jun 2001 19:26:20 +0100
From: nobull@mail.com
Subject: Re: Storing fetched data?vvp
Message-Id: <u9vgm9xy5v.fsf@wcl-l.bham.ac.uk>
"Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com> writes:
> my
> ($cat_sot,$cat_sod,$cat_gid,$cat_1,$cat_d1,$cat_2,$cat_d2,$cat_3,$cat_d3);
> while
> (($cat_sot,$cat_sod,$cat_gid,$cat_1,$cat_d1,$cat_2,$cat_d2,$cat_3,$cat_d3)
> = $sth->fetchrow_array )
> {
> $cats{$cat_sot} = $cat_num;
>
> print
> $cgi->p("$cat_sot,$cat_sod,$cat_gid,$cat_1,$cat_d1,$cat_2,$cat_d2,$cat_3,$cat_d3");
> }
> err_trap("Error fetching category names") if $DBI::err;
>
> I want to store all the fetched rows in to an array matched by their
> cataegory name.
What do you mean by the phrase "matched by their cataegory name."
> ie. cat_sot(1)="dog"
> cat_sod(1)="shepard"
> .....cat_d3(1) ="purbred"
> cat_sot(2)="chicken"
> cat_sod(2)="rooster"
> .....cat_d3(2)="mutt"
This is a Perl newsgroup, please express what you want in Perl. I
think what you are trying to say is you want.
$cat_sot[0]="dog";
$cat_sod[0]="shepard";
#...
$cat_d3[0] ="purbred";
$cat_sot[1]="chicken";
$cat_sod[1]="rooster";
#...
$cat_d3[1]="mutt";
> How would I go about doing this in Perl.
Like I said, this is the wrong thing to want but if it's really what
you want:
my (@cat_sot,@cat_sod,@cat_gid,@cat_1,@cat_d1,@cat_2,@cat_d2,@cat_3,@cat_d3);
while ( my @row = $sth->fetchrow_array ) {
push @$_, shift @row
for \(@cat_sot,@cat_sod,@cat_gid,@cat_1,@cat_d1,@cat_2,@cat_d2,@cat_3,@cat_d3);
}
> Then pass this data to other subroutines or even back to the main routine.
Like I say 9 separate named arrays is the wrong approch. Use a single
variable.
> I have read about the 'hash' but am unsure how to use it in this
> context.
Go read some more.
I can't say without more context if a LoH or HoL is the better way to
go:
# %cat is a HoL
$cat{sot}[0]="dog";
$cat{sod}[0]="shepard";
#...
$cat{d3}[0] ="purbred";
$cat{sot}[1]="chicken";
$cat{sod}[1]="rooster";
#...
$cat{d3}[1] ="mutt";
my %cat;
while ( my @row = $sth->fetchrow_array ) {
push @$_, shift @row for @cat{'sot','sod','gid',1,'d1',2,'d2',3,'d3'}; {
}
# @cat is a LoH
$cat[0]{sot}="dog";
$cat[0]{sod}="shepard";
#...
$cat[0]{d3} ="purbred";
$cat[1]{sot}="chicken";
$cat[1]{sod}="rooster";
#...
$cat[1]{d3} ="mutt";
my @cat;
while ( my @row = $sth->fetchrow_array ) {
my %rowhash;
%rowhash{'sot','sod','gid',1,'d1',2,'d2',3,'d3'} = @row;
push @cat, \%rowhash;
}
The LoH apprach is less memory efficient but is the more common idiom
in Perl because it allows you you pass around a row entry as a single
thing. If memory usage is an issue the consider using a pseudo hash:
my $pseudo_hash_legend =
{ sot=>1, sod=>2, gid=>3, 1=>4, d1=>5, 2=>6, d2=>7, 3=>8, d3=> 9};
my $cat = $sth->fetchall_arrayref;
unshift @$_, $pseudo_hash_legend for @$cat;
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 06 Jun 2001 15:08:11 -0500
From: Dale Bohl <dbohl@sgi.com>
Subject: System call
Message-Id: <3B1E8DAB.DD2F1EBE@sgi.com>
I'm performing a kernel tuning command on a remote
host using the system command. It just so happens that
the command I run remotely prompts for a yes or no.
Here's the actual command I'm using.
system ("rsh $host systune syssegsz 12288");
When run locally it responds with the following so
somehow I'd like to send a y and CR. Anyone know
how I could do that?
Do you really want to change syssegsz to 9218 (0x2402)? (y/n)
--
Thanks,
Dale
Dale Bohl
SGI Information Services
dbohl@sgi.com
(715)-726-8406
http://wwwcf.americas.sgi.com/~dbohl/
------------------------------
Date: Wed, 6 Jun 2001 21:35:21 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: System call
Message-Id: <GEJ2My.5nJ@news.boeing.com>
In article <3B1E8DAB.DD2F1EBE@sgi.com>, Dale Bohl <dbohl@sgi.com> wrote:
>
> I'm performing a kernel tuning command on a remote
>host using the system command. It just so happens that
>the command I run remotely prompts for a yes or no.
>
>Here's the actual command I'm using.
>
>system ("rsh $host systune syssegsz 12288");
>
>When run locally it responds with the following so
>somehow I'd like to send a y and CR. Anyone know
>how I could do that?
>
>
>Do you really want to change syssegsz to 9218 (0x2402)? (y/n)
>
system qq{ rsh $host "echo y|systune syssegsz 12288" };
Alternatively, you could use backticks or the qx
operator to capture rsh output if needed.
Also you can check the error return (perldoc -f
system). rsh throws a monkey wrench into this
but maybe this this is simple enough to justify
eliding the check.
--
Charles DeRykus
------------------------------
Date: 06 Jun 2001 16:45:29 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: taint + netstat = error
Message-Id: <m3bso1ibh2.fsf@mumonkan.sunstarsys.com>
Ryan Travis Tate <ryantate@OCF.Berkeley.EDU> writes:
> here is an excerpt of the reply, which accompanied a "patch for bleadperl":
>
> | You're being caught by the effect mentioned somewhat obliquely in perlsec:
> |
> | Any variable set to a value derived from tainted data will
> | itself be tainted, even if it is logically impossible for
> | the tainted data to alter the variable.
> |
> | The reason for this is efficiency, since it's only necessary to do taint
> | checks on a whole expression rather that for each operator.
>
> i do not understand this reply, and rather than immediately bother the
> p5p folk with my ignorance, it thought i would ask here: how does this
> explanation have anything to do with the examples shown by joe above
> (and submitted by me in my bug report)? there are *no variables
> involved* in these test cases, so how can the bug be related to the
> fact that "any variable ... will itself be tainted" because blah blah
> blah?
AFAICT, it's not so much that there are any "variables" involved, but
whether or not the "expression" performs an "unsafe operation", and
that perl learned that the "expression" still contains tainted data
right before it actually attempts to perform the "unsafe operation".
It's difficult for me to explain this precisely. Rather than try to
handwave an answer that I'm not qualified to give, here's some code
that I hope shows the difference:
% perl -wTle 'undef %ENV; print `echo 1`, $ARGV[0]' 2
1
2
% perl -wTle 'undef %ENV; print $ARGV[0], `echo 2`' 1
Insecure dependency in `` while running with -T switch at -e line 1.
contains an unsafe operation
% perl -wTle `undef %ENV; print $ARGV[0]=0, `echo 2`' 1
02
I think what Mike Guy is trying to say is that your "bug" is caused
by an "optimization", i.e. it's a perl "feature" (note the lowercase
"p"). The documentation patch he submitted seems to reflect this.
Now that you know what "idio-matic Perl" really means, you can just
drop the hyphen in your real code's comment.
[...]
> +The value of an expression containing tainted data will itself be
> +tainted, even if it is logically impossible for the tainted data to
> +affect the value.
>
> but i still don't see where joe's test case has *any tainted data*.
The return value of the first `true` operation is tainted, which
causes the second instance to balk. (The first pair of backticks
*is* executed).
HTH
--
Joe Schaefer "Whatever you are, be a good one."
-- Abraham Lincoln
------------------------------
Date: 6 Jun 2001 20:20:13 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Text::Autoformat (was Re: who is authentic?...)
Message-Id: <9fm39t$355$1@towncrier.cc.monash.edu.au>
gbacon@HiWAAY.net (Greg Bacon) writes:
>: Text::Autoformat is not capable of recognizing its own authentic
>: language anymore :-) Maybe I did not try all options yet ?
>I believe recognizing code sections in on the TODO list.
*High* on the ToDo list.
Damian
------------------------------
Date: Wed, 06 Jun 2001 13:19:52 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: The difference between =~ and =
Message-Id: <3B1E7448.73A6C78D@home.com>
Lou Moran wrote:
>
> if you run this:
>
> $foo = (AbcDEFGhi) ;
This will not work under strict. Please quote your strings properly.
my $foo = 'AbcDEFGhi';
> $foo =~ tr/A-Z/a-z/ ;
> print $foo ;
>
> you get:
>
> abcdefghi
>
> if you run this: (I have run it with warnings)
>
> $foo = (AbcDEFGhi) ;
> $foo = tr/A-Z/a-z/ ;
> print $foo ;
>
> you get this:
>
> 0
>
> what does this happen?
Because you have asked Perl to do two completely different things.
= is the assignment operator
=~ is the binding operator
Why would you expect them to do the same thing? Read the perlop manpage
entries for = (under Assignment Operators), =~ (under Binding
Operators), and tr/// (under Regexp Quote-like Operators).
-mjc
------------------------------
Date: Wed, 06 Jun 2001 21:50:42 GMT
From: jmd2121@email.com
Subject: Re: todo console script
Message-Id: <3b1ea54e.268975065@nntp.stanford.edu>
wow.
thanks!
as I said ... I have a lot to learn.
did not mean to be demeaning... I didn't know that was the way
'use strict' was percieved
Thank you for all your comments.
Cheers,
jmd
On Tue, 5 Jun 2001 09:17:26 -0400, tadmc@augustmail.com (Tad
McClellan) wrote:
>jmd2121@email.com <jmd2121@email.com> wrote:
>>I wrote a script to manage a 'todo' list
>>
>>it is here:
>>http://bowser.stanford.edu/cgi-bin/scripts#todo
>>
>>I'm pretty new to perl, and I was wondering if people could give me
>>comments on it.
>
>
>You should not ask for humans to comment until after you have
>asked the machine for comments. It is inefficient (and a bit
>demeaning) to ask people to do a machine's job.
>
>Enable warnings and strictures *before* requesting a code review!
>
> #!/usr/bin/perl -w
> use strict;
>
>
>Please ask us again after you get those worked in.
>
> perldoc strict
>
>to find out what "use strict" does.
>
>
>>Maybe other people would find it useful too.
>>
>>Some areas I'd like to have comments on:
>>
>>- Coding style... any criticism would be helpful. I'm sure there
>>are things I could do better / more eloquently.
>
>
>You don't need to initialize the arrays to empty. They are guaranteed
>to be empty anyway.
>
> my @list;
>
>-----
>
>You can eliminate some of the punctuation, which may make your
>code easier to maintain:
>
> $storefile = $ARGV[0] if $ARGV[0]; #if ($ARGV[0]){$storefile = $ARGV[0]};
>
> if ( $key eq "a" or $key eq "A"){ #if (($key eq "a") ||($key eq "A")){
>
>-----
>
>To call a subroutine, you need one of the below. You have zero of them :-)
>
> 1) use parenthesis after sub name: PrintList();
>
> 2) use ampersand before sub name: &PrintList;
>
> 3) subroutine definition seen in code before subroutine call
>
> 4) forward declaration of sub before sub call
>
>-----
>
>You might want to recast the multiple "if $key eq ..."s to something
>like the answer given for this Perl FAQ:
>
> "How do I create a switch or case statement?"
>
>-----
>
>Don't call backticks in a void context:
>
> `$cal_command`; # bad
>
> !system $cal_command or die "problem running '$cal_command' $!";
>
>-----
>
>Choice of data structure can make a big difference in how easy/hard
>the implementation will be. You seem to be maintaining 3 separate
>yet parallel arrays (@list, @add_time, @due_time). If they are
>related (parallel), then they should be grouped together in a
>multilevel data structure (LoL in this case: perldoc perllol).
>
>-----
>
>You don't need to concern yourself with "numberness", perl will
>convert a string to a number when you use a string as a number:
>
> # not needed (unless you want to truncate a float): $number = int($key);
>
>-----
>
>use Perl's localtime() and sprintf() instead of the *nix 'date' command
>for portability.
>
>-----
>
>write "!~" instead of "! ... =~" for "negative" pattern matches.
>
> $txt !~ /now|tom|today/; # !($txt =~ /now|tom|today/)
>
>probably should have word boundaries in the match too:
>
> $txt !~ /\b(now|tom|today)\b/;
>
>or other anchors:
>
> $txt !~ /^(now|tom|today)$/;
>
>-----
>
> if ($_[0]) {$outfile = $_[0];}
> else {$outfile = $storefile;}
>
>can be replaced with:
>
> $outfile = $_[0] or $storefile;
>
>-----
>
>diag messages should include the $! special variable:
>
> $fileh->open("> $outfile") || die "unable to open file: $outfile $!";
>
>-----
>
>You can eliminate the unportable use of "cat" in ReadData():
>
> open STOREFILE ...
> my @lines = <STOREFILE>; # slurp the entire file, one line per element
> close STOREFILE;
>
>you could at least do away with the unnecessary $data temp var:
>
> my @lines = `cat $storefile`; # backticks in list context
> chomp @lines;
>
>-----
>
>Booleans are *always* scalars, no need to force it with scalar().
>
>-----
>
>
>
>>- I tried to write a signal handler, but it only appears to catch the
>>first SIGINT (which I expected). I tried to reset the handler after
>>the call, (or even in the main loop) but I wasn't ableto get the
>>handler to continue work. Am I missing something?
>
>
>You call exit() inside of your handler. Your program itself is gone
>for 2nd and subsequent signals :-)
>
>
>>- It currently will not work on Windows platforms -- some of the
>>changes are obvious, but others, (like calling system (stty)) are not.
>>Any suggestions for making it portable?
>
>
> perldoc -q keyboard
>
>
>>I'd appreciate any (constructive) comments people have!
>
>
>HTH!
>
>
>--
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: 6 Jun 2001 14:21:13 -0700
From: usted@cyberspace.org (dave)
Subject: Re: using CGI and CGI::Cookie at the same time
Message-Id: <e2c00ae.0106061321.7e6d1ac6@posting.google.com>
>
> I don't know- there must have been some reason CGI::Cookie was built on top
> of CGI
Under it.
CGI
-Cookie
-Standard
etc.
Just do:
use CGI;
and it will include everything.
dave
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1078
***************************************