[7318] in Perl-Users-Digest
Perl-Users Digest, Issue: 943 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 29 05:07:41 1997
Date: Fri, 29 Aug 97 02:00:31 -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 Fri, 29 Aug 1997 Volume: 8 Number: 943
Today's topics:
crypt... does it work with shadow passwd (Andrew Kerr)
Re: crypt... does it work with shadow passwd <doug@ono.tc.net>
Re: crypt... does it work with shadow passwd <bholzman@mail.earthlink.net>
Re: crypt... does it work with shadow passwd (Andrew Kerr)
duplicate problems.. <zaheed.haque@ein.ericsson.se>
Re: duplicate problems.. <jjwahl@eznet.net>
Re: duplicate problems.. (Tad McClellan)
Re: HELP - What is "interpretive" vs. "compiled" <lounsbery@blender.com>
Help: Creating GDB module using tied variables <holder@rsn.hp.com>
Here document with FILEHANDLE ? <jxia@worldnet.att.net>
Here document with FILEHANDLE ? <jxia@worldnet.att.net>
Here Document with FILEHANDLE <jxia@worldnet.att.net>
How can I print the size of a file???? <thomasdj@wam.umd.edu>
Indexing search engine - request for review (Michael Schuerig)
My counter counts, but too munch (Lozano Mosterin, Jesus)
Re: NT 4.0 Server ans Perl5 307 (Changuk Sohn)
Re: Perl Questions <mf@fishbone.ruhr.de>
Re: Perl/Oraperl twod@not.valid
Q: Daemon-Programming - HOWTO? (Joachim Wunder)
Re: Setting the TZ time variable within Perl (Ilya Zakharevich)
Re: solaris 5.5.1: 'make test' SUCCEEDS NOW!! <houtsma@lucent.com>
Re: SSH and Perl Steve_Kilbane@cegelecproj.co.uk
stat a Socket w.stanton@auckland.ac.nz
Re: When to use "use strict" (Scott Wimer)
Where do I get the patch for threading (Leonhard Brenner)
Win32::EventLog problem <jdm@oreilly.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Aug 1997 23:05:29 GMT
From: kerr@cs.uregina.ca (Andrew Kerr)
Subject: crypt... does it work with shadow passwd
Message-Id: <5u507p$fja$1@sue.cc.uregina.ca>
Well, the title says most of it... using Perl 5 on Irix 5.3
with shadow passwording on. Will the crypt function work???
So far it isn't for me, but it could be my code at this point :)
Thanks,
Andrew
--
Andrew Kerr
Email: kerr@tdi.uregina.ca
Alternate: kerr@3co.com
Homepage: http://tdi.uregina.ca/~kerr/index.html
Illegitimus non Carborundem -- "Don't let the bastards grind you down".
------------------------------
Date: 28 Aug 1997 20:44:46 -0400
From: Douglas McNaught <doug@ono.tc.net>
To: kerr@cs.uregina.ca (Andrew Kerr)
Subject: Re: crypt... does it work with shadow passwd
Message-Id: <m2d8mxstq9.fsf@ono.tc.net>
[mailed and posted]
kerr@cs.uregina.ca (Andrew Kerr) writes:
> Well, the title says most of it... using Perl 5 on Irix 5.3
> with shadow passwording on. Will the crypt function work???
> So far it isn't for me, but it could be my code at this point :)
Sure it'll work. You just have to read use /etc/shadow instead of
/etc/passwd as the location of the crypt()ed string. Which means you
have to be root.
-Doug
--
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";
------------------------------
Date: Thu, 28 Aug 1997 23:36:42 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Douglas McNaught <doug@ono.tc.net>
Subject: Re: crypt... does it work with shadow passwd
Message-Id: <340643CA.705857AC@mail.earthlink.net>
Douglas McNaught wrote:
>
> [mailed and posted]
>
> kerr@cs.uregina.ca (Andrew Kerr) writes:
>
> > Well, the title says most of it... using Perl 5 on Irix 5.3
> > with shadow passwording on. Will the crypt function work???
> > So far it isn't for me, but it could be my code at this point :)
>
> Sure it'll work. You just have to read use /etc/shadow instead of
> /etc/passwd as the location of the crypt()ed string. Which means you
> have to be root.
>
> -Doug
Better if you use getpwnam and friends. You'll get the password if
you've got the priveleges and your code will be more portable!
------------------------------
Date: 29 Aug 1997 04:29:05 GMT
From: kerr@cs.uregina.ca (Andrew Kerr)
Subject: Re: crypt... does it work with shadow passwd
Message-Id: <5u5j6h$5vi$1@sue.cc.uregina.ca>
: > > Well, the title says most of it... using Perl 5 on Irix 5.3
: > > with shadow passwording on. Will the crypt function work???
: > > So far it isn't for me, but it could be my code at this point :)
: >
: > Sure it'll work. You just have to read use /etc/shadow instead of
: > /etc/passwd as the location of the crypt()ed string. Which means you
: > have to be root.
: >
: > -Doug
: Better if you use getpwnam and friends. You'll get the password if
: you've got the priveleges and your code will be more portable!
Well, two problems... 1. This is meant to be used via a webpage, so no
root, cause I'm not letting perl run as root.
2. What is friends??? I know getpwnam and am using it, but haven't seen
or read anything on friends.
Andrew
--
Andrew Kerr
Email: kerr@tdi.uregina.ca
Alternate: kerr@3co.com
Homepage: http://tdi.uregina.ca/~kerr/index.html
Illegitimus non Carborundem -- "Don't let the bastards grind you down".
------------------------------
Date: Fri, 29 Aug 1997 01:47:52 +0200
From: Zaheed Haque <zaheed.haque@ein.ericsson.se>
Subject: duplicate problems..
Message-Id: <34060E28.F86@ein.ericsson.se>
Hello,
A newbie question..
I have a textfile which looks like the following..
1|acs|Digital Image Library|Texas Tech|33452
4|acs|Digital Display|OMTEC Inc.|98292
5|acs|Digital Image Library|SideShop|33452
230|dcs|Optical Fiber|TTML|82920
902|fcp|Network adapter|Cisco|01920
123|fcp|Network adapter|Cisco|01920
544|acs|Digital Image Library|Image Inc|33452
As you can see the third item here in some places are duplicates..
I am trying to clean the list in the following logic..
If the third items are equal and and last item are equal than it's
a duplicate so remove all but keep one.. It doesn't matter which one..
Could someone help me with a snippit of perl code..
Best Regds
Zaheed
------------------------------
Date: Fri, 29 Aug 1997 03:32:27 GMT
From: "Jon Wahl" <jjwahl@eznet.net>
Subject: Re: duplicate problems..
Message-Id: <01bcb424$c6ffb380$2a8232cf@default>
Try
open(FL,'d:\perlsrc\new.txt'); # Opens the file..
while(<FL>){ # while not undef..
@fields=split/\|/; # @fields[0]=field1, @fields[1]=field2...
if(++$key{join"",@fields[2],@fields[4]}==1){ # increment first. If this is
the first occurence
key(join of fields 3 & 5), print. Otherwise not..
print;
}
}
close(<FL>);
Zaheed Haque <zaheed.haque@ein.ericsson.se> wrote in article
<34060E28.F86@ein.ericsson.se>...
> Hello,
>
> A newbie question..
>
> I have a textfile which looks like the following..
>
> 1|acs|Digital Image Library|Texas Tech|33452
> 4|acs|Digital Display|OMTEC Inc.|98292
> 5|acs|Digital Image Library|SideShop|33452
> 230|dcs|Optical Fiber|TTML|82920
> 902|fcp|Network adapter|Cisco|01920
> 123|fcp|Network adapter|Cisco|01920
> 544|acs|Digital Image Library|Image Inc|33452
>
> As you can see the third item here in some places are duplicates..
> I am trying to clean the list in the following logic..
>
> If the third items are equal and and last item are equal than it's
> a duplicate so remove all but keep one.. It doesn't matter which one..
>
> Could someone help me with a snippit of perl code..
>
> Best Regds
> Zaheed
>
>
------------------------------
Date: Thu, 28 Aug 1997 23:15:49 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: duplicate problems..
Message-Id: <ldi5u5.78k.ln@localhost>
Zaheed Haque (zaheed.haque@ein.ericsson.se) wrote:
: Hello,
Hi.
: A newbie question..
hint: nearly always, if your question mentions "unique" or "duplicate"
then you should consider hashes, since they have a unique key.
See caveats below.
: I have a textfile which looks like the following..
[ sample data snipped ]
: As you can see the third item here in some places are duplicates..
: I am trying to clean the list in the following logic..
: If the third items are equal and and last item are equal than it's
: a duplicate so remove all but keep one..
"unique" based on the 3rd and 5th fields then.
hint: A question asked on Usenet is a requirements specification.
If the requirements specification doesn't address a particular
issue, then the developer gets to pick. (We're gonna pick
whatever is easiest to implement ;-)
-----
You have not said anything about how many of these records you have.
So I get to pick.
I'll pick a 'small' number. If you have 'big' number,
then the code below is not what I would do, and I have wasted time
giving you an answer that you cannot use...
-----
You have not said whether the original order must be preserved or not.
So I get to pick.
I pick not. This is fun! ;-)
hint: Sample data in your post is an _excellent_ idea, but it may be
the only test cases that get tried. Put a little thought into
what you include in the test data.
What should it do if the 3rd fields are equal, but the 5th fields
are *not*?
It should not treat them as duplicates (ie. leave both in the list)
You don't have any data records that meet those conditions, I added
two records to test this.
: It doesn't matter which one..
That makes it easier ;-)
: Could someone help me with a snippit of perl code..
You were wondering if I'd ever get to answering your question?
Here's a start anyway:
---------------------
#!/usr/bin/perl -w
while (<DATA>) {
chomp;
# this is gonna be hideously slow, but I got to pick 'small'...
$key = join '', (split /\|/)[2,4]; # concatenate the 3rd & 5th fields
$db{$key} = $_; # key is 3rd & 5th fields, value is all five fields
}
# not in the same order, but I got to pic 'not'...
foreach (sort keys %db) {
print "$db{$_}\n";
}
__DATA__
1|acs|Digital Image Library|Texas Tech|33452
4|acs|Digital Display|OMTEC Inc.|98292
2|acs|Digital Display|OMTEC Inc.|99999
5|acs|Digital Image Library|SideShop|33452
230|dcs|Optical Fiber|TTML|82920
240|dcs|Eatsome Fiber|TTML|82920
902|fcp|Network adapter|Cisco|01920
123|fcp|Network adapter|Cisco|01920
544|acs|Digital Image Library|Image Inc|33452
---------------------
The value and applicability of 'solutions' you get on Usenet are most
often directly proportional to the thought put into the question ;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 28 Aug 1997 18:53:46 +0000
From: John Lounsbery <lounsbery@blender.com>
Subject: Re: HELP - What is "interpretive" vs. "compiled"
Message-Id: <3405C92E.5388@blender.com>
Perl is never really interpreted, although it is similar. Almost always
the perl program is a text file on the server, when it is requested or
called via the command line, Perl compiles it, and then executes it.
Interpreted means that a program is compiled while it is running,
technically it's never actually compiled. Compiled Perl is actually
compiled into object code once so when it is requested, it just runs an
executable. Compiled perl will run faster than regular, but will be
system dependent(i.e. you can't move it to another OS without
recompiling).
------------------------------
Date: 28 Aug 1997 18:27:02 -0500
From: Shane Holder <holder@rsn.hp.com>
Subject: Help: Creating GDB module using tied variables
Message-Id: <fawg1rtlwhl.fsf@mordor.rsn.hp.com>
I'm creating a module to control gdb. And would like to provide the
functionality of having a variable in a perl script mimic a variable
in a program being debugged.
Basically what I've got is:
use Gdb;
my $gdb = Gdb->new( ... );
my $buffer;
$gdb->gdb_bt(\$buffer); # Put the backtrace in $buffer
etc...
What I would like to be able to do is:
tie $foo $gdb "foo";
while ($foo != 0) {
stuff
}
rather than
while (($foo = $gdb->print_var("foo")) != 0) {
stuff
}
and now when I access $foo in my perl script, the $gdb instance issues
a print command to the gdb process and puts the value in $foo.
I'll also want to tie arrays, and maybe hashes, but I haven't thought
of a use for hashes yet.
--
Shane Holder e-mail: holder@rsn.hp.com
Hewlett Packard
3000 Waterview
Richardson, TX 75083
------------------------------
Date: 29 Aug 1997 05:01:59 GMT
From: "Jerry Xia" <jxia@worldnet.att.net>
Subject: Here document with FILEHANDLE ?
Message-Id: <5u5l47$4gp@bgtnsc03.worldnet.att.net>
Howdy,
Is there any way that I can open a file with using here document? What I am
trying to do is something like:
open (FTP, "ftp -n $hostname <<EOF
user xxx
ls -l
...
bye
EOF
|") ;
But it is not working. I can get over it by using a file which contains ftp
commands:
open (FTP, "ftp -n $hostname < $filename |");
Since I can use "here document" in Shell script, I think there may be a way
to do it in Perl.
If someone has the answer, please post it or mail to me.
Thanks
Jerry
------------------------------
Date: 29 Aug 1997 05:02:25 GMT
From: "Jerry Xia" <jxia@worldnet.att.net>
Subject: Here document with FILEHANDLE ?
Message-Id: <5u5l51$4lq@bgtnsc03.worldnet.att.net>
Howdy,
Is there any way that I can open a file with using here document? What I am
trying to do is something like:
open (FTP, "ftp -n $hostname <<EOF
user xxx
ls -l
...
bye
EOF
|") ;
But it is not working. I can get over it by using a file which contains ftp
commands:
open (FTP, "ftp -n $hostname < $filename |");
Since I can use "here document" in Shell script, I think there may be a way
to do it in Perl.
If someone has the answer, please post it or mail to me.
Thanks
Jerry
------------------------------
Date: 29 Aug 1997 05:12:04 GMT
From: "Jerry Xia" <jxia@worldnet.att.net>
Subject: Here Document with FILEHANDLE
Message-Id: <5u5ln4$4lq@bgtnsc03.worldnet.att.net>
Howdy,
Is there any way that I can open a file with using here document? What I am
trying to do is something like:
open (FTP, "ftp -n $hostname <<EOF
user xxx
ls -l
...
bye
EOF
"|);
But it is not working. I tried to put "|" after first EOF. It didn't work
either. I can get over this by using a file which contains ftp commands:
open (FTP, "ftp -n $hostname < $filename |");
Since I can use here document in Shell script, I am wondering that there
may be a way to do this in Perl.
If someone has the answer, please post it or mail to me.
Thanks a lot.
Jerry
------------------------------
Date: Fri, 29 Aug 1997 01:36:53 -0400
From: "David J. Thomas" <thomasdj@wam.umd.edu>
Subject: How can I print the size of a file????
Message-Id: <34065FF5.1C7D@wam.umd.edu>
I have the following line of code in a cgi-script:
$modTime = (stat($fullFilename))[9];
This returns the last modified date and time of the file.
I also want to return the size of this file to a variable as well.
One more thing... I'd like to be able to print the total disk space and
the amount that is used under my quota.
Anybody know????
Thanks for the help
------------------------------
Date: Fri, 29 Aug 1997 01:31:20 +0200
From: uzs90z@uni-bonn.de (Michael Schuerig)
Subject: Indexing search engine - request for review
Message-Id: <19970829013120559517@rhrz-isdn3-p9.rhrz.uni-bonn.de>
With help from this group I've written an indexing search engine. The
scripts are available from the bottom of my home page (see sig).
Please don't use the scripts on a web site yet. Have a look at them,
scrutinize them for bugs and security problems and ways to improve them.
And *then* use an improved version.
BTW, I'm very intersted in learning how to evaluate boolean (or rather
set) expressions.
Michael
--
Michael Schuerig I am the sum total of the
mailto:uzs90z@uni-bonn.de parts I control directly.
http://www.uni-bonn.de/~uzs90z/ -Daniel C. Dennett
------------------------------
Date: 29 Aug 97 05:31:46 +0100
From: lozano@opalo.etsiig.uniovi.es (Lozano Mosterin, Jesus)
Subject: My counter counts, but too munch
Message-Id: <1997Aug29.053146.14333@opalo.etsiig.uniovi.es>
Hello
I want to count the "0" chars in various strings of lengh 7,
related to string position. I'm using this and sometimes works
as expected, others don't, counting one ocurrence more in the
seventh position
for ($j=0;$j<7;$j++) { $stat[$j]++ if ($j == index($temp,"0",$j)); }
Thanks for your help
---
Please, answer by e-mail
------------------------------
Date: 29 Aug 97 02:48:26 GMT
From: csohn@cgocable.net (Changuk Sohn)
Subject: Re: NT 4.0 Server ans Perl5 307
Message-Id: <3406387a.0@news.cgocable.net>
Petri Backstrom wrote
>Do you really, truly mean that the only thing you did was
>install Perl5, and that makes your computer's CPU and memory
>usage go "crazy" (whatever that means)?
Yes, after installation(perl5) following problems:
1, cisvc.exe and cidaemon.exe's CPU usege go crazy
2, Virtual memory usage go to top(100%) and memory error message. repeating.
Well, When I killed(stoped) Content Index service CUP and Mem usage went back
to stable.
>
>Methinks that you're not telling us the whole story...
Well, Yes i forgot to tell you about my web server(IIS 4.0 beta 2)
>
>Besides installing Perl, are you trying to actually use
>it for something? If so, what scripts? Do you run/test
>them from the command line? Is, perhaps, a web server
>involved? If so, which one?`Which processes are using
>up the CPU, memory? Etc., etc.
I did run some sample scripts from aspSample directory after all the problem
start.
Thank you petri
Changuk Sohn
------------------------------
Date: 28 Aug 1997 22:32:10 +0200
From: Martin Fischer <mf@fishbone.ruhr.de>
Subject: Re: Perl Questions
Message-Id: <5u4n8a$iom$1@fishbone.ruhr.de>
Sergio Stateri Jr <serginho@mail.serve.com> wrote:
>Hi ! I think that I'll ask a FAQ, but I didn't find how to do this in Perl
>Faq...I'm sorry...
>How can I delete a line from a text file ?
>How can I change a line from a text file ? (rewrite)
>Thanks in advance and, one more time, sorry...
Yes, it's a faq. In perlfaq5:
How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the
beginning of a file?
Maybe thisone is useful for you, if you're searching for something
in the docs. Look for '/modules/by-module/Text/perlindex-1.200.tar.gz'
on your friendly CPAN-mirror.
ciao
Martin
--
Martin Fischer <mf@fishbone.ruhr.de> -------------------
<Martin.Fischer@fh-bochum.de> | Comp Sci Student
PGP key available at: http://localhost.ruhr.de/~martin | FH-Bochum, Germany
Unsolicited commercial e-mail will be proof-read for $199/hr.
------------------------------
Date: 29 Aug 1997 07:48:11 GMT
From: twod@not.valid
Subject: Re: Perl/Oraperl
Message-Id: <5u5urr$4cj$2@vnetnews.value.net>
smeyyappan@pyrasol.com wrote:
: First of all, I tried to reply back to Mike McNelly at:
: mike@stripme.fc.hp.com
^^^^^^^^
Could this be a hostname or an anti-spam device ? :)
: I've been told only works on Perl 4.x. Can you direct me toward the
: version of Oraperl that I can use with Perl 5.004.
It's the DBD-Oracle and DBI modules that you need. Their home page is on
www.hermetica.com and they should be on all of the CPAN sites.
: Also, the main reason I am installing Perl is because I have updated
: my
: operating system from HP-UX 9.x to HP-UX 10.20. Is there any reason
: why I
: can't keep the same version of Perl and Oraperl I have now? (Perl
: 4.035
: Oraperl 2.4).
Absolutely none at all as long as it continues to work. However, 2.4 is
no longer supported and is a pain to recompile when you upgrade Oracle,
etc (as the poster found).
The DBD-Oracle module has an Oraperl interface that is 99.99% compatible
with 2.4 scriots. The DBD-Oracle module gives you the ability to do things
that are not possible in 2.4. The compilation process for the DBD-Oracle
module is far easier then for 2.4.
I'd recommend you head off to www.hermetica.com
IAP
------------------------------
Date: 29 Aug 1997 00:48:58 GMT
From: t1206bq@lrz-muenchen.de (Joachim Wunder)
Subject: Q: Daemon-Programming - HOWTO?
Message-Id: <5u569q$5kq$1@sparcserver.lrz-muenchen.de>
Keywords: Daemon
Hi!
I am a newbie to Daemon-programing in Perl. Could someone email me an example
of a simple daemon-structure? Or point me to some appropriate literature
about it?
Thanks in advance!
Joachim
--
Email: Joachim.Wunder@LRZ-Muenchen.DE
Tel.: +49 89 894287-83
Fax.: +49 89 894287-85
------------------------------
Date: 28 Aug 1997 23:46:52 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Setting the TZ time variable within Perl
Message-Id: <5u52lc$i3b@agate.berkeley.edu>
In article <5u4k1b$h9u$4@nntp2.ba.best.com>, Zenin <zenin@best.com> wrote:
> Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> > > Do you mean "modify the TZ of the server" or "modify my own TZ
> > > variable"? As a rule, modifying the TZ of your server will be bad. For
> > > modifying your own, just change it like any other environment variable.
> > > The info is in the man pages.
> >snip<
> > I doubt it very much. Changine $ENV{TZ} will change the C environment
> > of the kids, but not of the current process.
>
> You're mistaken. Changing anything in %ENV changes your _current_
> environment as well as exporting those changes to your children. As
> such, simply resetting $ENV{TZ} should do it.
*Really*? Looking in the code, one can support this claim, but
experiments do not show it (at least on OS/2, where setting TZ before
process starts and after it starts have different effect).
This _may_ be related to some env having effect on startup only.
> BTW, there is no "C" environment, but just simply environment. It's
> a process/kernel issue, not a language issue.
Wrong. You confuse CRT issues with kernel issues. Kernel would not
know if you change the C global `environ', but the CRT will know.
Your statement may be true on some obsolete OSes, like *nices, where
the line between CRT and the kernel is very blurry.
Ilya
------------------------------
Date: Fri, 29 Aug 1997 10:34:12 +0200
From: Jan Houtsma <houtsma@lucent.com>
Subject: Re: solaris 5.5.1: 'make test' SUCCEEDS NOW!!
Message-Id: <34068983.A8A1A8C4@lucent.com>
Ok, thank you all for replying,
I have built perl with
sh Configure -Dcc='gcc -B/usr/ccs/bin/'
now and this works fine.
I haven't tried the -share option that was suggested too. I will try
that later.
Thanks for replying all!
jan
--
___ ___ ___
/ / / / / / Jan H. Houtsma - hz/hv141
/ / / / / /
/ /____/ /____/ / Tel: +31 (0) 35 687 4978
___ / _____ _____ / Fax: +31 (0) 35 687 5964/5956
/ / / / / / / / Po box 18, 1270 AA Huizen
/ /___/ / / / / / Botterstraat 45, 1271 XL Huizen
/_________/ /__/ /__/ mailto:houtsma@lucent.com
Lucent Technologies, Bell Labs Innovations / Platform-PRC / OSI-P
------------------------------
Date: Fri, 29 Aug 1997 08:42:56 GMT
From: Steve_Kilbane@cegelecproj.co.uk
Subject: Re: SSH and Perl
Message-Id: <81d7cd$82a38.b@news.cegelecproj.co.uk>
In article <872785193.26062@dejanews.com>, jjune@midway.uchicago.edu writes:
> I am currently trying to write a perl script that will utilize ssh and scp [...]
> turning out to be MUCH more tricky then I had anticipated... has anyone
> seen any script that does this?... Or better yet... can anyone offer any
> pointers or advice on how to go about writing something like this?
At the risk of being slightly heretical, Perl ain't the right hammer for
this particular nail. Don Libe's Expect is. Expect is design for
exactly this sort of job - driving terminal-based interactive programs
that would like to remain terminal-based - and it does it well.
Of course, Expect is an extension to Tcl, and for all I know,
someone has wrapped it up in a Perl XSUB too, although I didn't
see it in a quick scan through the module list.
--
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
Kilbane's law of integration: standardise on protocols and file
formats, and the applications take care of themselves.
------------------------------
Date: 29 Aug 1997 12:44:29 +1300
From: w.stanton@auckland.ac.nz
Subject: stat a Socket
Message-Id: <wkyb5lub36.fsf@RIDO.i-have-a-misconfigured-system-so-shoot-me>
Hello All!
Is there a way to stat a Socket like I would stat a FileHandle?
I have tried opening my Socket as a file handle
$self->{SOCK} = FileHandle->new;
$paddr = accept($self->{SOCK}, Server);
use the socket happily.
then...
@a = stat $self->{SOCK};
@a is empty!
It is very important to me to be able to test if there is any data
available on a socket without blocking.
Thanx all.
WORiK
w.stanton@auckland.ac.nz
I am using... (From perl -v)
Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
All rights reserved.
Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
Perl for Win32 Build 306 - Built 17:50:28 Apr 10 1997
This is perl, version 5.003_07
Copyright 1987-1996, Larry Wall
+ suidperl security patch
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
------------------------------
Date: Fri, 29 Aug 1997 07:53:14 GMT
From: scottw@cgibuilder.com (Scott Wimer)
Subject: Re: When to use "use strict"
Message-Id: <34067eb0.359509682@news.earthlink.net>
[ Author Cc:ed ]
Tom,
I wish I had the luxury of always running my code on Apache servers.
Most of the carefully written code (as opposed to hasitly slammed
together scripts for the Sys Admin staff) I write is CGI. At work we
run Netscape's servers and on other code, I usually don't know where
it's going to end up.
One major benefit that I see of leaving the `use strict' in the
production code, is that it makes the script barf miserably if
somebody tries tinkering with it.
As to the performance penalty, I've never noticed it, but I know that
perl has to perform N+X tasks slower than it performs N tasks. As to
how much slower, that I don't know.
Regards,
scottwimer
On Wed, 27 Aug 1997 08:01:36 -0700, Tom Phoenix
<rootbeer@teleport.com> wrote:
>On Wed, 27 Aug 1997, Scott Wimer wrote:
>
>> My assumption was that the my variables were in stored internally in
>> list format, and would therefore be much faster than haveing to do the
>> hash calculations, if you did not have an enormous number of my()'d
>> variables in each block.
>
>Even if you do have an enormous number of my() variables, they're faster
>than globals. The compiler turns $lexical into code which points right at
>it, as I understand.
>
>> As to `use strict': I turn it on for script development and while I'm
>> working on fine tuning stuff, but after that, I turn it off. That way
>> I don't pay the small performance penalty when the code is in
>> production.
>
>Do you also carry the baby in the trunk so that you won't pay the
>not-so-small performance penalty of strapping it into a car seat? :-)
>
>Seriously, use strict has three parts. As I understand things, 'vars'
>should have essentially no performance penalty, 'subs' should have
>essentially no performance penalty, and 'refs' should have essentially no
>performance penalty. :-) If you find that 'use strict' slows your
>real-world program by enough to notice (say, one-tenth of a second), I'd
>say that something is seriously wrong. (If it speeds things up, on the
>other hand... :-)
>
>Now, if you're writing CGI scripts and worrying that they may be
>called hundreds of times per minute, there might be a reason to want to
>shave every millisecond. That is, if it weren't for the excellent mod_perl
>for Apache, which eliminates much bigger overhead costs such as loading
>delay and internal compile time. From what I've seen, I'd expect it to
>make a typical CGI script of mine run on the order of 20 (!) times faster.
>
>Hope this helps!
>
>--
>Tom Phoenix http://www.teleport.com/~rootbeer/
>rootbeer@teleport.com PGP Skribu al mi per Esperanto!
>Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
Scott Wimer
"Life's too short to write shell scripts." - Me!
------------------------------
Date: 26 Aug 1997 14:06:48 -0400
From: brenner@slpyff.ed.ray.com (Leonhard Brenner)
Subject: Where do I get the patch for threading
Message-Id: <su290xog6o7.fsf@slpyff.ed.ray.com>
I found this in the White papers for O'reily's Perl Resource Kit:
Multithreading
--------------
Threads are a desireable abstraction for doing multiple and concurrent processing,
particularly if you are programming for duplex communications or event driven
applications. A multi-threading "patch" to Perl has been available since early 1997; it
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
where is it available
will be integrated into the standard distribution as of Perl version 5.005, in the fourth
quarter.
The multitasking model that Perl has historically supported is "fork" and "wait." The
granularity is the process. The flavor is UNIX. Unfortunately, the Windows/NT
equivalent isn't quite the same. This is where the portability of Perl breaks down, at
least for now. By building cross-platform multi-process Perl applications with a layer of
abstraction between the process control and the rest of the application, the problems
can be avoided. Furthermore, work is underway, to be completed in the fourth quarter of
1997, to reconcile the process-control code in the UNIX and Win32 ports of Perl.
I looked at CPAN, [mox|www].perl.[com|org] also in the 5.004_1 docs I can't find this patch.
I would like to see the interface that was designed, even if it's not functional yet.
------------------------------
Date: Thu, 28 Aug 1997 13:38:35 -0700
From: "James D. Murray" <jdm@oreilly.com>
Subject: Win32::EventLog problem
Message-Id: <3405E1CB.14B4@oreilly.com>
Greetings:
I have just installed Perl for Win32 from ActiveWare (5.003_07
Build 306) on my WinNTW4 system and I an experiencing an error
in the EVENTLOG.PM module. The following program:
use Win32::EventLog;
my $EventLog;
my $LogName = 'System';
my $ComputerName = 'PPRO';
Open Win32::EventLog( $EventLog, $LogName, $ComputerName );
produces the following error:
Modification of a read-only value attempted
at D:\PERL\LIB\WIN32\EVENTLOG.PM line 81.
Looking in EVENTLOG.PM and at line 81 is the following:
OpenEventLog($handle, $ServerName, $SourceName);
$_[0] = {'handle' => $handle,
'Source' => $SourceName,
'Computer' => $ServerName };
The problem is the assignment to $_[0]. I can't see what I'm
doing wrong. Help?
--
James D. Murray PO Box 70 Tel: +1.714.288.0141
jdm@ora.com Orange, CA 92856 USA
Maintainer of the Graphics File Formats FAQ on comp.graphics.misc and
coauthor of the O'Reilly book "Encyclopedia of Graphics File Formats".
------------------------------
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 943
*************************************