[7440] in Perl-Users-Digest
Perl-Users Digest, Issue: 1065 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 23 16:17:17 1997
Date: Tue, 23 Sep 97 13:00:32 -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 Tue, 23 Sep 1997 Volume: 8 Number: 1065
Today's topics:
Re: Accessing modem on NT: works (Terry Michael Fletcher - PCD ~)
David Roth Win32::Pipe?? <webmaster@biola.edu>
Re: Foolish Question About Saving Gifs annerose@geocities.com
Re: Getting next array element in a foreach <robert.crooks@nortel.ca>
Re: help for new man (Tom Grydeland)
Re: help for user authentication <rra@stanford.edu>
Re: help for user authentication (brian d foy)
Help, Why doesn't this work?! bbrown2@lindy.stanford.edu
Re: Need help with pesky warning... (Tad McClellan)
Need tokenizer code; example from FAQ doesn't seem to w (Christopher Lott)
Re: Nested subs and local vs my (Jim Turner )
Re: perl oracle twod@not.valid
Perl5.004 / UWIN1.3 -- any porters? <joshb@kadence.kom>
Re: Perl5.004 and Solaris 2.6 (Casper H.S. Dik - Network Security Engineer)
Re: Perl5.004 and Solaris 2.6 <NerveGas@nospam.inconnect.com>
Question: How to generate same "random" numbers... <kapur@cbl.ncsu.edu>
Re: Question: How to generate same "random" numbers... (Mike Stok)
Re: Strip spaces in filenames <samueljo@il.us.swissbank.com>
Re: Style question for class with hashs & arrays <sriram@weblogic.com>
UDP Server (Andreas Roeschies)
Re: unpack and install Perl <russ@mail.org.uk>
Re: unpack and install Perl <fishrman@shell.wco.com>
User Interface / cp problems <robert.crooks@nortel.ca>
WEB DEVELOPER/ARCHITECT <cgaston@lds.com>
Where is PerlShop to be found? rh@net55.com
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Sep 1997 16:22:43 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Accessing modem on NT: works
Message-Id: <608qcj$msi$1@news.fm.intel.com>
Terry Michael Fletcher - PCD ~ (tfletche@pcocd2.intel.com) so eloquently and verbosely pontificated:
i did a little more tinkering around last night, and found that i made
assumptions because my hardware was being inconsistent. i had tried to
set the input recored separator "$/" to undef, and also "", but neither of
those worked. i had thought that they should have, but instead i assumed
something else was going on. it did work however, when i set it to "\b",
so i thought i hit the jackpot, and that must have been the terminating
character. well, there must have been a hardware problem, because now it
works fine with "$/ = undef" and grabs the entire modem response.
> $/ = "\b"; # seems to be the terminating char
WRONG. just use $/ = undef.
> the sleep time may be different for other users, or if necessary, one can
> set up pseudo-interrupt vectors as described in the select() function
> manpage.
well, this was easier said than done. i wasnt sure how to avoid the
polling or looping, and tried something like this:
while (1) {
1 until &some_function_using_select_on_several_filehandles;
# process the response
}
but that seems that it would still waste processor time. anyone know how
to make the program sit idle until it receives data on a filehandle (like
an interrupt)?
--
#!/usr/local/bin/perl -- tfletche@pcocd2.intel.com
map{$;.=chr$_}(112,114,105,110,116,32,117,110,112,97,99,107,32,34,117,
34);$_=$;.=q>,':2G5S="!A;F]T:&5R(%!E<FP@:&%C:V5R+`H`'>;y[\034]{}d;eval
------------------------------
Date: Tue, 23 Sep 1997 13:09:42 +0100
From: Webmaster <webmaster@biola.edu>
Subject: David Roth Win32::Pipe??
Message-Id: <3427B186.7F84C385@biola.edu>
Has anyone worked with this module who could give me some help?
We just upgraded to build 310 and the module no longer works with the
new build.
Is there a new version out there somewhere or how would you go about
editing the old one to work with the new perl build.
Mark Johnson
------------------------------
Date: Tue, 23 Sep 1997 13:37:49 -0600
From: annerose@geocities.com
Subject: Re: Foolish Question About Saving Gifs
Message-Id: <875038232.14984@dejanews.com>
In article <34271854.4253870@news.erols.com>,
websites@erols.com (Website Construction Company) wrote:
> Of course I don't know exactly what is wrong, but what I learned when
> I tried to take some scripts off my ISP's unix box and place on a Mac
> is that they won't often work. Mac has a different directory
> structure, and the same programs won't work. For instance, on a PC a
> file might be c:\www\script.pl, and on a mac it is :www:script.pl.
> Might this be part of the problem?
No, the problem is more that MacPerl gd.pm keeps treating gif data
as text, and nothing I can think of seems to prevent this. Using
the standard methods from the UNIX version doesn't seem to work.
-------------------------------------------------------------
A rose with many thorns
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 23 Sep 1997 13:55:14 -0500
From: Robert Crooks <robert.crooks@nortel.ca>
Subject: Re: Getting next array element in a foreach
Message-Id: <34281092.75D@nortel.ca>
Gip wrote:
>
> How would one go about getting the next element after finding an element
> in an array, using a foreach:
>
> # assume for this ex that the @array contains b d h t
> foreach $item (@array) {
>
> if ($item eq "d") {
>
> # the next line is where my problem is; I want the next item 'h'!
> $next_item = ??? ; # I've tried shift unshift pop push
> $last;
> }
>
> }
>
> But, of course, I ended up doing the following:
>
> for ($i=0; $i<=$#array; $i++) {
> :
> :
>
> Thanks for your time.
> CG
>
> Notice I was able to type in this example without once using foo...oops
> now
> I guess I did.
How about this idea:
$i = 0;
foreach $item (@array) {
if ($item eq "d") {
# use d
# to use the next array element:
print("next array element is: $array[$i+1]\n");
}
$i++;
}
Just an idea.
Robert Crooks
------------------------------
Date: 23 Sep 1997 16:55:36 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: help for new man
Message-Id: <slrn62ft47.sm0.Tom.Grydeland@mitra.phys.uit.no>
On Tue, 23 Sep 1997 12:23:09 -0400,
Kevin P. Micalizzi <kevinm@tiac.net> wrote:
> You may want to just try removing the double quotes at the start:
>
> >print <<END_1;
>
> instead of
> >print <<"END_1";
Please make sure your answer is correct.
Example from perldata (the indentation makes these incorrect here):
print <<EOF;
The price is $Price.
EOF
print <<"EOF"; # same as above
The price is $Price.
EOF
print <<`EOC`; # execute commands
echo hi there
echo lo there
EOC
print <<"foo", <<"bar"; # you can stack them
I said foo.
foo
I said bar.
bar
myfunc(<<"THIS", 23, <<'THAT');
Here's a line
or two.
THIS
and here's another.
THAT
> HTH
As you can see, it won't.
> -kevin
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
------------------------------
Date: 23 Sep 1997 10:06:20 -0700
From: Russ Allbery <rra@stanford.edu>
To: wangyj@sro.cig.mcel.mot.com
Subject: Re: help for user authentication
Message-Id: <m3202gdkoj.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
Mike Wang <wangyj@sro.cig.mcel.mot.com> writes:
> I want to make the browser to pop user's authenticaton window when my
> perl cgi program is called. Please don't tell me to use ".htaccess" or
> some thing like that. I only want to know if there is any solution to do
> the same within cgi program.
No.
You have to use .htaccess. Sorry. (And a CGI programming newsgroup is
where you really want to ask these sorts of questions.)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 23 Sep 1997 15:17:27 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: help for user authentication
Message-Id: <comdog-ya02408000R2309971517270001@news.panix.com>
In article <m3202gdkoj.fsf@windlord.Stanford.EDU>, Russ Allbery <rra@stanford.edu> wrote:
>Mike Wang <wangyj@sro.cig.mcel.mot.com> writes:
>
>> I want to make the browser to pop user's authenticaton window when my
>> perl cgi program is called. Please don't tell me to use ".htaccess" or
>> some thing like that. I only want to know if there is any solution to do
>> the same within cgi program.
>
>No.
>
>You have to use .htaccess. Sorry. (And a CGI programming newsgroup is
>where you really want to ask these sorts of questions.)
no you don't. it's just a matter of sending the proper HTTP response.
Perl can do lots if you just give it a chance :)
#!/usr/bin/perl
print <<'HTTP';
Status: 401 Authentication Required
Host: computerdog.com
Content-type: text/plain
Authentication is required to access this resource
HTTP
__END__
of course, you'll need to handle the response yourself, but that's
the point, isn't it ;)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 23 Sep 1997 10:44:25 -0700
From: bbrown2@lindy.stanford.edu
Subject: Help, Why doesn't this work?!
Message-Id: <uulvhzs2adi.fsf@lindy.stanford.edu>
I'm switching from Version 4 to Version 5 and starting to use the
various libraries. I must have some basic misunderstandings because
I can't seem to get this to work.
#!/usr/local/bin/perl
use Net::FTP;
use File::Basename;
use File::Path;
$fullfile = "/xxx/yyyy/zzzz/aaaaaa/afile_iwant_to_get";
$ftp = Net::FTP->new("hostname");
$ftp->login("dssdbo","password");
$ftp->type("binary");
($file, $fullpath, $suffix) = fileparse($fullfile);
if ($fullpath[0] == "/"){
$rpath = ".$fullpath";
} else {
$rpath = "./$fullpath";
}
mkpath ("$rpath", 0, 0711);
print "Orig: *$fullfile*\n";
print "File: *$file*\n";
print "Path: *$fullpath*\n";
print "Suffix: *$suffix*\n";
print "Rpath: *$rpath*\n";
print "Rfile: $rpath$file\n";
$ftp->get("$fullfile", "$rpath$file");
$ftp->quit;
The Path Values all print out OK, the directory is properly created,
but I never get a file saved. I've also tried changing the current
directory. I tested by hand using ftp and the correct passwords and it
works fine that way.
Any ideas?
Thanks,
Bob
------------------------------
Date: Tue, 23 Sep 1997 12:14:38 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Need help with pesky warning...
Message-Id: <udt806.1t3.ln@localhost>
Ken Gaugler (keng@nospam.hybrid.com) wrote:
: Hmmm, I get
: "Read on closed filehandle <FP1> at testprog.pl line 5."
Because the original poster did not check the return value from
open() which is something you should ALWAYS do...
[ did you even have a file named 'mydata.txt' in the current directory? ]
: What exactly are you trying to do?
: On Tue, 23 Sep 1997 00:34:35 GMT, "David S. Patterson"
: <david.s.patterson@boeing.com> wrote:
: >#!/usr/local/bin/perl_5.003 -w
: >
: >open (FP1, "mydata.txt");
open (FP1, "mydata.txt") || die "could not open 'mydata.txt' $!";
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 22 Sep 1997 17:26:35 GMT
From: lott@bellcore.com (Christopher Lott)
Subject: Need tokenizer code; example from FAQ doesn't seem to work
Message-Id: <6069ob$87r@athos.cc.bellcore.com>
Dear Perl experts,
If you can please find a moment, I would appreciate the help.
I plucked this bit of code straight from the FAQ, where it is
credited to Jeffrey Friedl:
---
while (<>) {
chomp;
PARSER: {
m/ \G( \d+\b )/gx && do { print "number: $1\n"; redo; };
m/ \G( \w+ )/gx && do { print "word: $1\n"; redo; };
m/ \G( \s+ )/gx && do { print "space: $1\n"; redo; };
m/ \G( [^\w\d]+ )/gx && do { print "other: $1\n"; redo; };
}
}
---
This snippet appears under the question "What good is \G in a regular
expression?" in http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html
The FAQ warns that this code only works in 5.004 and above. I tested
this using perl 5, version (and I quote from perl -v:)
This is perl, version 5.004_01
This version was compiled for a sun running solaris 5.5. I ran the
example by saving the above code in file scan.pl and invoking perl on
it, like this:
perl5 scan.pl
It compiles fine, and perl waits for my input. After I type the first
line and hit return, a message (word, space, etc.) and the first token
on that line is printed over and over again until I hit ^C. So the
match seems to work great, but the \G assertion doesn't seem to have
the desired effect.
I need use scanner-like (i.e., tokenizer) functionality in a script
and thought that this would be perfect, but so far, no go. I hope
that I've been specific enough. Please let me know if I'm doing
something terribly dumb, or if there's a problem with either the
script or perl, how I can make this work. Thanks in advance.
chris...
--
Christopher Lott c.m.lott@ieee.org Tel +1 (973) 829-2149
Bellcore, MCC 1H-331B, 445 South Street, Morristown NJ 07960
--
Christopher Lott c.m.lott@ieee.org Tel +1 (973) 829-2149
Bellcore, MCC 1H-331B, 445 South Street, Morristown NJ 07960
------------------------------
Date: 23 Sep 1997 14:18:11 GMT
From: turnerj@cliffy.lmtas.lmco.com (Jim Turner )
Subject: Re: Nested subs and local vs my
Message-Id: <608j33$ke41@quest.lmtas.lmco.com>
Bart Lateur (bart.mediamind@tornado.be) wrote:
: I know this is a bit off-topic, but your code snippet triggered this
: question.
:
: gbacon@adtran.com (Greg Bacon) wrote:
:
: > sub outerfun {
: > my $b;
: >
: > my $inref = sub {
: > $b = $i;
: > print "...";
: > }
: >
: > $inref->();
: > }
:
: Are the next two statements functionally equivalent? If not, what's the
: difference?
:
: $inref->();
:
: &$inref();
:
: Bart Lateur
: bart.mediamind@tornado.be
Thanks so much for the response, this does indeed help! As for as $inref
vs &$inref(), I thought I saw something in the Perl 5 "Cammel" book about
this being just syntatic sugar, in keeping with Larry's philosophy of there
being more than one way to do things!
Jim Turner
turnerj@mmc1001.lmtas.lmco.com
------------------------------
Date: 23 Sep 1997 16:52:01 GMT
From: twod@not.valid
Subject: Re: perl oracle
Message-Id: <608s3h$mjr$1@vnetnews.value.net>
webadmin (webadmin@prestel.net) wrote:
: I need to stop this DB and move to oracle. Is it as straightforward as
: mSQL and wher do I get the perl module.
www.hermetica.com is the official home of the DBI and DBD modules for PERL5
that allow access to a great number of databases including Oracle.
: Basically what do i need to set up perl to intergrate with oracle and
: where do I get it from
There is plenty of documentation available at www.hermetica.com as well as
example code. Also there is a mailing list for the DBI/DBD modules, again
referenced at hermetica, that you can use for support - the mailing list
is archived and you are encouraged to search the archives before mailing to
the list to see if anyone else has hit the same problem.
The intergration is very easy -
Install and test PERL5;
Compile, test and Install the DBI module;
Compile, test and install the DBD module.
The DBD-Oracle module comes with two layers as it were, you can either use
the DBI calls directly or use an Oraperl emulation layer. It's best explained
as the difference between programming in OCI and Pro*C - they both run about
the same speed, but the lower level layer (DBI) gives you a few more bells
and whistles. Also the DBI layer makes it far easier to write generic code
that can be used against a number of database - the Oraperl emulation mode
is really for use against Oracle databases only.
IAP
--
In an attempt to reduce junk email I use an invalid 'From' address.
My correct email address can be determined by replacing 'not.valid' with
'value.net'
------------------------------
Date: Tue, 23 Sep 1997 12:19:42 -0700
From: "Josh Baudhuin" <joshb@kadence.kom>
Subject: Perl5.004 / UWIN1.3 -- any porters?
Message-Id: <6094oi$a26$1@news.cadence.com>
Has anyone successfully built Perl5.004[01] using U/WIN 1.3 ? ?
If so, please share how it was done...
________________
J. Baudhuin
opinions expressed here do not reflect the
opinions of my employer, except by coincidence.
To reply directly,
change the k's to c's
------------------------------
Date: 23 Sep 1997 17:00:21 GMT
From: Casper.Dik@Holland.Sun.Com (Casper H.S. Dik - Network Security Engineer)
Subject: Re: Perl5.004 and Solaris 2.6
Message-Id: <casper.875034170@uk-usenet.uk.sun.com>
[[ Reply by email or post, don't do both ]]
James Dishaw <jdishaw@aftac.gov> writes:
>I'm trying to get Perl5.004 to compile on a sparc machine running
>Solaris 2.6. I'm using the GCC 2.7.2.3 compiler on that machine
>(I don't want to install the SunSoft C compiler on that machine).
>Anyway, I'm getting a nifty little error message:
>make: Warning: Both `makefile' and `Makefile' exist
>`sh cflags libperl.a miniperlmain.o` miniperlmain.c
> CCCMD = gcc -DPERL_CORE -c -I/usr/local/include -O
>In file included from perl.h:223,
> from miniperlmain.c:10:
>/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2.3/include/sys/param.h:187:
^^^^^^^^^^^^^^^^^^^^^^
That's the error right there. You can't compile with gcc for 2.5.1 on
2.6 and that's because gcc insists on having its own set of fixed include
files.
You need to reinstall gcc and for that you need to patch it too.
The solaris FAQ says:
6.27) I can't seem to get gcc to work under Solaris 2.6
As with all new Solaris releases, you need to reinstall gcc after
upgrading. Unfortunately, Solaris 2.6 include files don't get
properly fixed by fixincludes. To fix this, apply the following
patch to fixinc.svr4 before building gcc.
*** ./fixinc.svr4.org Thu Jun 15 23:03:29 1995
--- ./fixinc.svr4 Thu Sep 4 13:41:29 1997
***************
*** 189,194 ****
--- 189,195 ----
s/__STDC__[ ][ ]*==[ ][ ]*1/defined (__STRICT_ANSI__)/g
s/__STDC__[ ][ ]*!=[ ][ ]*0/defined (__STRICT_ANSI__)/g
s/__STDC__ - 0 == 0/!defined (__STRICT_ANSI__)/g
+ s/__STDC__ - 0 == 1/defined (__STRICT_ANSI__)/g
/^typedef[ ][ ]*[unsigned ]*long[ ][ ]*[u_]*longlong_t;/s/long/long long/
' $2/$file > $2/$file.sed
mv $2/$file.sed $2/$file
--- end of excerpt from the FAQ
Questions marked with a * or + have been changed or added since
the FAQ was last posted
The most recently posted version of the FAQ is available from
<http://www.wins.uva.nl/pub/solaris/solaris2/>
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
------------------------------
Date: Tue, 23 Sep 1997 13:03:50 -0600
From: Steve Wolfe <NerveGas@nospam.inconnect.com>
Subject: Re: Perl5.004 and Solaris 2.6
Message-Id: <34281296.6951@nospam.inconnect.com>
> >I'm trying to get Perl5.004 to compile on a sparc machine running
> >Solaris 2.6. I'm using the GCC 2.7.2.3 compiler on that machine
> >(I don't want to install the SunSoft C compiler on that machine).
If at all possible, I would install Sun's compiler, especially if it
is Solaris for Sparc. Sun's compiler can optimize your binary much,
much more than GCC will. If it were a simple cgi program that would get
little use, it wouldn't matter... but as often as Perl can get used, the
optimization can really pay off in performance.
Steve
------------------------------
Date: Tue, 23 Sep 1997 13:43:30 -0400
From: Nevin Kapur <kapur@cbl.ncsu.edu>
Subject: Question: How to generate same "random" numbers...
Message-Id: <3427FFC2.26D926F7@cbl.ncsu.edu>
Is it possible to generate repeatable sets of random numbers using perl.
What I need is some function which will accept a seed and repeatedly
generate the same random numbers.
Thanks,
Nevin
------------------------------
Date: 23 Sep 1997 18:20:22 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Question: How to generate same "random" numbers...
Message-Id: <609196$gf1@news-central.tiac.net>
In article <3427FFC2.26D926F7@cbl.ncsu.edu>,
Nevin Kapur <kapur@cbl.ncsu.edu> wrote:
>Is it possible to generate repeatable sets of random numbers using perl.
>What I need is some function which will accept a seed and repeatedly
>generate the same random numbers.
You can use a known value to seed the random number generator in perl
using srand e.g.
[mike@stok tmp]$ cat try.pl
#!/usr/local/bin/perl -w
$seed = time ^ $$; # see camel or docs for better seed.
print "seed is $seed\n";
for (1 .. 5) {
srand $seed;
for (1 .. 10) {
print int rand 10, ' ';
}
print "\n";
}
[mike@stok tmp]$ ./try.pl
seed is 875049689
5 6 2 3 2 5 8 2 0 5
5 6 2 3 2 5 8 2 0 5
5 6 2 3 2 5 8 2 0 5
5 6 2 3 2 5 8 2 0 5
5 6 2 3 2 5 8 2 0 5
[mike@stok tmp]$ ./try.pl
seed is 875049690
3 7 2 8 0 5 4 0 9 1
3 7 2 8 0 5 4 0 9 1
3 7 2 8 0 5 4 0 9 1
3 7 2 8 0 5 4 0 9 1
3 7 2 8 0 5 4 0 9 1
If the linear congruential generator used in the C library rand is good
enough for you then this may be OK, otherwise you might want to look for
the Math::TrulyRandom module on teh comprehensive perl archive network
(CPAN) which is at ftp.funet.fi under /pub/languages/perl/CPAN or through
http://www.perl.com/CPAN
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: Tue, 23 Sep 1997 18:19:39 GMT
From: Jordan Samuels <samueljo@il.us.swissbank.com>
Subject: Re: Strip spaces in filenames
Message-Id: <oh0vhzrdhac.fsf@il.us.swissbank.com>
Can't remember where I got this off the net but here is a useful program:
Usage is e.g. "rename 's/foo/bar' *foo*".
--- cut here ---
#!/usr/local/bin/perl
## $Header: rename,v 3.0.1.2 90/08/09 03:17:57 lwall Locked $
## $Log: rename,v $
# Revision 3.0.1.2 90/08/09 03:17:57 lwall
# patch19: added man page for relink and rename
if ($ARGV[0] eq '-i') {
shift;
if (open(TTYIN, "</dev/tty") && open(TTYOUT,">/dev/tty")) {
$inspect++;
select((select(TTYOUT),$|=1)[0]);
}
}
($op = shift) || die "Usage: rename [-i] perlexpr [filenames]\n";
if (!@ARGV) {
@ARGV = <STDIN>;
chop(@ARGV);}
for (@ARGV) {
unless (-e) {
print STDERR "$0: $_: $!\n";
$status = 1; next;
}
$was = $_;
eval $op;
die $@ if $@;
if ($was ne $_) {
if ($inspect && -e) {
print TTYOUT "remove $_? ";
next unless <TTYIN> =~ /^y/i; }
unless (rename($was, $_)) {
print STDERR "$0: can't rename $was to $_: $!\n";
$status = 1;
}
}
} exit $status;
--- cut here ---
HTH, Jordan
--
Jordan Samuels (312) 554-5749
Software Consultant samueljo@il.us.swissbank.com
Swiss Bank Corp. Warburg
"Statements herein may not reflect the opinions or policies of my employer"
------------------------------
Date: Tue, 23 Sep 1997 11:37:01 -0700
From: Sriram Srinivasan <sriram@weblogic.com>
To: Alan Barclay <gorilla@elaine.drink.com>
Subject: Re: Style question for class with hashs & arrays
Message-Id: <34280C4D.293C26BF@weblogic.com>
Alan Barclay wrote:
>
> I'm writing a class/module which will store the details of a CD.
>
> $cd->new CDDB;
> ............
>
> print "The disk title is ",$cd->{disk}{DTITLE}," and the title of track #1 is",
> $cd->{track}[0]{TTITLE},"\n";
>
> My question, is this considered good perl style? It looks a little bit
> cumbersome to me, and I can't remember using a class which behaves like
> this but on the other hand, I think it looks better than my original
> alternative which was cd->details{disk,DTITLE}.
Alan,
This is a prety intuitive organization, except that you don't
really need DTITLE and TTITLE ... just TITLE will do, because they
are different hash tables.
But, it is not good OO or Perl style for the *user* of your module
to know how the information is laid out. Better to have an accessor
function to get and set it. That way, if you decide to store the info
on disk, or if you decide to change the way the it is
laid out internally, you only need to change the accessor functions.
The user code might look like this:
print "The disk title is ",
$cd->disk_info("TITLE"),
" and the title of track #1 is",
$cd->track_info(1, "TITLE"),"\n";
Note that the message says track #1, so 1 is passed as the parameter.
If you store this in an array, you make it zero-based internally.
Similarly, to set the information, you call the same functions
with the values.
$cd->disk_info("TITLE" => "Jumping Jack");
$cd->track_info(1, "TITLE" => "When the moon hits your eye");
I tend to use accessors even within the module code.
- Sriram
________________________________________________________________________
Principal Engineer WebLogic, San Francisco www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/
------------------------------
Date: Tue, 23 Sep 97 20:20:17 GMT
From: andreas@ostenberg.ping.de (Andreas Roeschies)
Subject: UDP Server
Message-Id: <6094n7$qfe@lilly.ping.de>
Hello,
how can I receive UDP-Messages on a specific Port? I didnt find help in the
Lama nor in the Camel Book.
------------------------------
Date: Tue, 23 Sep 1997 12:08:57 +0100
From: Russell Odom <russ@mail.org.uk>
To: Larry Nguyen <Larry_P_Nguyen@qmail2.sp.trw.com>
Subject: Re: unpack and install Perl
Message-Id: <3427A349.D0796A45@mail.org.uk>
Larry Nguyen wrote:
>
> X-Mailer: Mozilla 3.01Gold (WinNT; I)
>
> What format is the perl's code (ie. latest.tar.gz) packed in?
> How do I unpack it?
> thanks
I'm assuming you're trying to install perl on a WinNT system. If so,
you can unzip the source with WinZip, from http://www.winzip.com/. It's
easy to use, and supports loads of formats.
However, there's a ready compiled binary (also compressed so you still
need WinZip) for Win32 systems from
http://www.perl.com/CPAN/ports/win95/Gurusamy_Sarathy/ which saves you all
the hassle of compiling it yourself. I have to say it's well
put together, and works very well. Thanks Gurusamy!
HTH,
Russ
---------------------------------------------------------------------
--[ R u s s e l l O d o m ]---[ *NEW:* mailto:russ@mail.org.uk ]--
--[ University of York, UK ]---[ http://www.york.ac.uk/~rjo100/ ]--
---------------------------------------------------------------------
--[ FAQ maintainer, news:comp.os.ms-windows.win95.moderated ]--
---------------------------------------------------------------------
------------------------------
Date: 23 Sep 1997 18:19:54 GMT
From: "Michael A. Watson" <fishrman@shell.wco.com>
Subject: Re: unpack and install Perl
Message-Id: <60918a$fj8$1@news.wco.com>
Larry Nguyen <Larry_P_Nguyen@qmail2.sp.trw.com> wrote:
> What format is the perl's code (ie. latest.tar.gz) packed in?
> How do I unpack it?
I file I got was named latest.tar with no gz on the end even though it was a
gzip file. I ended up doing cp latest.tar latest.tar.gz then gzip -d latest.tar.gz. then tar xf latest.tar
------------------------------
Date: Tue, 23 Sep 1997 14:16:49 -0500
From: Robert Crooks <robert.crooks@nortel.ca>
Subject: User Interface / cp problems
Message-Id: <342815A0.444D@nortel.ca>
Hi:
I am writing a simple program that supplies a user-interface with the
Curses screen library on UNIX. I am displaying the menus and then
taking the input through either the getstr() or getch() functions from
Curses. Also, I have called crmode() at the beginning of my script so
that only the program control interrupts are interpretted by the shell.
Problem 1:
In order to improve the friendliness, I want to use special keys on the
keyboard like the function keys, arrow keys, delete, and insert.
However, I have yet to figure out how do do this. Of course, I am using
Curses in my Perl script.
Any ideas?
Problem 2:
In my script, I use backticks to copy some files from a backup directory
to the current directory:
`cp ~/source/mfep/backup/$system/*.pdt .` || die("cant copy: $!");
With a statement like the above, the program dies because it cannot find
the file/directory I am referring to (which are known to exist).
Are there any constraints to manipulating files through Perl that I
should know about? Is there another way to get backup files from a
directory into the current directory without a system call?
Robert Crooks
------------------------------
Date: Tue, 23 Sep 1997 14:47:01 -0400
From: Chris Gaston <cgaston@lds.com>
Subject: WEB DEVELOPER/ARCHITECT
Message-Id: <34280EA5.D8F43206@lds.com>
Logical Design Solutions, a leader in the design and development of
Interactive Business Communications has an immediate full-time opening
in their Morristown, NJ office for a Web Architect.
Job Description:
In this visible role, the ideal candidate will possess experience in
configuration of Internet technologies as part of a multi-tiered
information technology architecture. Keeping up-to-date with
current technology trends is essential, as is the ability to evaluate
appropriate technology components for development and delivery
environments. This individual must also have the ability to integrate
application support technologies with preexisting client IT
infrastructure. Experience with C/C++, Perl, HTML, Java, CGI and
knowledge of Internet protocols and standards is required.
Knowledge of Active X a plus.
Send resume with cover letter and salary requirements or contact:
Technical Recruiter
Logical Design Solutions
Phone: (201) 971-0100
Fax: (201) 971-0103
email: recruiter@lds.com
For further info: http://www.lds.com
------------------------------
Date: Tue, 23 Sep 1997 14:52:38 -0600
From: rh@net55.com
To: rh@net55.com
Subject: Where is PerlShop to be found?
Message-Id: <875043368.21577@dejanews.com>
I'd like to obtain PerlShop
but I need a current complete URL?
Can anyone help?
Thanks in advance
Hank
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
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 1065
**************************************