[19611] in Perl-Users-Digest
Perl-Users Digest, Issue: 1806 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 24 14:10:30 2001
Date: Mon, 24 Sep 2001 11:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1001355012-v10-i1806@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 24 Sep 2001 Volume: 10 Number: 1806
Today's topics:
Re: Peek and Poke on Perl? <gamtci1@mpinet.net>
Re: Perl installation hangs (Andy Dougherty)
Re: Perl or not? (Mark Jason Dominus)
Perl-Oracle database connectivity <brian@jankoNOnet.SPAMcom.INVALID>
Re: Please Help with Sockets! nobull@mail.com
PPM <bberube@versus.com>
Re: PPM <simon.oliver@umist.ac.uk>
Re: Setting cookies <mdudley@execonn.com>
Re: Setting cookies (Randal L. Schwartz)
Re: Slicing emptiness (Rafael Garcia-Suarez)
Re: sub key index sorting <swessels@usgn.net>
What do I need for programming Perl (Johnny Tipton)
Re: What do I need for programming Perl <bwalton@rochester.rr.com>
Re: What do I need for programming Perl <rsherman@ce.gatech.edu>
Re: What good is the hyphen for named parameters? <lusol@Pandora.CC.Lehigh.EDU>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 24 Sep 2001 15:39:54 GMT
From: Gary <gamtci1@mpinet.net>
Subject: Re: Peek and Poke on Perl?
Message-Id: <3BAF5394.4BF6@mpinet.net>
OK, I'm assuming my original post wasn't clear enough, sorry.
I am using DOS and Perl without any trouble peeking and poking, (or
reading and writing if you prefer) to an absolute address.
My question is for OSs other than DOS. Is there a Perl module that
anyone knows about which provides absolute address reads and writes
which would function in a protected environment?
I remember we did something similar under Unix about 10 years ago,
and it had something to do with the code being more driver-oriented
and getting Unix to map the 0xe000 space to that "driver". I didn't
work on that aspect so I'm not positive as to what it actually did.
Unfortunately for this situation, I generally stick to the embedded
code, and lack intimate protected-mode OS knowledge.
If there isn't a module (I haven't found one in numerous searches
of CPAN and the web) then I suppose I'll have to take a crack at it.
Any help in this matter would be appreciated. Thanks.
------------------------------
Date: Mon, 24 Sep 2001 15:18:23 -0000
From: doughera@maxwell.phys.lafayette.edu (Andy Dougherty)
Subject: Re: Perl installation hangs
Message-Id: <slrn9qujo5.f46.doughera@maxwell.phys.lafayette.edu>
In article <cbeed4a2.0109201543.7be53a7b@posting.google.com>, R. W. Ennis wrote:
>I'm attempting to install perl5.005_03 (version I have to use) on a
>Solaris 2.6 sparc machine. The installation keeps hanging at "System
>manual is in man/man1." I've installed the same version on another
>Solaris 2.6 machine with no problem. I took a look at Configure and
>saw that after finding the system manual it tries to "see what memory
>models we can support," so I guess that's what's causing the problem.
It's apparently trying to compile & run the pdp11 detection program.
You may safely delete it. Specifically, you can safely change the
line in Configure that reads
( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
to
cp /usr/bin/false pdp11
However, it would probably be a good idea figure out why a call to
'cc' isn't working. Perhaps you don't have a compiler named cc
anywhere? (That's ok, the rest of Configure doesn't assume that, but
it is a bit odd.)
--
Andy Dougherty doughera@lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042
------------------------------
Date: Mon, 24 Sep 2001 15:52:52 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Perl or not?
Message-Id: <3baf56d4.5227$3b@news.op.net>
In article <e3rrqt8m9n2m8s6465ncfdql2si5n9ru68@4ax.com>,
Tom <tom@zerofiveone.nosp@m.com> wrote:
>Perl is good, I love it, but it lacks the speed of compiled programs.
>Anyone got a good alternative?
Compiled programs.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Mon, 24 Sep 2001 16:56:42 GMT
From: "Brian Janko" <brian@jankoNOnet.SPAMcom.INVALID>
Subject: Perl-Oracle database connectivity
Message-Id: <eBJr7.10853$hh.1213542@bin1.nnrp.aus1.giganews.com>
I'm trying to set up Perl-Oracle database connectivity on our servers.
I ran the comman perldoc DBI and found that we had the DBI documentation.
I ran the code below (which I got from a book) on our server and got the
following error message.
" Can't locate loadable object for module DBI in @INC (@INC contains:
/usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .) at
/usr/local/lib/perl5/site_perl/DBI.pm line 180
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/DBI.pm
line 180.
Compilation failed in require at available.pl line 5.
BEGIN failed--compilation aborted at available.pl line 5."
Can someone give me an idea of what's going on here and how I can get this
connectivity happening?
Thanks,
Brian
#!/usr/bin/perl
#available.plx
use warnings;
use strict;
use DBI;
print "Available DBI Drivers and Data Sources:\n\n";
my @drivers=DBI->available drivers('quiet');
my @sources;
foreach my $driver (@drivers)
{
print "$driver\n";
@sources=eval { DBI->data_sources($driver) };
if ($@)
{
print "\tError: ", substr($@,0,60),"\n";
}
elsif (@sources)
{
foreach (@sources)
{
print "\t$_\n";
}
}
else
{
print "\tNo known data sources.\n";
}
}
------------------------------
Date: 24 Sep 2001 17:53:27 +0100
From: nobull@mail.com
Subject: Re: Please Help with Sockets!
Message-Id: <u9d74gwmwo.fsf@wcl-l.bham.ac.uk>
"Raj" <oneconcept@yahoo.co.uk> writes:
> Subject: Please Help with Sockets!
> I've posted to this group before but I didn't get any replies!
Putting "Please Help" in your subject line predisposes people not to
want to help you.
Putting "!" in your subject line predisposes people not to
want help you.
You give no description of what's coming in down the socket.
You give no description of what you were expecting to happen and what
actually happened.
> Can anyone please help me?
"Raj" <oneconcept@yahoo.co.uk> writes:
> while (<S>) {
Random shot in the dark: it may be that the protocol you are
implementing requires that you recognise some sort of end-of-data
signal other than an EOF on the socket.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 24 Sep 2001 11:29:10 -0400
From: "Neb" <bberube@versus.com>
Subject: PPM
Message-Id: <ajIr7.31253$Z2.443015@nnrp1.uunet.ca>
Hi,
is there a way to keep a copy of the installation files of a module
installed with PPM so that if I ever want to re-install it later without
PPM, I can simply unpack it locally ?
thanks,
neb
------------------------------
Date: Mon, 24 Sep 2001 16:46:46 +0100
From: "Simon Oliver" <simon.oliver@umist.ac.uk>
Subject: Re: PPM
Message-Id: <3baf58f6$1@news.umist.ac.uk>
Don't know about automatically keeping a copy (without editing the ppm
script), but you can download the .ppd and tar.gz package files from the
source distribution and store those for later use.
--
Simon Oliver
"Neb" <bberube@versus.com> wrote in message
news:ajIr7.31253$Z2.443015@nnrp1.uunet.ca...
> Hi,
>
> is there a way to keep a copy of the installation files of a module
> installed with PPM so that if I ever want to re-install it later without
> PPM, I can simply unpack it locally ?
>
> thanks,
>
> neb
>
>
>
------------------------------
Date: Mon, 24 Sep 2001 12:33:43 -0400
From: Marshall Dudley <mdudley@execonn.com>
To: "Rob - Rock13.com" <rob_13@excite.com>
Subject: Re: Setting cookies
Message-Id: <3BAF6067.D0639B0A@execonn.com>
Sorry hit the wrong button. This is the code I am using, but the
receiving script does not get the cookie:
sub do_affiliate {
my $path;
my ($affiliate,$total,$subtotal) = @_;
my $chopped;
$affiliate =~ s/http:\/\///i; #remove http://
$affiliate =~ s/https:\/\///i;
if ($affiliate =~ /\//) { #if there is any path information
$affiliate =~ /([\w-]+)(\/.+)/;
$them = $1;
$path = $2;
} else { $them = $affiliate; }
$function = "GET";
$workFile = "$path?total=$total&subtotal=$subtotal";
$versionInfo = "HTTP/1.0\n\n";
$workString = "";
$id = $cookie{'AFFIL'};
#print "ID = $id<br>";
$request = "$function $workFile$workString $versionInfo\nCookie:
\$Version=\"1\"; AFFILIATE=\"$id\";\n\n";
#print "affiliate = $them doing $request<p>";
&do_socket;
}
sub do_socket {
$AF_INET = 2;
$SOCK_STREAM = 1;
$sockaddr = "S n a4 x8";
$port = 80;
$errmsg = "";
($name, $aliases,$proto) = getprotobyname('tcp');
($name, $aliases,$port) = getservbyport($port,'tcp') unless $port
=~/^\d+$/;
($tname, $aliases,$type, $len, $thisaddr) = gethostbyname($hostname);
($name, $aliases,$type, $len,$thataddr) = gethostbyname($them);
#($taddr)=gethostbyname("www.ups.com");
#print "DEBUG: join(".",unpack("C4",$taddr))\n";
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);
eval
{
if (socket(S, $AF_INET, $SOCK_STREAM, $proto) < 0)
{
$raveServer = 0;
return 0;
}
select(S);
$| = 1;
select(STDOUT);
if (bind(S, $this) < 0)
{
$raveServer = 0;
return 0;
}
if (!connect(S, $that))
{
$raveServer = 0;
return 0;
}
};
print S "$request\n";
$resultlist = '';
while (<S>)
{
$resultlist .=$_;
}
close(S);
open (LOG,">affiliate.log");
print LOG "result = $resultlist<p>";
close LOG;
}
1;
"Rob - Rock13.com" wrote:
> Marshall Dudley <news:3BAE11F6.572D172B@execonn.com>:
>
> > I am unable to set a cookie using a perl script. This is the
> > script:
> > print "Set-Cookie: AFFILIATE=$affiliate; ";
> > print "expires=$expdate; " if ($expires);
> > print "domain=www.king-cart.com; "; #works if I
> > leave this line
> > out
> > print "path=/; \n";
> >
> > If I leave out the domain line, it will set cookies fine.
> > Why will Netscape NOT set the cookie when I specify a domain I
> > want the cookie availabe from?
>
> Sounds like, perhaps, NN is rejecting cookies that are not returned
> to the domain they're set from. That is, if you are not testing the
> script when its installed on king-cart.com it will fail.
>
> --
> Rob - http://rock13.com/
> Web Stuff: http://rock13.com/webhelp/
------------------------------
Date: 24 Sep 2001 09:52:35 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Setting cookies
Message-Id: <m1d74gttt8.fsf@halfdome.holdit.com>
>>>>> "Marshall" == Marshall Dudley <mdudley@execonn.com> writes:
Marshall> Sorry hit the wrong button. This is the code I am using,
Marshall> but the receiving script does not get the cookie:
Did you write the code? If not, contact the author for support. If
the author has questions, have him/her post here. This is not a help
desk[0] for end users, especially for third-party (and poorly
written![1]) software.
print "Just another Perl hacker,"
[0] As nobull says:
Get real! This is a discussion group, not a helpdesk. You post
something -- we discuss its implications. If the discussion happens
to answer a question you've asked, that's incidental. If you post a
question that implies that you've got a problem finding answers to
trivial questions in the manual, then it is perfectly reasonable for
us to discuss how to do that.
[1] All that socket code should be replaced with an LWP::UserAgent
fetch, and then the cookie and URL code becomes trivial, and far
easier to debug.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 24 Sep 2001 15:59:15 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Slicing emptiness
Message-Id: <slrn9qum3k.vcm.rgarciasuarez@rafael.kazibao.net>
Anno Siegel wrote in comp.lang.perl.misc:
} Slicing an empry array, as in
}
} # a)
} my @x;
} my @y = @x[ 1, 2, 3];
} print scalar @y, "\n";
}
} yields a list of so many undef's (it prints 3).
From perldata:
A slice of an empty list is still an empty list. Thus:
@a = ()[1,0]; # @a has no elements
@b = (@a)[0,1]; # @b has no elements
@c = (0,1)[2,3]; # @c has no elements
Note the parentheses around @a on the 2d line.
In your example, @x gets modified (autovivification of elements).
} Doing the same with an
} empty list
}
} # b)
} @y = ()[ 1, 2, 3];
} print scalar @y, "\n";
}
} leaves @y empty (prints 0).
}
} When the list contains at least one element, the behavior changes
}
} # c)
} @y = ( 'wawa')[ 1, 2, 3];
} print scalar @y, "\n";
}
} prints 3 again.
}
} I think the behavior in b) is a bug.
According to the docs, b) is correct and the behavior you get for c) is
a bug. I can't reproduce it.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Mon, 24 Sep 2001 16:26:04 GMT
From: "Scott Wessels" <swessels@usgn.net>
Subject: Re: sub key index sorting
Message-Id: <w8Jr7.53846$aZ6.13299292@news1.rdc1.az.home.com>
> Well, you might check it on various platforms before you make
> conclusions about the algorithms, as on my computer, the ref method won:
I did actually, win98se, 600MHZ P3, 512MB -
C:\work>perl test.pl
Benchmark: timing 5 iterations of ref, simple, sprintf...
ref: 41 wallclock secs (41.14 usr + 0.00 sys = 41.14 CPU) @ 0.12/s
(n=5)
simple: 49 wallclock secs (49.22 usr + 0.00 sys = 49.22 CPU) @ 0.10/s
(n=5)
sprintf: 29 wallclock secs (29.33 usr + 0.00 sys = 29.33 CPU) @ 0.17/s
(n=5)
s/iter simple ref sprintf
simple 9.84 -- -16% -40%
ref 8.23 20% -- -29%
sprintf 5.87 68% 40% --
C:\work>perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 629 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 12:27:04 Aug 20 2001
and as for FreeBSD 3.5, 2 X 600MHZ P3, 256MB -
root@opm -- /var/work > perl test.pl
Benchmark: timing 5 iterations of ref, simple, sprintf...
ref: 35 wallclock secs (33.61 usr + 1.41 sys = 35.02 CPU) @ 0.14/s
(n=5)
simple: 42 wallclock secs (42.11 usr + 0.02 sys = 42.13 CPU) @ 0.12/s
(n=5)
sprintf: 17 wallclock secs (15.23 usr + 0.02 sys = 15.24 CPU) @ 0.33/s
(n=5)
s/iter simple ref sprintf sprintf2
simple 8.43 -- -17% -64% -69%
ref 7.00 20% -- -56% -62%
sprintf 3.05 176% 130% -- -13%
root@opm -- /var/work > perl -v
This is perl, v5.6.1 built for i386-freebsd
Copyright 1987-2001, Larry Wall
------------------------------
Date: 24 Sep 2001 08:54:50 -0700
From: johnbtipton@hotmail.com (Johnny Tipton)
Subject: What do I need for programming Perl
Message-Id: <eb65a3a6.0109240754.6638f960@posting.google.com>
I'm a newbie to Perl. I, normally, use Javascript, ASP, and VB. I need
to learn Perl for my job. What all do I need to run a program from my
desktop (compiler, editor, books, etc)? Anything that will be to my
advantage. Thanks for any help.
------------------------------
Date: Mon, 24 Sep 2001 16:26:51 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: What do I need for programming Perl
Message-Id: <3BAF5DF8.BAF4A0BB@rochester.rr.com>
Johnny Tipton wrote:
>
> I'm a newbie to Perl. I, normally, use Javascript, ASP, and VB. I need
> to learn Perl for my job. What all do I need to run a program from my
> desktop (compiler, editor, books, etc)? Anything that will be to my
> advantage. Thanks for any help.
Books: Learning Perl
Programming Perl
Don't mess around with other books yet; those are the gems.
Software: Depends on platform. If Windoze, http://www.activestate.com
. If Linux, Perl probably came with your Linux distribution, or is
available as a package from your Linux distribution vendor. If Unix or
Unix-like, http://www.perl.com . Others, I don't know, but
http://www.perl.com is an excellent starting point.
http://www.perldoc.com is also excellent.
Editor: I like VIM, but any text editor will do. I recommend you do
not use the various IDE's for Perl, as they usually just add buggy stuff
to the mix.
Once you have Perl, do:
perldoc perldoc
perldoc perl
at a command prompt, and move on from there. A huge wealth of
documentation comes with a Perl installation. Don't forget to read the
faq's before posting! Enjoy.
--
Bob Walton
------------------------------
Date: Mon, 24 Sep 2001 12:25:50 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: What do I need for programming Perl
Message-Id: <3BAEDFFE.747F4144@ce.gatech.edu>
Johnny Tipton wrote:
>
> I'm a newbie to Perl. I, normally, use Javascript, ASP, and VB. I need
> to learn Perl for my job. What all do I need to run a program from my
> desktop (compiler, editor, books, etc)? Anything that will be to my
> advantage. Thanks for any help.
first you need perl...if you are on a *nix box, you probably already
have it (try perl -v). if you are using windows, go to
www.activestate.com and grab it.
get a good book (or several). Programming Perl from O'Reilly is the perl
bible. for the moment, though, something like Learning Perl (also
O'Reilly) may be more useful.
check out:
www.perl.com
www.perlmonks.org
www.cpan.org
--
robert sherman
css, cee
georgia institute of technology
atlanta, ga, usa
------------------------------
Date: 24 Sep 2001 14:39:34 GMT
From: "Stephen O. Lidie" <lusol@Pandora.CC.Lehigh.EDU>
Subject: Re: What good is the hyphen for named parameters?
Message-Id: <9ongj6$fqk@fidoii.CC.Lehigh.EDU>
Ilya Martynov <ilya@martynov.org> wrote:
>>>>>> On Mon, 24 Sep 2001 07:53:45 -0500, Michael Carman <mjcarman@home.com> said:
> MC> Bart Lateur wrote:
>>>
>>> I don't see the point for using hyphens for "named parameters"
>>> for subroutines. Although it doesn't prevent bareword quoting on
>>> the left side of a "=>", it doesn't appear to add anything else.
>>> So what are they good for?
> MC> My feeling has always been that it's a carryover from working in the
> MC> shell. It makes named parameters look more like command line switches.
> MC> On the other hand, maybe it goes back to when buitins wouldn't
> MC> autoquote. Was there ever a time when '-time => 1' would parse nicely
> MC> but 'time => 1' wouldn't?
> My feeling is that it was borrowed from Tk. I never wrote single line
> for it but I've noticed several time hyphen used for named params in
> Tk programs.
Which, of course, came from Tcl, which uses this scheme, which, indeed,
is patterned of the various shells. -option also turns on Perl's auto-quoting
mechanism, which reduces the use of quotes. Plus, the hypens make it
very obvious what is an option and what is the option's value.
Steve
--
@_=map{eval"100${_}"}split/!/,'/5!*2!+$]!/10+$]';use Tk;$m=tkinit;$t='just an'.
'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
z(@_[2,3],-te,$t,-fi,'gray50');$c->$z($_[2]-$],$_[3]-$],-te,$t);$m->bind('<En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1806
***************************************