[13002] in Perl-Users-Digest
Perl-Users Digest, Issue: 412 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 7 03:07:27 1999
Date: Sat, 7 Aug 1999 00:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 7 Aug 1999 Volume: 9 Number: 412
Today's topics:
Re: a time to kill <llornkcor@llornkcor.com>
Re: a time to kill (Abigail)
Re: Changed specific text in fetched page. <rootbeer@redcat.com>
Re: CRAP-7 ATTN: Article 002 - HTTP Cookie Library (Abigail)
End clients/Outsource/Service Partners in Information T gevsat@my-deja.com
Re: exists problem (Abigail)
Re: file size (Larry Rosler)
Re: file size (William Herrera)
Re: file size <jbc@shell2.la.best.com>
Re: Functions in <<HERE documents (Abigail)
Re: I guess this is a Misc question: Cgi-bin (Abigail)
Re: I guess this is a Misc question: Cgi-bin (Abigail)
Re: Is there a module for SMB similar to Net::FTP? <erict@cc.wwu.edu>
Re: Making small changes to big files. (Abigail)
Re: Nastiness contrary to the spirit of perl? <llornkcor@llornkcor.com>
Re: net:FTP install <erict@cc.wwu.edu>
Re: New to Perl - Question About RegExpr (Abigail)
Re: New to Perl - Question About RegExpr (Ilya Zakharevich)
non-interactive telnet session (Brian StJohn)
Re: non-interactive telnet session (Brian StJohn)
Re: non-interactive telnet session (Brian StJohn)
Passing parameters (am I mad) <derek@realware.com.au>
Re: Passing parameters (am I mad) <derek@realware.com.au>
Re: Problems Quoting # in qw,... (Abigail)
Re: Renaming a hash key ? (Larry Rosler)
Re: Renaming a hash key ? (Abigail)
Re: reverse of localtime? (Abigail)
Re: SSH2, Need a little help (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 06 Aug 1999 23:20:36 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: a time to kill
Message-Id: <aes4np3v.fsf@wind.localdomain>
hehe, so does this make us famous?... or infamous???
--
- "Peace cannot be kept by force. It can only be achieved by
understanding."
- "Whoever undertakes to set himself up as judge in the
field of truth and knowledge is shipwrecked by the
laughter of the Gods." -A. Einstein
------------------------------
Date: 7 Aug 1999 01:03:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: a time to kill
Message-Id: <slrn7qnj19.7j.abigail@alexandra.delanet.com>
Jerome O'Neil (jeromeo@atrieva.com) wrote on MMCLXVII September MCMXCIII
in <URL:news:7og387$t46$1@brokaw.wa.com>:
^^
^^ Tom C has determined that his killfile gets almost %60 of posts
^^ to c.l.p.m. I'm curious about the numbers are for yours, too.
Far, far less. I don't kill much on subject; I used to, but I found that
missed too many interesting posts. Even if 95% of the posts with certain
keywords are crap, I still don't want to miss the 5%. It's easier to
skip posts, than get killed ones back.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 6 Aug 1999 22:42:39 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Changed specific text in fetched page.
Message-Id: <Pine.GSO.4.10.9908062242000.9452-100000@user2.teleport.com>
On Fri, 6 Aug 1999, InLandPAC Publishing Services wrote:
> I currently fetch a page to display a "clone" through a popup window.
>
> What I would like to do is change the color of and bold every time
> $keyword appears in the page. (not in the tags, but between them -
> i.e., the text that the viewer sees via the browser).
Sounds as if you wish to parse and rewrite the HTML. Use HTML::Parser,
which should make this fairly easy. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 7 Aug 1999 00:19:40 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: CRAP-7 ATTN: Article 002 - HTTP Cookie Library
Message-Id: <slrn7qngep.7j.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCLXVII September MCMXCIII in
<URL:news:MPG.1215255d85b7eb6989df6@nntp.hpl.hp.com>:
:: In article <7oform$1c$1@info2.uah.edu> on 6 Aug 1999 22:50:30 GMT, Greg
:: Bacon <gbacon@itsc.uah.edu> says...
::
:: The *purpose* of the www.pobox.com server is to redirect from a
:: permanent' URL to whgerever the subscriber wishes.
Which isn't very friendly to either the net, or the reader.
:: > Trailing slashes aren't optional when a URL addresses a directory.
::
:: Huh? I can't find anything about that in the RFC, and I know it isn't
:: required. It may be desirable for efficiency, to avoid a redirection.
The point Greg is making is that <URL:http://www.pobox.com/~japhy/perl/crap>
is a *different* URL from <URL:http://www.pobox.com/~japhy/perl/crap/>
In fact, <URL:http://www.pobox.com/~japhy/perl/crap> is a URL that doesn't
point to a document - that's why the server says "well, this document doesn't
exists, try asking for this instead". The reason the server says "ask again,
but this time better" instead of serving the document the redirected URL
points to is such that the browser can resolve relative URLs.
It's behind the scenes. Of course. That doesn't make it good practise.
It's like Perl keeping its mouth and guessing what the user wants if run
without -w. The program will run, but not many people here will think
running without -w is a good idea.
Omitting a trailing / where the server would give a redirect shows a major
lack of understanding in my book. It gives me the same creeps as people
who asks faqs.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 07 Aug 1999 06:50:08 GMT
From: gevsat@my-deja.com
Subject: End clients/Outsource/Service Partners in Information Technology
Message-Id: <7ogkuu$h35$1@nnrp1.deja.com>
Cyber Managers Software Services Pvt. Ltd., India,
specializes in Internet and Software development
and Internet based services at rates that are well
below the international rates but realize that the
quality of our services has to be of world class
standards.
Our strengths lie in websites, web promotions,
e-commerce solutions, intranets, extranets, etc.
We are currently looking at expanding our business
overseas and seeking:-
a)End clients who may require our services (either
on-site or offshore) mentioned below.
b)Large Internet and Software Development Houses
who wish to outsource some of their current jobs.
c)Service partners, who can market our services in
various parts of the world and perform certain
elementary tasks like data procurement etc. for a
per project percentage fee in return.
Our client-list varies from medium to large scale
organisations to whom we have provided Internet
and IT based solutions including websites,
inter-office web based connectivity, intranets,
extranets and internet based marketing and
promotional solutions. These clients already
include an international company based in
Singapore in additon to the ones in India, and we
are currently negotiating for an order with a
diamond company in Belgium and another in Canada.
Inhouse Skill-sets:
As far as our IT based capabilities go, our
specialities are organizing,planning, developing,
promoting and programming for internet based
services. Our workforce includes creative minds
from the field of marketing and designing,
programming wizards who can make computers
perform the most complex tasks by a slight wave of
their wand and systems analysts and designers who
take the concepts of organisation and planning so
seriously that the terms redundancy and
duplication of work fail to exist!!
We are proficient in Internet and conventional
programming using Delphi,Java, JavaScript, HTML,
DHTML, Shockwave, ASP, ActiveX, VBScript, Visual
Basic, C/C++, Visual C++ and Perl based on
platforms like Windows NT and various flavours of
UNIX, with a variety of backends ranging from mSQL
and MSAccess, to Oracle, Paradox, Interbase,
MSSQL, etc. Our designers too are extremely
conversant with state of the art technologies for
2-D and 3-D imaging and animation.
Our programming capabilities are of course, not
limited to the Net only and we do have a good deal
of experience in doing systems and application
level projects using various languages and
development tools on platforms like Win 98, Win
95, Win NT, and various flavors of Unix.
Costs:
Our Rates vary between $20 US an hour to $45 US an
hour for programming. These, we can say with
conviction, are the best rates for the best brains
of the computer industry. As far as web
developments go, send us your requirements and
we'll give a quote within 24 hrs which we are sure
will please you.
To know more about our organization or to contact
us, do email us at gev@cybermanagers.com
Gev Satarawalla
www.cybermanagers.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 7 Aug 1999 02:02:16 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: exists problem
Message-Id: <slrn7qnmfc.7j.abigail@alexandra.delanet.com>
gene@tekdata.com (gene@tekdata.com) wrote on MMCLXVI September MCMXCIII
in <URL:news:37AB4F5D.BB5FE140@tekdata.com>:
%% I have the following statement in a script
%%
%% if ( exists $in { 'Econf'} ) {
%% print $HANDLE 'Econf $in{'Econf'}\r';
^ ^
| |
+-----------+ This doesn't compile, does it?
%% &wait'ok }
Are you sure you want to call the function "ok" in the package "wait"?
%% $in contains a list of arguments from a web server. This works on my
%% test system. But on some field system it halts the script. The system
%% it fails on is running perl 5.002
I'm very surprised it "works" on your test system. It doesn't compile
on my system.
%% I want to execute the print statement iff the Econf variable existed
%% on the page coming back from a web server. I was under the
%% impression that the exists statement will search the $in array and
%% return false if the Econf member wasn't there.
$in isn't an array. $in is a *scalar*. And exists doesn't work on arrays
(or array elements). It takes a *hash* element as argument. (Which you
have in your code.)
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 6 Aug 1999 22:34:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: file size
Message-Id: <MPG.1215654e2ab431f2989dfa@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7og3mp$65n$1@nnrp1.deja.com> on Sat, 07 Aug 1999 01:55:40
GMT, makky@my-deja.com <makky@my-deja.com> says...
> hi, does someone know if there is a best way to find the file size in
> perl? thanks.
perldoc -f stat
perldoc -f -X
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 7 Aug 1999 06:24:56 GMT
From: posting.account@lookout.com (William Herrera)
Subject: Re: file size
Message-Id: <dM33c2i67iQd-pn2-L47LtWmKETs2@cheetah>
> hi, does someone know if there is a best way to find the file size in
> perl? thanks.
Look up -s in perlfunc
---
Note: The above address is spamblocked.
The real reply-to is: wherrera (at) lookout.com
------------------------------
Date: 07 Aug 1999 06:43:51 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: file size
Message-Id: <37abd5a7$0$220@nntp1.ba.best.com>
Larry Rosler <lr@hpl.hp.com> wrote:
> perldoc -f -X
[jbc@xena jbc]$ perldoc -f -X
No documentation for perl function `-X' found
[jbc@xena jbc]$ perldoc -f '-X'
No documentation for perl function `-X' found
[jbc@xena jbc]$ perl -v
This is perl, version 5.004_04 built for alpha-linux
(with 1 registered patch, see perl -V for more detail)
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: 7 Aug 1999 01:05:47 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Functions in <<HERE documents
Message-Id: <slrn7qnj5e.7j.abigail@alexandra.delanet.com>
Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXVII September
MCMXCIII in <URL:news:37ab8a9f@cs.colorado.edu>:
;; [courtesy cc of this posting mailed to cited author]
;;
;; In comp.lang.perl.misc,
;; abigail@delanet.com writes:
;; :'' print <<EOF,print_opts(12),<<EOF,print_opts(31),<<EOF;
;; :What will be printed will be out of order in the program text.
;; :While sometimes acceptable, I do find it questionable.
;;
;; I was imagining that the print_opts() function *returned* the string,
;; not printed the thing itself.
So did I, otherwise it would have been plain wrong.
I would have the same objections if it would read:
print <<EOF,$print_opts12,<<EOF,$print_opts31,<<EOF;
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Aug 1999 00:45:23 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: I guess this is a Misc question: Cgi-bin
Message-Id: <slrn7qnhv6.7j.abigail@alexandra.delanet.com>
Bart Lateur (bart.lateur@skynet.be) wrote on MMCLXVI September MCMXCIII
in <URL:news:37ac2d42.6502241@news.skynet.be>:
<> Ben Quick (AGGTA B.O.D) wrote:
<>
<> >Could anyone remind me of what my cgi-bin should be chmoded to. I have had
<> >to create my own, therefore I have to chmod it. 755 seems to be the norm,
<> >but is it different for the bin?
<>
<> I'd say: R and X for everybody, plus W for owner, if you still want to
<> be able to upgrade your scripts.
Assuming the web server is a different group than the owner of cgi-bin,
a permission of 001 should be more than enough.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Aug 1999 00:46:35 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: I guess this is a Misc question: Cgi-bin
Message-Id: <slrn7qni1f.7j.abigail@alexandra.delanet.com>
Ben Quick (newsgroup@bigwig.net) wrote on MMCLXVI September MCMXCIII in
<URL:news:37ab6d5f.0@news2.cluster1.telinco.net>:
!! Bloody hell. Calm down everyboody. I want to put perl scripts in a cgi-bin.
!! I want to know what the cgi-bin should be set to. A simple answer was
!! required (eg 3 numbers), not flames. I'm off, you lot are far too serious.
!!
!! Lighten up
*ploink*
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 06 Aug 1999 23:04:21 -0700
From: Eric Turner <erict@cc.wwu.edu>
Subject: Re: Is there a module for SMB similar to Net::FTP?
Message-Id: <37ABCC65.46601B30@cc.wwu.edu>
Kim Saunders wrote:
>
> You should just be able to use smbmount and mount it on your normal FS, and
> then read & write as you normally would???
Thanks... I thought I had read all of the SMB related man pages and
howto's when I installed Samba, but I obviously missed this one. I was
actually contemplating developing my own SMB perl module (I'm not sure
if I could actually pull it off or not). You just saved me a ton of
time. I just LOVE Usenet!
Thanks again,
Eric
------------------------------
Date: 7 Aug 1999 00:55:15 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Making small changes to big files.
Message-Id: <slrn7qnihn.7j.abigail@alexandra.delanet.com>
David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXVI September
MCMXCIII in <URL:news:37AB22E6.A36D8AD3@mail.cor.epa.gov>:
//
// There isn't a convenient solution, unless you set things up to work
// nicer ahead of time. Either index the big file so you can find you
// can find your line faster; or structure the big file so it is easier
// to search; or else try the PSI::ESP module so you can seek() to the
// *exact* line you need to change.
//
// I keep trying #3, but I can't get it to work reliably.
That's because you didn't properly sense the manual.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 06 Aug 1999 23:51:53 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <7ln8nnnq.fsf@wind.localdomain>
>You seem to think "ditto" means "I agree". Look it up.
ditto means to copy..
copy.. in radio terms, means that I hear and understand you...
in other words. I was agreeing.
just because a word is not in a dictionary the way it is used, does
not mean it is a useful word nonetheless.
--
- "Peace cannot be kept by force. It can only be achieved by
understanding."
- "Whoever undertakes to set himself up as judge in the
field of truth and knowledge is shipwrecked by the
laughter of the Gods." -A. Einstein
------------------------------
Date: Fri, 06 Aug 1999 23:15:47 -0700
From: Eric Turner <erict@cc.wwu.edu>
Subject: Re: net:FTP install
Message-Id: <37ABCF13.DDDE0770@cc.wwu.edu>
Jeff Miller wrote:
>
> I am trying to install the
> net::FTP so that I can transfer some files from the PC to the web host
> using a perl-cgi script called from html.
If you have the CGI.pm available on the web server, and you just want to
enable file uploads from a PC to the web site, then you don't need the
Net::FTP module. As long as the web browser being used on the PC has
file uploading capability (I believe Netscape and I.E. version 3 and up
have this) then you can get away with just the CGI.pm module. I'll email
some [working] code, which should get you started.
Eric Turner
------------------------------
Date: 7 Aug 1999 00:34:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: New to Perl - Question About RegExpr
Message-Id: <slrn7qnhb1.7j.abigail@alexandra.delanet.com>
David Cassell (cassell@mail.cor.epa.gov) wrote on MMCLXVI September
MCMXCIII in <URL:news:37AB29F9.36084384@mail.cor.epa.gov>:
|| Derek Battams wrote:
|| >
|| > I've just started to write CGIs in Perl (I've been writing them in C) and
|| > I've come across the following line in a script that someone else has
|| > written:
|| >
|| > $Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
||
|| The question you forgot to ask is: "Is this regex any good?"
|| I doubt it. The author didn't seem to know that the character class
|| \s includes the newline \n already, so this regex seems to do a lot
|| more work than is needed.
Not only that, both ?s should be omitted. The first one doesn't make
sense. With, or without the question mark, exactly the same string
will be matched. And for the trailing ()?, it basically asks to match
nothing at all.
s/\s+,/,/g;
would have been more understandable, and probably faster.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Aug 1999 06:11:47 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: New to Perl - Question About RegExpr
Message-Id: <7ogin3$92b$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Abigail
<abigail@delanet.com>],
who wrote in article <slrn7qnhb1.7j.abigail@alexandra.delanet.com>:
> || > $Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
> ||
> || The question you forgot to ask is: "Is this regex any good?"
> || I doubt it. The author didn't seem to know that the character class
> || \s includes the newline \n already, so this regex seems to do a lot
> || more work than is needed.
>
> Not only that, both ?s should be omitted. The first one doesn't make
> sense. With, or without the question mark, exactly the same string
> will be matched.
As my daughter would say: "HAH?!"
> And for the trailing ()?, it basically asks to match
> nothing at all.
Another "HAH?!".
> s/\s+,/,/g;
>
> would have been more understandable, and probably faster.
$count++;
would be yet faster. ;-)
Ilya
------------------------------
Date: 7 Aug 1999 05:57:57 GMT
From: bsj@fc.hp.com (Brian StJohn)
Subject: non-interactive telnet session
Message-Id: <7oght5$r12$1@fcnews.fc.hp.com>
Hey everyone,
I'm trying to write a small script that remotely
logs into a xyplex terminal server and executes
a series of commands. I don't need returns on
any of the commands I want executed, though that
would be nice for debugging purposes.
I've looked at chat2, and wire, and Net::Telnet,
but I can't get any of them to work. The remote
machine is a xyplex terminal server, and the
login session looks like this:
icbdsa1:/opt/perl/lib $ telnet xyplex02 2000
Trying...
Connected to xyplex02.fc.hp.com.
Escape character is '^]'.
#
Welcome to the Xyplex Terminal Server.
Enter username> somename
Xyplex> entering commands here
Connection closed by foreign host.server XYPLEX02 at 07 Aug 1999 05:51:59
I'm stumped here...any suggestions? I'll post relevant code is anyone
deems it needed.
Thanks,
Brian
------------------------------
Date: 7 Aug 1999 06:00:10 GMT
From: bsj@fc.hp.com (Brian StJohn)
Subject: Re: non-interactive telnet session
Message-Id: <7ogi1a$r12$2@fcnews.fc.hp.com>
Brian StJohn (bsj@fc.hp.com) wrote:
: Hey everyone,
: I'm trying to write a small script that remotely
: logs into a xyplex terminal server and executes
: a series of commands. I don't need returns on
: any of the commands I want executed, though that
: would be nice for debugging purposes.
: I've looked at chat2, and wire, and Net::Telnet,
: but I can't get any of them to work. The remote
: machine is a xyplex terminal server, and the
: login session looks like this:
: icbdsa1:/opt/perl/lib $ telnet xyplex02 2000
: Trying...
: Connected to xyplex02.fc.hp.com.
: Escape character is '^]'.
: #
: Welcome to the Xyplex Terminal Server.
: Enter username> somename
: Xyplex> entering commands here
: Connection closed by foreign host.server XYPLEX02 at 07 Aug 1999 05:51:59
: I'm stumped here...any suggestions? I'll post relevant code is anyone
: deems it needed.
Just as a followup to my own message, I forgot to add something:
I need to connect on port 2000, which Net::Telnet can't seem to do.
The prompt initially is nothing, until a keypress, then it comes
up to a #.
Brian
------------------------------
Date: 7 Aug 1999 06:51:54 GMT
From: bsj@fc.hp.com (Brian StJohn)
Subject: Re: non-interactive telnet session
Message-Id: <7ogl2a$r12$3@fcnews.fc.hp.com>
Brian StJohn (bsj@fc.hp.com) wrote:
: I'm trying to write a small script that remotely
: logs into a xyplex terminal server and executes
: a series of commands. I don't need returns on
: any of the commands I want executed, though that
: would be nice for debugging purposes.
I figured out a rather simple way to do it: just open
a tcp port to port 2000 on the xyplex, and feed the
commands in. It works fine...funny how the simpler
methods of dealing with things somehow manage to be
the best way. Code is attached at the end of the message.
Cheers,
Brian
--
!/usr/local/bin/perl
#
# xyplex.pl - allows the startup batch file to disconnect all the
# ports on a xyplex. It uses the IO:Socket module to open a TCP
# socket, and feeds the commands in. No return values are needed
# since this is being called by the prestartup script of the BARS system.
#
# Author: Brian St. John
#
# Date: 08/06/1999
use IO::Socket;
die "usage: $0 xyplexXX\n" if $#ARGV < 0;
$hostname = @ARGV[0];
$port = 2000;
$Debug = 1;
$socket = new IO::Socket::INET (PeerAddr => $hostname,
PeerPort => $port,
Proto => 'tcp',
);
die "Socket could not be created. Reason: $!\n" unless ($socket);
#if we got this far, we opened the socket and we're talking to the xyplex.
#we can start giving it commands with a one second delay.
print "Sending a carriage return...\n" if $Debug;
print $socket "\n"; #enter a return to get the # prompt
sleep 1;
print "Sending access password...\n" if $Debug;
print $socket "access\n"; #password to get to the userprompt;
sleep 1;
print "Sending anyname...\n" if $Debug;
print $socket "anyname\n"; #any username to get to the main prompt;
sleep 1;
print "Sending set priv...\n" if $Debug;
print $socket "set priv\n"; #set priv to get priveleged access to system;
sleep 1;
print "Sending system...\n" if $Debug;
print $socket "system\n"; #password for set priv;
sleep 1;
print "Sending disconnection message...\n" if $Debug;
print $socket "disconnect port all sessions all\n"; #actual command we want;
sleep 2;
close ($socket);
exit(0);
------------------------------
Date: Sat, 07 Aug 1999 15:39:09 +1000
From: Derek Lavine <derek@realware.com.au>
Subject: Passing parameters (am I mad)
Message-Id: <37ABC67C.78210EB3@realware.com.au>
Hi,
This is confusing me heaps. My script
#! /usr/bin/perl -w
# CGI parameter reading test
#
# param_test.pl
#
use CGI;
use strict;
use CGI qw(:standard escapeHTML);
use CGI::Carp qw(fatalsToBrowser);
use lib './';
use Mini_mail;
my $query = new CGI;
my @field_names = $query->param;
my $message = '';
foreach my $item (@field_names) {
$message .= $item . ": " . $query->param($item) . "\n";
}
print $message . "\n";
send( "derek\@realware.com.au", 'Message Test', "Parameter, test",
$message );
print $message . "\n";
$message = "yet\nthis works\n";
send( "derek\@realware.com.au", 'Message Test', "Parameter, test",
$message );
exit;
# the end
when I run
./param_test.pl action=1 value=3,4,5
I get the output
action: 1
value: 3,4,5
action: 1
value: 3,4,5
Ok, now the first mail message is sent but with an empty body and the
second one has the body
yet
this works
What I don't understand is why is the content of $message is not geting
through on the first call to send. Yet $message clearly contains data as
demonstrated in the 2 print $message . "\n"; statements
Has any one got any idea what may be going on ???
Thanks very much
Derek
P.S. I have retyped the $message in the first send() call many times
just in case there was an odd character that was not being displayed.
As an additional test I just tried replacing the first send() function
call with
my $myText = $message . "more";
send( "derek\@realware.com.au", 'Message Test', "Parameter, test",
$myText );
print $myText . "\n";
and I get an email with just 'more' in the body
but the print statement gives
action: 1
value: 3,4,5
more
Ahh!! what is going on ????
------------------------------
Date: Sat, 07 Aug 1999 16:21:22 +1000
From: Derek Lavine <derek@realware.com.au>
Subject: Re: Passing parameters (am I mad)
Message-Id: <37ABD062.DCCB359C@realware.com.au>
I just discovered the strangest thing (at least it is strange for me)
If I replace the
my $message = ''; # '' is ' and ' not a single "
with
my $message = "\n";
The code in my previous posting works
Does any one know the reason for this
Regards
Derek
------------------------------
Date: 7 Aug 1999 01:46:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Problems Quoting # in qw,...
Message-Id: <slrn7qnlik.7j.abigail@alexandra.delanet.com>
Xeno Campanoli (xeno@bigger.aa.net) wrote on MMCLXVI September MCMXCIII
in <URL:news:933969880.522219@cacheraq001>:
[]
[] I'm still wanting to get this figured out. Of course I can do something
[] like:
[]
[] @x = qw(C D . _ M X N V ALL);
[] push(@x,qq(#));
[]
[] But it would be very nice to do it all at once with qw somehow. Also, the
[] qw(#) works, but just with perl -w, I get a warning, so presumably there
[] is a correct way to do this using qw, otherwise presumably there would be
[] no complaint from perl -w.
No. It annoys me too that this was made a warning. If I put # in there,
then I certainly mean it. You can't even do
{local $^W = 0;
@x = qw /C D # E F/;}
because it's a compile time warning!
Something horrid like:
{my $W;
BEGIN {$W = $^W; $^W = 0}
@x = qw /C D # E F/;
BEGIN {$^W = $W}
}
works, but who wants to do write code like that?
Now, s/// and m// have the /x option. If only qw// had had /x as well.
It's too late now to add it. (Well, we can add it, but we can't remove
the warning I guess.)
use warnings should be in 5.6 though.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Fri, 6 Aug 1999 22:21:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Renaming a hash key ?
Message-Id: <MPG.12156224d081f6b9989df9@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37AB1F75.4D217CC4@dwc.ch> on Fri, 06 Aug 1999 19:46:29
+0200, Christoph Wernli <cw@dwc.ch> says...
> Is there a possibility other than
>
> $hash{new_key} = $hash{old_key};
> delete $hash{old_key};
>
> to rename a key ?
Interesting. The third time this week for this question or equivalent,
but never before that I can recall. An inFAQ.
Oh, the answer: No.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 7 Aug 1999 01:28:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Renaming a hash key ?
Message-Id: <slrn7qnkgv.7j.abigail@alexandra.delanet.com>
Christoph Wernli <cw@dwc.ch> wrote on MMCLXVII September MCMXCIII in
<URL:news:37AB1F75.4D217CC4@dwc.ch>:
\\
\\ Is there a possibility other than
\\
\\ $hash{new_key} = $hash{old_key};
\\ delete $hash{old_key};
\\
\\ to rename a key ?
Sure there is.
@hash {new_key => grep {$_ ne 'old_key'} keys %hash} =
@hash {old_key => map {$hash {$_}} grep {$_ ne 'old_key'} keys %hash};
or:
%hash = (new_key => $hash {old_key},
map {$_ => $hash {$_}} grep {$_ ne 'old_key'} keys %hash);
I wouldn't really recommend any of those statements though....
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Aug 1999 00:38:04 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: reverse of localtime?
Message-Id: <slrn7qnhhg.7j.abigail@alexandra.delanet.com>
Kin Cho (kin@symmetrycomm.com) wrote on MMCLXVI September MCMXCIII in
<URL:news:19990806211626.17158.qmail@nym.alias.net>:
%% Hi,
%%
%% I'm seeking a function when given the output string of localtime
%% (in scalar context), returns the output of time() (number of seconds
%% since 1970...).
RTFFAQ
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Aug 1999 01:55:16 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: SSH2, Need a little help
Message-Id: <slrn7qnm27.7j.abigail@alexandra.delanet.com>
Tom Phoenix (rootbeer@redcat.com) wrote on MMCLXVI September MCMXCIII in
<URL:news:Pine.GSO.4.10.9908061343040.9452-100000@user2.teleport.com>:
[]
[] No, since that didn't turn them off at compile time. You have to turn
[] compile-time warnings off at compile time.
[]
[] {
[] my $save_warn;
[] BEGIN { ($save_warn, $^W) = ($^W, 0); }
[] @x = qw( C D . _ # M X N M V ALL );
[] $^W = $save_warn;
[] }
I think it would only be fair to turn them on at compile time as well,
don't you think? Otherwise, you won't catch the other place where you
used qw /a b # c d/.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 412
*************************************