[9308] in Perl-Users-Digest
Perl-Users Digest, Issue: 2903 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 18 17:07:12 1998
Date: Thu, 18 Jun 98 14:00:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 18 Jun 1998 Volume: 8 Number: 2903
Today's topics:
Re: 2 questions about lists <JKRY3025@comenius.ms.mff.cuni.cz>
Re: ?CGI scripts & Explorer <JKRY3025@comenius.ms.mff.cuni.cz>
add a record into file DBF with perl peacemakers@my-dejanews.com
Re: broken upload program <rootbeer@teleport.com>
Re: Checking for timeouts when using IO:Socket::INET <rootbeer@teleport.com>
Re: Email address checker - comments welcome (Dave Lorand)
Faster Search <probavm@h8mail.laf.cat.com>
Re: Faster Search (Steve Linberg)
Help combining two files. (steve)
Help! Database file modification (Dave Neuer)
Re: Help! Database file modification <ebohlman@netcom.com>
Re: hmmm, suggestions? <ebohlman@netcom.com>
Re: Making Life Easy - Templates, XSSI, Variables and s <rootbeer@teleport.com>
Re: MODE in mkdir <rootbeer@teleport.com>
Re: Module Problems: IO object version 1.19 does not ma (Michael J Gebis)
Modules <kenkim@gncom.com>
Re: Modules (Steve Linberg)
Re: Moving application from DOS to a GUI. <ebohlman@netcom.com>
Re: Need help with substr() (Andy Lester)
Re: Net::Ftp module <rootbeer@teleport.com>
parsing (Amanda Silver)
Re: Perl with ASP? (Patrick Timmins)
Re: Pod::Text -- Unix only? <tchrist@mox.perl.com>
Sorting IP's - Help! <david.pitts@boeing.com>
Re: subject and sender using open mail <rootbeer@teleport.com>
Taint checking <richc@ti.com>
Re: Taint checking (Chris Nandor)
Tied hash questions <David.Hinz@mci.com>
Re: WIN32: ????? <nospam_billteam@creaweb.fr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 18 Jun 1998 21:47:37 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: 2 questions about lists
Message-Id: <3589ED69.525A@comenius.ms.mff.cuni.cz>
M.J.T. Guy wrote:
>
> Alex Farber <alex@kawo2.rwth-aachen.de> wrote:
> >
> >2) what happens if i do a foreach()-loop on some @list
> >and the push smth in that list IN THIS LOOP ? Like:
> >
> >foreach $elem (@list)
> >{
> > push @list, 'xxx' if ...
> >}
>
> "perldoc perlsyn" says about this
>
> If any part of LIST is an array, foreach will get very
> confused if you add or remove elements within the loop body,
> for example with splice. So don't do that.
>
> So ignore the advice from other respondents to "try it and see".
> Even if it "happens to work", it's not guaranteed to continue to do
> the same thing in the future.
>
> Mike Guy
Well I don't think the behaviour is likely to change any time soon, but
I agree that you shouldn't depend on it in important scripts.
It has a few "interesting" uses. For example when you are generating a
recursive list
by a function that doesn't always create only one more item of the list,
but sometimes
creates two at once. Not very likely, but we have been playing with such
lists in
Combinatorial theory. Try to implement this in a more conservative way.
(I don't say it's imposible, it just will not look so "nice". :-)
#!/usr/bin/perl
sub gen {
my $length = $_[0]-3;
local @list = (2);
$now=1;
foreach $item (@list) {
foreach (1..$item) {push @list, $now;}
# add the token to the list $item times
$now = ($now == 2 ? 1 : 2);
# if the token was 2 change it to 1, if it was 1 change it to 2
last if ($#list >= $length);
# we want only the first few items
}
unshift @list, 1, 2;
return @list
}
print '( ',join(', ',gen(25)),")\n";
__END__
Cheers, Jenda :-)))
BTW(off-topic): The original implementation was in Concurrent Clean and
looked like this:
list = [ 1, 2, 2 : @rest] // the list is INFINITE !
where
@rest = gen [2 : @rest]
inv 1 = 2
inv 2 = 1
gen x [1 : tail] = [x : gen (inv x) tail]
gen x [2 : tail] = [x,x : gen (inv x) tail]
------------------------------
Date: Thu, 18 Jun 1998 22:10:45 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: ?CGI scripts & Explorer
Message-Id: <3589F2D5.1367@comenius.ms.mff.cuni.cz>
Larry Rosler wrote:
>
> In article <3588FDC1.83B11E68@inlink.com>, Brent Michalski
> <perlguy@inlink.com> says...
> > This reminds me of the joke where the guy goes into the doctors and
> > says:
> >
> > "Doctor, it hurts when I raise my arm."
> >
> > so the doctor says:
> >
> > "Don't raise your arm."
> >
> > HAHAHA ROTFL HAHAHA
> >
> > I had a similar problem with a script, once I quit using Internet
> > Exploder, it worked fine... (There was nothing wrong with the script
> > BTW.)
>
> Pardon me for offending by sexual analogies, but these and the other
> similar responses are masturbatory: "*I* had a similar problem" "*I*
> quit using Internet Explorer". In real life, as in real sex, it takes
> two (or more) to tango.
>
> *I* get paid for writing programs that other people access over the web
> using whatever client they damn please. My job is to generate output
> that all HTTP/HTML standards-conforming clients will accept.
Which promptly disqualifies M$IE of any version.
Try this script:
print "Content-type: text/plain\n\n";
print "<HTML><HEAD><TITLE>Hello world</TITLE></HEAD>\n";
print "<BODY><H1>Hello world</H1>M$IE</BODY></HTML>\n\n";
Now what do you see? The HTML coding (which is correct, see the
Content-type)
or a page titled "Hello world"?
M$'s conformance to standards is plainly horrible.
> (In the
> recent past, this job has included notifying Netscape of a standards
> violation in one of their betas, which fortunately they fixed before
> product release.)
Which plainly shows how does each of those companies behave. M$ didn't
fix it yet.
> I challenge your statement above: (There was nothing wrong with the
> script BTW.) And "HAHAHA ROTFL HAHAHA" is just plain wrong. It isn't
> funny at all.
I agree it's not funny. It makes me scream, shout and want to kill
someone.
(Ever tried to write a JavaScript that wokrs in NN as well
as all the 3.x versions of M$IE?)
> --
> Larry Rosler
Jenda
(Sorry guys that this went completely off-topic.)
------------------------------
Date: Thu, 18 Jun 1998 20:11:04 GMT
From: peacemakers@my-dejanews.com
Subject: add a record into file DBF with perl
Message-Id: <6mbs8o$gd0$1@nnrp1.dejanews.com>
How to add a record into file DBF with Perl.
To read I'm acctualy using module Xbase.pm
and I dont know how to write...
Joshua
joshua@ph.edu
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Thu, 18 Jun 1998 19:15:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: broken upload program
Message-Id: <Pine.GSO.3.96.980618121339.13348c-100000@user2.teleport.com>
On Thu, 18 Jun 1998 chapman50@hotmail.com wrote:
> The problem is that no matter what I try it uploads 0 bytes. The
> essential lines that do get the file's data are...
>
> while ($bytesread = read($filename,$buffer,1024)) {
> $totalbytes += $bytesread;
> print OUTFILE $buffer;
> }
Maybe there was an error; you may be calling read properly. But you could
check $bytesread after the loop:
die "Read error: $!" unless defined $bytesread;
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 20:56:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Checking for timeouts when using IO:Socket::INET
Message-Id: <Pine.GSO.3.96.980618135545.13348l-100000@user2.teleport.com>
On 18 Jun 1998, Phoenixl wrote:
> Subject: Checking for timeouts when using IO:Socket::INET
>
> I've got this example working with no problem, but I'm not sure what
> code need to add to see if there was a timeout while reading. Can
> someone give me a suggestion?
Section eight of the FAQ talks about timing out slow events. Hope this
helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 19:55:15 GMT
From: davel@spc.uchicago.edu (Dave Lorand)
Subject: Re: Email address checker - comments welcome
Message-Id: <davel-1806981455150001@honeybee.spc.uchicago.edu>
In article <357580F5.45B10245@etsetb.upc.es>, Francesc Guasch
<frankie@etsetb.upc.es> wrote:
> Ronald J Kimball wrote:
> >
> > Larry Rosler <lr@hpl.hp.com> wrote:
> >
> > > /^ [^\s@?]+ @ (?: \w[^\s.]* \. )+ \w\w+ $/x
> >
> > DB<1> $re = '^ [^\s@?]+ @ (?: \w[^\s.]* \. )+ \w\w+ $'
> >
> > DB<2> p 'invalid@address@foo.bar' =~ /$re/x
> > 1
> > DB<3> p 'also@invalid.__' =~ /$re/x
> > 1
> >
>
>
> I was looking for one that searches a valid mail address in a text,
> How could I do the inverse of the search above ?
Take a look at the Hip Owls book, aka "Mastering Regular Expressions" from
O'Reilly. Jeffrey develops a robust and fast regular expression for
matching email addresses. If you put parentheses around it, you can
capture the address it matches. The thing is, this regex takes pages of
code to type. The best thing to do is download it from one of his sites:
http://www.wg.omron.co.jp/cgi-bin/j-e/jfriedl.html
http://www.itc.omron.com/cgi-bin/j-e/jfriedl.html
http://enterprise.ic.gc.ca/cgi-bin/j-e/jfriedl.html
http://www.gsquare.or.jp/cgi-bin/j-e/jfriedl.html
Good luck!
Dave
------------------------------
Date: Thu, 18 Jun 1998 15:06:20 -0500
From: "Vincent M. Probasco" <probavm@h8mail.laf.cat.com>
Subject: Faster Search
Message-Id: <3589733C.EBF832EF@h8mail.laf.cat.com>
Okay,
I've written a search in perl to go through
html docs in a directory. The problem is there are over 3000 files
to search through. The only way I know how to do this is open every
file and then look at every line in those files. Is there any way
that this might be done faster in Perl ? I've already done things
like stop searching a file after what is being looked for is found,
and only searching through a certain number of these files, but
usaually we want to search through all the files and it takes a
significant amount of time.
Thanks,
Vince
------------------------------
Date: Thu, 18 Jun 1998 16:57:04 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Faster Search
Message-Id: <linberg-1806981657040001@projdirc.literacy.upenn.edu>
In article <3589733C.EBF832EF@h8mail.laf.cat.com>, "Vincent M. Probasco"
<probavm@h8mail.laf.cat.com> wrote:
> Okay,
>
> I've written a search in perl to go through
>
> html docs in a directory. The problem is there are over 3000 files
>
> to search through. The only way I know how to do this is open every
>
> file and then look at every line in those files. Is there any way
>
> that this might be done faster in Perl ? I've already done things
>
> like stop searching a file after what is being looked for is found,
>
> and only searching through a certain number of these files, but
>
> usaually we want to search through all the files and it takes a
>
> significant amount of time.
>
> Thanks,
>
> Vince
Build an index.
This is not really a Perl question, btw.
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Thu, 18 Jun 98 20:37:53 GMT
From: matkoski@ELIMINATE.THIS.appliedtheory.com (steve)
Subject: Help combining two files.
Message-Id: <6mbtr2$kvr$1@news.appliedtheory.com>
Hi,
I am working on a Usenet utility and have run into a problem. I have two files
that contain complete and/or partial newsgroups names that I use to set
restrictions for users. The format of the files are as follows:
alt.*,!alt.comp.*,alt.comp.unix.*,!alt.comp.unix.bsd
which says a user can read anything in the alt hierarchy except alt.comp, but
can read anything in alt.comp.unix except alt.comp.unix.bsd.
The problem is I need to combine these files into one and need to ensure the
ordering of these is done correctly. So if one file contains alt.* and the
other contains !alt.comp.* the order appears correctly. The program wont
function correctly if these are out of order.
Could someone please help me get started with this, I just can't find a good
starting point. Any help is greatly appreciated.
-steve.
------------------------------
Date: Thu, 18 Jun 1998 20:27:37 GMT
From: davendontlikespam@ldr.com (Dave Neuer)
Subject: Help! Database file modification
Message-Id: <davendontlikespam-1806981327140001@208.8.190.31>
I have a tab-delimited database file which contains several lines, each of
which looks like this:
mailing_list_id# list_name employee_id#1 employee_id#2, employee_id#3 <etc>
I need to come up with a script that, given an array of valid employee
id#'s, goes through each line of the file and deletes any invalid id#'s.
Anyone have any idea how to do this (without a million lines of code)?
Thanks,
Dave Neuer
------------------------------
Date: Thu, 18 Jun 1998 20:44:52 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Help! Database file modification
Message-Id: <ebohlmanEurLMs.KE6@netcom.com>
Dave Neuer <davendontlikespam@ldr.com> wrote:
: I have a tab-delimited database file which contains several lines, each of
: which looks like this:
: mailing_list_id# list_name employee_id#1 employee_id#2, employee_id#3 <etc>
: I need to come up with a script that, given an array of valid employee
^^^^^
: id#'s, goes through each line of the file and deletes any invalid id#'s.
Try thinking "hash" instead of "array" here and some simple solutions
will probably come to mind.
------------------------------
Date: Thu, 18 Jun 1998 20:07:44 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: hmmm, suggestions?
Message-Id: <ebohlmanEurJww.1L2@netcom.com>
Scratchie <upsetter@ziplink.net> wrote:
: The best way to learn perl, from my experience, is to have some boring,
: repetitive, text-based task to accomplish. Nothing inspired me to learn
: perl more than updating my calendar by hand for a couple of weeks.
I'd second that, with one proviso: the task shouldn't be one that *needs*
to be done *yesterday*. That kind of pressure puts one into the "what do
I type to make this happen" mentality that we all too often see on this
group. The ideal "learning task" is one that will have tangible benefits
sufficient to make you want to be able to accomplish it, but that's
sufficiently non-urgent that you have plenty of time to read, explore and
play in the process.
------------------------------
Date: Thu, 18 Jun 1998 20:55:01 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Making Life Easy - Templates, XSSI, Variables and such
Message-Id: <Pine.GSO.3.96.980618135027.13348k-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Geoff Hudik wrote:
> Is there a way to use some sort of "global" variable so I can change the
> color variable once and it will change every color attribute on my site?
It sounds as if you want your server to do something to every web page for
you. Perhaps you should check the docs, FAQs, and newsgroups about your
server. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 19:20:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: MODE in mkdir
Message-Id: <Pine.GSO.3.96.980618121941.13348e-100000@user2.teleport.com>
On Thu, 18 Jun 1998 marius77@my-dejanews.com wrote:
> Subject: MODE in mkdir
Why did you post this twice, and with two different subject lines? If
you're having trouble posting, or if you're not sure that your messages
are being posted, you should check with your news admin before posting
again to a non-test newsgroup.
> I currently have a umask of 002.
Have you tried changing your umask? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 18 Jun 1998 20:29:37 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Module Problems: IO object version 1.19 does not match $IO:: 1.15
Message-Id: <6mbtbh$sg4@mozo.cc.purdue.edu>
William Goerlich <intern.bill.goerlich@bentley.com> writes:
}the error:
}staging.bentley.com% /usr/local/bin/perl -c middleman.cgi
}IO object version 1.19 does not match $IO:: 1.15 at
}/usr/local/lib/perl5/sun4-solaris/5.00403/DynaLoader.pm line 172.
}BEGIN failed--compilation aborted at
}/usr/local/lib/perl5/sun4-solaris/5.00403/IO/Socket.pm line 112.
}BEGIN failed--compilation aborted at
}/usr/local/lib/perl5/site_perl/Net/FTP.pm line 18.
}BEGIN failed--compilation aborted at middleman.cgi line 24.
}middleman.cgi line 24:
}use Net::FTP;
}what exactly is crapping out on me? and what do I need to
}update/replace/fix?
Reinstall the IO module _by hand_. Do not use the CPAN module to help
you automatically install IO. (Which I'll bet is something you did
recently.)
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Thu, 18 Jun 1998 15:56:54 -0400
From: "Kenneth" <kenkim@gncom.com>
Subject: Modules
Message-Id: <6mbrkt$sc4$1@demon.uunet.ca>
How do I get a module (ie Net::Telnet) and put it into my program??
Gorkem Yuksel
GlobeNet Communications
WEB: http://www.gncom.com
EMAIL: gorkem@gncom.com
------------------------------
Date: Thu, 18 Jun 1998 16:56:13 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Modules
Message-Id: <linberg-1806981656130001@projdirc.literacy.upenn.edu>
In article <6mbrkt$sc4$1@demon.uunet.ca>, "Kenneth" <kenkim@gncom.com> wrote:
> How do I get a module (ie Net::Telnet) and put it into my program??
You read the FAQ?
Or perhaps go to http://www.perl.com and see what you can find?
Or you hire a programmer?
_____________________________________________________________________
Steve Linberg National Center on Adult Literacy
Systems Programmer &c. University of Pennsylvania
linberg@literacy.upenn.edu http://www.literacyonline.org
------------------------------
Date: Thu, 18 Jun 1998 20:22:14 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Moving application from DOS to a GUI.
Message-Id: <ebohlmanEurKL2.2HE@netcom.com>
David Sheets <dsheets@glue.umd.edu> wrote:
: I am working on moving an application from a DOS/UNIX version, to a
: version that uses a GUI and will run on Windows 95 and X Windows with
: (hopefully) only small modifications to the code. I have been looking at
: Tcl/Tk as a possible option, but it seems like there might be problems
: with using that. I know nothing about either Perl or Python but after
: reading through the FAQ's think I might be able to use them.
: The original program is written entirely in C, and we are hoping to
: find a language that will allow us to both use our math routines as they
: are now (ie, our current C code should interface with the language) and
: write the GUI in a method that will be easily portable to Win95 and
: X Windows.
Not being familiar with Python, I'll limit my comments to Perl. Perl with
Tk and some C extensions sounds to me like a good candidate for the job.
You'll probably want to beg, borrow, steal or even (gasp!) buy a copy of
Sriram Srinivasan's _Advanced Perl Programming_ which very readably covers
both the Tk toolkit for creating GUIs and the various means of embedding C
code within a Perl program.
Note that Python also has a Tk interface, so the availability of Tk won't
be a factor in your choice. MHO is that conversion to Perl/Tk would be
easiest, Python/Tk intermediate, and Tcl/Tk the hardest. But that's just
MHO.
------------------------------
Date: 18 Jun 1998 20:24:36 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Need help with substr()
Message-Id: <6mbt24$8pe$1@supernews.com>
: # col1.pl
: $ln=0;
: while (<>){
: chop;
: if(substr($_,7,1) eq '|'){
: print substr($_,11,8), "\n";
: $ln++;
: }
: }
: print "Number of lines=$ln\n";
: Use of uninitialized value at col1.pl line 6, <> chunk 111.
Change that "$ln = 0" to "my $ln;" You can set it to 0 explicitly if you
like, but it's not necessary.
You'll want to see the split() function for much easier way to do this.
Andy
--
--
Andy Lester: <andy@petdance.com> http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com> http://ChicagoMusic.com/
------------------------------
Date: Thu, 18 Jun 1998 20:49:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Net::Ftp module
Message-Id: <Pine.GSO.3.96.980618134901.13348j-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Wirehead wrote:
> Subject: Net::Ftp module
> Are there any examples or info around concerning this module?
Do you mean, in addition to the ones in the documentation? :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 18 Jun 1998 20:54:16 GMT
From: aks@cs.brown.edu (Amanda Silver)
Subject: parsing
Message-Id: <6mbupo$jbo@cocoa.brown.edu>
i've been trying to write a script that takes a directory and then takes every
file in that directory and parses it looking for the word 'foo' and changes the
word to 'bar' but i can't figure out how parsing is done...do i use the grep
command somehow...? can someone please help? (beginner at perl...)
--
~ a m a n d a s i l v e r ~
~ b r o w n u n i v e r s i t y ~
~ a k s @ c s . b r o w n . e d u ~
------------------------------
Date: Thu, 18 Jun 1998 20:31:29 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Perl with ASP?
Message-Id: <6mbtf2$i0f$1@nnrp1.dejanews.com>
In article <6mbc4c$jgl@www001.itanet.com.br>,
"BBQ" <warp@internetcom.com.br> wrote:
>
>
> Tom Phoenix wrote in message ...
> >On Tue, 16 Jun 1998, BBQ wrote:
> >
> >> Does anyone know if it is possible to use Perl as the default scripting
> >> language within Active Server Pages (instead of VBScript or JavaScript)?
> >
> >The docs, FAQs, and newsgroups about Active Server Pages (and related
> >topics) may be of some assistance. Hope this helps!
> >
>
> Thanks Tom, but that isn't that exactly what I'm doing? (except that this is
> the perl newsgroup and not the ASP one)
>
> :o)
>
>
The point is, your question has nothing to do with Perl. So I guess yes, you
are doing exactly what Tom suggested, except that you're completely clueless,
in so far as you think that asking any of the thousands of newsgroups about
your problem is as good as asking the one or two newsgroups you should be
asking. So yes, you're as close as you can come to getting it exactly right
while still finding a way to be completely wrong.
You're having a computer problem, so why not cross-post to all the comp.*.*
newsgroups? You're frustrated by your computer problem, so why not cross post
to alt.frustrated.* groups?
Patrick Timmins
U. Nebraska Medical Center
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 18 Jun 1998 20:25:07 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Pod::Text -- Unix only?
Message-Id: <6mbt33$krp$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
pehanna@my-dejanews.com writes:
:Many Perl scripts need to operate in both Unix and Windows NT environments --
There you go with that *both* thing. "This runs on `both' browsers,"
you'll hear people say. Ptui.
I am a carpenter. I use tools. Perl is a glue factory, a tool shop.
You'll take away my tools when you prise them from my cold, dead hands.
--tom
--
Even if you aren't in doubt, consider the mental welfare of the person who
has to maintain the code after you, and who will probably put parens in
the wrong place. --Larry Wall in the perl man page
------------------------------
Date: Thu, 18 Jun 1998 20:10:54 GMT
From: David Pitts <david.pitts@boeing.com>
Subject: Sorting IP's - Help!
Message-Id: <3589744E.794B@boeing.com>
Hi,
I have a flat file database that has entries that look something like
this: (actually, it is colon delimited not space...)
esg33 144.113.158.26 700534 40-81.2 P2
esg34 144.113.138.20 700535 40-81.2 P2
esg35 144.113.158.32 700536 40-81.2 P2
esg36 144.113.83.50 700537 40-85.1 D1
esg37 172.18.36.134 698845 40-87.4 D13
esg38 144.113.83.64 700538 40-85.1 C1
esg39 144.113.83.78 700539 40-85.1 D2
What I am trying to do is sort this list by ip (there are thousands of
entries). Here is what I have tried:
foreach $noder (@new_nodes_list) {
($node,$erms,$ip,$building,$slave,$colbay)=split(/:/,$noder);
($ip1,$ip2,$ip3,$ip4)=split(/\./,$ip);
$ip1{$node." ".$erms." ".$ip1.".".$ip2.".".$ip3.".".$ip4."
".$building." ".$slave." ".$colbay} = $ip1;
$ip2{$node." ".$erms." ".$ip1.".".$ip2.".".$ip3.".".$ip4."
".$building." ".$slave." ".$colbay} = $ip2;
$ip3{$node." ".$erms." ".$ip1.".".$ip2.".".$ip3.".".$ip4."
".$building." ".$slave." ".$colbay} = $ip3;
$ip4{$node." ".$erms." ".$ip1.".".$ip2.".".$ip3.".".$ip4."
".$building." ".$slave." ".$colbay} = $ip4;
} # end foreach $noder (@new_nodes_list)
@keys = sort { $ip1{$a} <=> $ip1{$b} } keys %ip1 or
sort { $ip2{$a} <=> $ip2{$b} } keys %ip2 or
sort { $ip3{$a} <=> $ip3{$b} } keys %ip3 or
sort { $ip4{$a} <=> $ip4{$b} } keys %ip4;
So, does anyone have a sorter that will work or see why this does not?
thanks!!
David
--
David Pitts
Computer Consultant for BEST Consulting, Seattle, Washington
Systems Administrator, Programmer, Web Administrator, Author
www.bestnet.com www.mk.net/~dpitts
------------------------------
Date: Thu, 18 Jun 1998 20:47:08 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: subject and sender using open mail
Message-Id: <Pine.GSO.3.96.980618134556.13348h-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Michael S. Brito, Jr. wrote:
> open (MAIL, "|$mailprog $recipient") || die "Cant open $mailprog!\n";
You should be aware that it's generally a Bad Thing to include a
user-specified email address on the command line to sendmail, since an
email address may contain shell metacharacters and yet still be valid.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Jun 1998 14:50:28 -0500
From: Richard Campbell <richc@ti.com>
Subject: Taint checking
Message-Id: <35896F84.38110A59@ti.com>
Hello,
I am writing a setuid program using Perl and have run into some
problems with taint checking. Is there anyway to disable the taint
checking in a Perl program? Or do I have to find and correct each and
every problem that taint checking finds?
I have corrected one problem already but now am hampered by
another. I do have multiple system calls within the program so
correcting them all may take some time.
Here's an example of the (currently ) complaining line:
system ("ecacontb add \"\@$cond\" $cond_date > $tmp/eca.$job.$id.out");
$cond, $cond_date, $job & $id are passed into this setuid program from
another program.
Barring turning off taint checking, how would I modify the above
command to work correctly?
The "Programming Perl" book has some info on this but I need some
clarification as I'm fairly new to Perl.
Thanks in advance for any information.
--
Regards,
Richard Campbell
System Software Analyst
richc@ti.com
Texas Instruments
------------------------------
Date: Thu, 18 Jun 1998 20:13:46 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Taint checking
Message-Id: <pudge-1806981611000001@dynamic162.ply.adelphia.net>
In article <35896F84.38110A59@ti.com>, richc@ti.com wrote:
# I am writing a setuid program using Perl and have run into some
# problems with taint checking. Is there anyway to disable the taint
# checking in a Perl program? Or do I have to find and correct each and
# every problem that taint checking finds?
You are the one who turns taint checking ON in the first place, with the
-T switch. So yes, you can turn off taint checks by removing the -T
switch, but that is not advisable for some applications.
# $cond, $cond_date, $job & $id are passed into this setuid program from
# another program.
Ah, setuid has taint checks turned on automatically. This is in the
perlsec manpage.
# Barring turning off taint checking, how would I modify the above
# command to work correctly?
You would have to untaint those variables, which can only (in theory) be
done with a regex. This is also in the perlsec man page.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Thu, 18 Jun 1998 20:43:34 GMT
From: David Hinz <David.Hinz@mci.com>
Subject: Tied hash questions
Message-Id: <35897BEB.F8BD2C9F@mci.com>
How do I use a tied hash to find the first specfied key value and all of
the subsequent key values matching a specific key value?
I stored the values in the NDBM_File tied hash file and have now opened
the file and can dump the data in the tied hash variable using:
while (($key,$value) = each %stuff)
{
print $key ," => ", $value, "\n";
}
Is there an easy way to get specfic "rows" of data with out having to
traverse the entire hash and compare the key against a specified value?
I understand how to put data in the hash with corresponds to the STORE
$self, $key, $value using $stuff{$key} = $value. But what is the syntax
for the other methods?
DELETE $self
FETCH $self, $key
DELETE $self, $key
EXISTS $self, $key
FIRSTKEY $self
NEXTKEY $self, $lastkey
------------------------------
Date: Thu, 18 Jun 1998 19:02:48 +0200
From: "F Chauvreau" <nospam_billteam@creaweb.fr>
Subject: Re: WIN32: ?????
Message-Id: <6mbv8e$b0e$1@news.inetway.net>
thanks
I'll look at.
JC
Brent Michalski a icrit dans le message <3588F6CB.13490EF3@inlink.com>...
>Try Going to:
>
>http://reference.perl.com/query.cgi?windows
>
>and click on the top link that says "A Guide to Win32::Packages". This
>will probably help...
>
>Sorry all for the other post on this subject, I hit the wrong key
>combination!
>
>HTH,
>
>Brent
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2903
**************************************