[22947] in Perl-Users-Digest
Perl-Users Digest, Issue: 5167 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 2 11:06:02 2003
Date: Wed, 2 Jul 2003 08:05:10 -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 Wed, 2 Jul 2003 Volume: 10 Number: 5167
Today's topics:
"Word too long" ? And exactly WHAT word might that be? (Sara)
Re: "Word too long" ? And exactly WHAT word might that news@roaima.freeserve.co.uk
Alternative to use vars (Himal)
Re: Alternative to use vars (Greg Bacon)
Re: Automatic page forwarding in cgi perl script (Max)
Re: Automatic page forwarding in cgi perl script (Max)
Re: Automatic page forwarding in cgi perl script (Max)
Re: Automatic page forwarding in cgi perl script (Max)
Re: Automatic page forwarding in cgi perl script <asu1@c-o-r-n-e-l-l.edu>
Re: Devel::Coverage (Himal)
Re: doing 'ref' on blessed reference (Tad McClellan)
Re: doing 'ref' on blessed reference <abigail@abigail.nl>
Re: doing 'ref' on blessed reference <ubl@schaffhausen.de>
Re: executing "DB2 load command" from perl return error (Kenjis Kaan)
Re: executing "DB2 load command" from perl return error <badamache@yahootoomuchspam.com>
Re: fork, childs, zombies, start a process in the backg (Greg Bacon)
Re: funny printf behaviour in need of explanation (Greg Bacon)
installing perl modules via ftp (me)
Re: installing perl modules via ftp <asu1@c-o-r-n-e-l-l.edu>
Re: need assistance understanding multilevel hashes. <allen.wooden@educate.invalid>
Need help with Win32::GuiTest and Indigo perl <awingnut@hotmail.com>
Need Perl teacher/school: Network programming <irving_kimura@lycos.com>
Re: Need Perl teacher/school: Network programming <glex_nospam@qwest.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Jul 2003 06:18:09 -0700
From: genericax@hotmail.com (Sara)
Subject: "Word too long" ? And exactly WHAT word might that be? Curious
Message-Id: <776e0325.0307020518.2e428903@posting.google.com>
I have a script that runs fine, but on invocation in csh or bash or
tcsh or ksh, the script reports:
Word too long
before a single line is executed (I'm starting in the debugger). Other
than that message everything seems fine.
I searched CLPM and in fact saw others report this message, but in
each case they got the message after executing the script on a certain
line. In my case it comes up before execution. There is no line number
or other info reported- just "word too long"..
Can someone advise me on HOW to actually FIND the offending word? With
like 25,000 lines of Perl it's not going to be easy doing a manual
search, particularly when I don't even know what constitutes a "too
long" word!
Thanks,
Gx
------------------------------
Date: Wed, 2 Jul 2003 15:13:08 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: "Word too long" ? And exactly WHAT word might that be? Curious
Message-Id: <ks5bt-s7q.ln1@moldev.cmagroup.co.uk>
Sara <genericax@hotmail.com> wrote:
> I have a script that runs fine, but on invocation in csh or bash or
> tcsh or ksh, the script reports:
> Word too long
> before a single line is executed
How can it be that it "runs fine" if it reports an unexpected error? This
sounds suspiciously like your shell is trying to run a perl script
instead of passing it over to perl.
What are the first few lines of your program? (Copy and paste them. DON'T
retype them by hand.)
Chris
--
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}
------------------------------
Date: 2 Jul 2003 05:49:36 -0700
From: himal5@hotmail.com (Himal)
Subject: Alternative to use vars
Message-Id: <365e1935.0307020449.7c4c16e9@posting.google.com>
I am using
use vars qw ($scalar @array %hash);
in my program. I would like to know how to declare this in an
alternative way using our and EXPORT. I am not able to grasp what the
reference says about it.
Cheers,
Himal.
------------------------------
Date: Wed, 02 Jul 2003 13:14:50 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Alternative to use vars
Message-Id: <vg5mmas61oi489@corp.supernews.com>
In article <365e1935.0307020449.7c4c16e9@posting.google.com>,
Himal <himal5@hotmail.com> wrote:
: I am using
: use vars qw ($scalar @array %hash);
: in my program. I would like to know how to declare this in an
: alternative way using our and EXPORT. I am not able to grasp what the
: reference says about it.
If you don't want to use the vars pragma, you could fully qualify
your values as in
$pkg::scalar = 3;
@pkg::array = qw/ apples oranges bananas /;
%pkg::hash = ();
where 'pkg' is the name of the package you want your variables to call
home. If you want the main package, you can abbreviate to $::scalar,
for example.
You can also declare the globals with our:
our $scalar;
our @array;
our %hash;
See the perlfunc documentation on our for details.
Hope this helps,
Greg
--
Arrogance is bliss.
-- Elizabeth L. Kaminsky
------------------------------
Date: 2 Jul 2003 06:28:29 -0700
From: maximuszen@optonline.net (Max)
Subject: Re: Automatic page forwarding in cgi perl script
Message-Id: <3a9c1232.0307020528.2643c250@posting.google.com>
wow, the sarcasm...
what i want to do is forward to another page. i thought it was pretty obvious.
thanks for all your help.
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message news:<NRqMa.68$C43.41@nwrddc04.gnilink.net>...
> Max wrote:
> > print ("Location:
> > http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html\n\n");
> >
> > Why won't this work?
>
> Works just fine for me.
> It prints the text
> Location:
> http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html
>
> to STDOUT. Did you expect it to do anything else?
>
> jue
------------------------------
Date: 2 Jul 2003 06:41:42 -0700
From: maximuszen@optonline.net (Max)
Subject: Re: Automatic page forwarding in cgi perl script
Message-Id: <3a9c1232.0307020541.70ef97e5@posting.google.com>
wanted to add that i am not expecting every user to have these files.
i am testing the pages on my machine only. i thought this was obvious
from the meaning of "localhost"
"A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote in message news:<Xns93ABB63653289asu1cornelledu@132.236.56.8>...
> maximuszen@optonline.net (Max) wrote in
> news:3a9c1232.0307011216.d004957@posting.google.com:
>
> > print ("Location:
> > http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html\n\n");
> >
> > Why won't this work?
>
> Questions related to CGI but not Perl are better asked elsewhere, for
> example comp.infosystems.www.authoring.cgi.
>
> "Won't work" gives no information about the nature of your problem.
>
> Have you looked at the topic "A reference to another document" in section
> "How do I send my document back to the client?" available at:
>
> http://hoohoo.ncsa.uiuc.edu/cgi/primer.html
>
> What makes you think every user who runs this CGI program has a web
> server running, and also has the document
>
> /ElectronicMedicalRecord/OrderEntry/Orders.html
>
> exists on that machine?
>
> Sinan.
------------------------------
Date: 2 Jul 2003 06:43:46 -0700
From: maximuszen@optonline.net (Max)
Subject: Re: Automatic page forwarding in cgi perl script
Message-Id: <3a9c1232.0307020543.272cc9d4@posting.google.com>
thanks, i am awed by your brillant logic by analogy.
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in message news:<Xns93ABC301740D7sdn.comcast@206.127.4.25>...
> maximuszen@optonline.net (Max) wrote in
> news:3a9c1232.0307011216.d004957@posting.google.com:
>
> > print ("Location:
> > http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html\n\n");
> >
> > Why won't this work?
>
> My car is a blue '95 Subaru with four doors.
>
> Why won't it start?
------------------------------
Date: 2 Jul 2003 06:44:56 -0700
From: maximuszen@optonline.net (Max)
Subject: Re: Automatic page forwarding in cgi perl script
Message-Id: <3a9c1232.0307020544.c6c1635@posting.google.com>
of course not... reading sometimes helps(like the subject line...) but
i have to admit your wit is brillant. i wish i had it.
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message news:<NRqMa.68$C43.41@nwrddc04.gnilink.net>...
> Max wrote:
> > print ("Location:
> > http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html\n\n");
> >
> > Why won't this work?
>
> Works just fine for me.
> It prints the text
> Location:
> http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html
>
> to STDOUT. Did you expect it to do anything else?
>
> jue
------------------------------
Date: 2 Jul 2003 14:36:57 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Automatic page forwarding in cgi perl script
Message-Id: <Xns93AC6BFDB7AE7asu1cornelledu@132.236.56.8>
maximuszen@optonline.net (Max) wrote in
news:3a9c1232.0307020528.2643c250@posting.google.com:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:<NRqMa.68$C43.41@nwrddc04.gnilink.net>...
>> Max wrote:
>> > print ("Location:
>> > http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html\n\n"
>> > );
>> >
>> > Why won't this work?
>>
>> Works just fine for me.
>> It prints the text
>> Location:
>> http://localhost/ElectronicMedicalRecord/OrderEntry/Orders.html
>>
>> to STDOUT. Did you expect it to do anything else?
>
> wow, the sarcasm...
>
> what i want to do is forward to another page. i thought it was pretty
> obvious.
Nothing is obvious. You posted a line of code that does precisely what you
asked it to do (print the text you specified) without describing a lot of
pertinent details. You also posted to the wrong group ... From what I can
understand, your problems are due to the fact that you are not sending a
content type line. This is a CGI programming error, and has nothing to do
with Perl.
You can't get good answers without putting some effort into formulating
your question. The posting guidelines for this group might help learn how:
http://mail.augustmail.com/~tadmc/clpmisc.shtml
Sinan.
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: 2 Jul 2003 05:47:17 -0700
From: himal5@hotmail.com (Himal)
Subject: Re: Devel::Coverage
Message-Id: <365e1935.0307020447.57c48e88@posting.google.com>
Well it was my error in using Devel::Coverage that was giving me
problems.
I have downloaded Devel-Coverage-0.2.gz from CPAN and the README in it
explains it rather simply how to go about it.
There do seem to be an issue using it with perl 5.8.0.
Cheers,
Himal.
himal5@hotmail.com (Himal) wrote in message news:<365e1935.0307010656.8378c1d@posting.google.com>...
> Hi all,
> I am new to using Perl and am trying to do some coverage analysis.
> When I do
> perl -d:Coverage temp.pl
> I get Cant locate Devel/Coverage.pm. What should I do for this.
>
> Also do I alway have to do
> perl -d:Coverage temp.pl
> to get/update the .cvp file.
>
> Thanks for any input.
> himal.
------------------------------
Date: Wed, 2 Jul 2003 07:40:45 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: doing 'ref' on blessed reference
Message-Id: <slrnbg5kmd.2l7.tadmc@magna.augustmail.com>
Michael <no@spam.net> wrote:
> Is this a joke?
This isn't:
*plonk*
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 02 Jul 2003 14:15:47 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: doing 'ref' on blessed reference
Message-Id: <slrnbg5q8j.m6a.abigail@alexandra.abigail.nl>
Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMMDXCI September
MCMXCIII in <URL:news:slrnbg224d.3er.mgjv@verbruggen.comdyn.com.au>:
~~ On Tue, 01 Jul 2003 02:01:48 GMT,
~~ JT <woland99@earthlink.net> wrote:
~~ > If we do 'ref' on blessed reference it return string that is the name of
~~ > the class
~~ > but how can I know if this was a hash, array or sth else? Is there a way to
~~ > return ARRAY, HASH or SCALAR for blessed reference?
~~
~~ First of all: Why do you think you need to know? One of the main
~~ advantages of OO programming is the encapsulation of the
~~ implementationof the object, internally. Outside the class, or one of
~~ its subclasses, you should not care what the implementation is.
~~ Whenever you find yourself wondering whether you should know something
~~ about the internal implementation of a class, you should think really
~~ hard about whether you should be asking a different question.
Oh, come on! The majority of the Perl classes that subclass something
depends on the implementation of the superclass, and will break if it
changes. About 99% of the inheriting classes assume the class they are
inheriting uses a hashref to implement the object.
I agree with you that the main advantage of OO programming is
encapsulation. But Perl's support for encapsulation is almost
non-existant. Any introduction text on OO program I've encountered,
whether that's part of the Perl main distribution, a book about Perl, or
an article on Perlmonks or so other forum will use hashrefs to implement
objects, and throw away encapsulation from the start.
There's a gigantic difference between theory and practise.
Abigail
--
END {print "Hacker\n"}
BEGIN {print "Just " }
CHECK {print "another "}
INIT {print "Perl " }
------------------------------
Date: Wed, 02 Jul 2003 16:50:04 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: doing 'ref' on blessed reference
Message-Id: <bduuj4$3vc$1@news.dtag.de>
Abigail wrote:
> Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMMDXCI September
> MCMXCIII in <URL:news:slrnbg224d.3er.mgjv@verbruggen.comdyn.com.au>:
> ~~ On Tue, 01 Jul 2003 02:01:48 GMT,
> ~~ JT <woland99@earthlink.net> wrote:
> ~~ > If we do 'ref' on blessed reference it return string that is the name of
> ~~ > the class
> ~~ > but how can I know if this was a hash, array or sth else? Is there a way to
> ~~ > return ARRAY, HASH or SCALAR for blessed reference?
> ~~
> ~~ First of all: Why do you think you need to know? One of the main
> ~~ advantages of OO programming is the encapsulation of the
> ~~ implementationof the object, internally. Outside the class, or one of
> ~~ its subclasses, you should not care what the implementation is.
> ~~ Whenever you find yourself wondering whether you should know something
> ~~ about the internal implementation of a class, you should think really
> ~~ hard about whether you should be asking a different question.
>
> Oh, come on! The majority of the Perl classes that subclass something
> depends on the implementation of the superclass, and will break if it
> changes. About 99% of the inheriting classes assume the class they are
> inheriting uses a hashref to implement the object.
On the other hand, if you consider the object being a hashref part of
the interface (as opposed to purely a part of the implementation) which
is theoratically always the case if you are using a hashref as the basis
of an object, you should overload %{} when you change your
implementation so that your interface stays the same.
malte
--
srand 108641088; print chr int rand 256 for qw<J A P H>
------------------------------
Date: 2 Jul 2003 06:24:06 -0700
From: tivolinewbie@canada.com (Kenjis Kaan)
Subject: Re: executing "DB2 load command" from perl return errors
Message-Id: <6a8ba9f8.0307020524.68a8a02@posting.google.com>
"Ian D. Bjorhovde" <ianbjor@mobileaudio.com> wrote in message news:<Pine.LNX.4.44.0307012324080.24192-100000@sidi.phx.dataproxy.com>...
> On 1 Jul 2003, Kenjis Kaan wrote:
>
> > Stats: Perl 5.6.1 on Win2k, DB2 Universal Personal on Win2k (same
> > machine)
> >
> > I have a perl program that tries to execute the DB2 load command in
> > order to import a bunch of rows of data into a DB2 table. This
> > command runs fine from the DB2 (DB2 CLP -db2) command line processor
> > ie. db2=>
> > However when I tried to use it inside Perl I got an error. And I
> > can't seem to understand why. I hope someone here can help me out.
> > Here is an exerpt of the program code that is doing this.
> >
> > -----exerpt---------------------------------------------------------------
> >
> > my $stLd = "load from E:/var/Reports/thesum.dat of del modified by
> > coldel| in
> > sert into RptData (NODE_NAME,PACKAGE_NAME,START_TIME,END_TIME,OPERATION,STATUS,L
> > OGCNT,CCMCNT,REMCNT,FCCMCNT,FREMCNT,INSTSRC,INSTALLER,ERRCODE,ERRDESC,SRCDIR,ADM
> > INFLG,LOGONUSR,SILENTINST,CISCUSTFL)";
> >
> > my $sth1 = $dbh->prepare($stLd);
> > $sth1->execute;
>
> LOAD is not an SQL statement, it is a command. Therefore it can't be
> executed via DBI (or JDBC, ODBC, etc). You need to execute it using
> either the system() call in perl or by opening the command and reading
> from the pipe, e.g.,
>
> open(LOAD, "db2 load from ... |");
>
> Or write a perl XS module that calls the sqluload() API! ;-)
>
>
> Good luck,
I see what you mean now. This is bad! from the solution that I have
available that is. I wonder if there is another way around what I
need to do. Your suggestions above is fine if the database is on the
same machine where I am running. Exception when in production the
perl script is on one machine and the database on another one. As far
as I know your solution assume the database is also on the same
machine. That being said, anyone know of a solution for this problem?
I need to upload a bunch of load data in a file to a DB2 machine where
data resides. And somehow tell that machine to load the data. Is
there a remote DB2 sql command one can invoke to execute the load
command? Perhaps a trigger?
------------------------------
Date: Wed, 02 Jul 2003 10:17:22 -0400
From: Blair Kenneth Adamache <badamache@yahootoomuchspam.com>
Subject: Re: executing "DB2 load command" from perl return errors
Message-Id: <3F02E972.F5DFE20A@yahootoomuchspam.com>
You can call DB2's highspeed LOAD through the Call Level Interface in DB2
Version 8. See the section "Importing Data with the CLI Load Utility in
CLI Applications" in the v8 Call Level Interface Guide, Chapter 7:
"Ian D. Bjorhovde" wrote:
> On 1 Jul 2003, Kenjis Kaan wrote:
>
> > Stats: Perl 5.6.1 on Win2k, DB2 Universal Personal on Win2k (same
> > machine)
> >
> > I have a perl program that tries to execute the DB2 load command in
> > order to import a bunch of rows of data into a DB2 table. This
> > command runs fine from the DB2 (DB2 CLP -db2) command line processor
> > ie. db2=>
> > However when I tried to use it inside Perl I got an error. And I
> > can't seem to understand why. I hope someone here can help me out.
> > Here is an exerpt of the program code that is doing this.
> >
> > -----exerpt---------------------------------------------------------------
> >
> > my $stLd = "load from E:/var/Reports/thesum.dat of del modified by
> > coldel| in
> > sert into RptData (NODE_NAME,PACKAGE_NAME,START_TIME,END_TIME,OPERATION,STATUS,L
> > OGCNT,CCMCNT,REMCNT,FCCMCNT,FREMCNT,INSTSRC,INSTALLER,ERRCODE,ERRDESC,SRCDIR,ADM
> > INFLG,LOGONUSR,SILENTINST,CISCUSTFL)";
> >
> > my $sth1 = $dbh->prepare($stLd);
> > $sth1->execute;
>
> LOAD is not an SQL statement, it is a command. Therefore it can't be
> executed via DBI (or JDBC, ODBC, etc). You need to execute it using
> either the system() call in perl or by opening the command and reading
> from the pipe, e.g.,
>
> open(LOAD, "db2 load from ... |");
>
> Or write a perl XS module that calls the sqluload() API! ;-)
>
> Good luck,
>
> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----== Over 80,000 Newsgroups - 16 Different Servers! =-----
------------------------------
Date: Wed, 02 Jul 2003 12:41:20 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: fork, childs, zombies, start a process in the background without waiting for it
Message-Id: <vg5kngke8kos87@corp.supernews.com>
In article <c70a85ff.0307020043.5034b5db@posting.google.com>,
Rex Gustavus Adolphus <uffesterner@spamhole.com> wrote:
: Thanks Greg!
Glad to help.
: But I'm sorry I don't understand if your answer means that the
: fork-logic code I provided above is OK, so the parent doesn't have to
: wait for the childs to avoid zombies?
: Could you please clarify?
Assuming your platform exhibits that behavior, i.e., autoreaping
kids when you ignore SIGCHLD.
: I like this to be as portable as possible so I'm a bit wary of the
: 'most' in 'On most Unix platforms...'
: (On the Linux i tried, it said 'Can't ignore signal CHLD, forcing to
: default.')
If you want portability, good ol' double-fork is the way to go.
Greg
--
FDR ran on a platform of cutting expenditures by 25 percent, ending deficits,
reducing federal salaries, assuring a sound currency, protecting states
rights, and keeping the peace. And when he governed, he did exactly the
opposite. -- Lew Rockwell
------------------------------
Date: Wed, 02 Jul 2003 13:10:23 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: funny printf behaviour in need of explanation
Message-Id: <vg5mdvhg7rv752@corp.supernews.com>
In article <8ebf3385.0307010520.5ff0e1e4@posting.google.com>,
Dov Levenglick <stam_doar@hotmail.com> wrote:
: [...]
:
: i am aware that $a reaches the value of 0 only after many divisions by
: 256 (since divisions are in floating point context) and therefore
: $result reaches Infinity (hence ffffffff), my question is how and why
: does the printf change the context of $a from floating point to
: integer.
When I see seemingly strange internal behavior, I like to use
Devel::Peek, so consider the following modification to your code:
#! /usr/local/bin/perl
use Devel::Peek;
$doprintf = 1 if @ARGV && $ARGV[0] eq '--printf';
my $a = 0x12345678;
$b = &big_endian($a);
printf ("Result: %x %x\n",$a,$b);
Dump $b;
sub big_endian {
my $data = shift;
my $result = 0;
Dump $result;
my $yet = 0;
while ($data) {
$result *= 256;
$result += $data%256;
$data /= 256;
printf "big_endian: %x %x\n",$data,$result if $doprintf;
Dump $result if not $yet++;
} return ($result);
}
Without the printf, we see the following output:
% ./try
SV = IV(0x140041148) at 0x140065fc8
REFCNT = 1
FLAGS = (PADBUSY,PADMY,IOK,pIOK,IsUV)
UV = 0
SV = PVNV(0x140065978) at 0x140065fc8
REFCNT = 1
FLAGS = (PADBUSY,PADMY,NOK,pNOK)
IV = 0
NV = 120
PV = 0
Result: 12345678 ffffffffffffffff
SV = PVNV(0x140065a40) at 0x140053788
REFCNT = 1
FLAGS = (IOK,NOK,pIOK,pNOK,IsUV)
UV = 18446744073709551615
NV = INF
PV = 0
The first dump is before the printf and the second after. Take careful
not of the flags: IOK means it's ok to use the SV's (perl's internal
represenation of a scalar) as an integer, and UV is the unsigned value
currently stored in $result (my $result = 0).
In the second dump, perl has promoted $result to an NV, which holds
(among other things) a double. Keep in mind that this dump is after the
first iteration, so the UV is correct, i.e., 0x12345678 % 256.
In the final printf, you see fff... because printf's %x conversion
goes hunting for an unsigned integer, so it plucks the UV.
Now let's use the printf:
% ./try --printf
SV = IV(0x140041150) at 0x140065fe8
REFCNT = 1
FLAGS = (PADBUSY,PADMY,IOK,pIOK,IsUV)
UV = 0
big_endian: 123456 78
SV = PVNV(0x140065978) at 0x140065fe8
REFCNT = 1
FLAGS = (PADBUSY,PADMY,IOK,NOK,pIOK,pNOK,IsUV)
UV = 120
NV = 120
PV = 0
big_endian: 1234 7856
big_endian: 12 785634
big_endian: 0 78563412
Result: 12345678 78563412
SV = PVNV(0x140065a40) at 0x140053798
REFCNT = 1
FLAGS = (IOK,NOK,pIOK,pNOK,IsUV)
UV = 2018915346
NV = 2018915346
PV = 0
Using the printf (which has plucked a UV from the SV) has hinted to
perl that it should constrain $result the way it did.
The DWIM (Do What I Mean) philosophy runs strong in perl, but that means
using heuristics, which can sometimes produce surprising results. As
mjd wrote, "Of course, this is a heuristic, which is a fancy way of
saying that it doesn't work."
Hope this helps,
Greg
--
It is error alone which needs the support of government. Truth can
stand by itself.
-- Thomas Jefferson
------------------------------
Date: 2 Jul 2003 09:34:05 -0500
From: me@me.com (me)
Subject: installing perl modules via ftp
Message-Id: <3f02ed5d_7@corp.newsgroups.com>
My Web host won't install the WebDB::Session module from Paul DuBois's Book
MySQL and Perl for the Web, but told me I could install it to my account
locally.
Does anyone have a clue how? As it is, I install Perl scripts to a CGI-BIN
folder via FTP. HELP!
Thanks.
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
------------------------------
Date: 2 Jul 2003 15:04:06 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: installing perl modules via ftp
Message-Id: <Xns93AC7098C23CAasu1cornelledu@132.236.56.8>
me@me.com (me) wrote in news:3f02ed5d_7@corp.newsgroups.com:
> My Web host won't install the WebDB::Session module from Paul DuBois's
> Book MySQL and Perl for the Web, but told me I could install it to my
> account locally.
>
> Does anyone have a clue how? As it is, I install Perl scripts to a
> CGI-BIN folder via FTP. HELP!
You can put the modules you would like to use in a directory, for
example,
/home/mysite/lib
and then put a line with:
use lib '/home/mysite/lib';
in your script. You need to replace /home/mysite with the complete path
to whereever you put your stuff on the host. You also need to preserve
the directory structure for modules you put there. For example, the
module you mentioned would be installed as
/home/mysite/lib/WebDB/Session.pm
For more information, take a look at perldoc -q lib
Sinan.
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: Wed, 02 Jul 2003 12:43:55 GMT
From: Allen Wooden <allen.wooden@educate.invalid>
Subject: Re: need assistance understanding multilevel hashes.
Message-Id: <oti5gv4kdbp9jp8t624deb3t3q0hjllg2b@4ax.com>
On Fri, 27 Jun 2003 22:16:39 GMT, tiltonj@erols.com (Jay Tilton)
wrote:
>Posting entire programs is seldom necessary, and even less often
>desirable. Reducing code to the barest minimum necessary to
>demonstrate the problem eases comprehension of the problem and its
>solution.
I'll try and remember that.. :)
>
>Slightly more intrusive but also more scalable is to create a hash of
>anonymous hashes directly.
>
> our %customers = (
> customer1 => { "ports" => 2, ... },
> customer2 => { "ports" => 3, ... },
> # etc.
> );
So unwind the existing hashes in the config file and dump them into
another hash? I tried this and while the hashes exist and I can see
the data in it, I'm still having difficulty getting the customer
entered on the commandline to match up to the correct hash.
config:
%foo = ( "ports" => "1", "rrd0" => 'some_path', "rate" => "0", "tag"
=> 'Foo Co.', "page_num" => "1" );
pull the contents of config into array.
then loop through the array and break out the key/value pairs and dump
them into the new hash.
$hash{$who}{$keys} = $values;
## $who is the hash name from the config file.
## $keys are the keys from the hash in config file.
## $values are the values of the keys.
I can access all the data
for $b ( keys %hash) {
print "customers are: $b\n";
for $c (keys %{ $hash{$b}}) {
print "$c=$hash{$b}{$c}";
}
print "\n";
>
>For either case, instead of saying
>
> if ( $custid =~ /^customer1$/ ) { %custid = %customer1; }
> if ( $custid =~ /^customer2$/ ) { %custid = %customer2; }
>
>you would say
>
> my %custid = %{ $customers{$custid} };
>
$cust = ARGV[0];
%hash1 = %{ $hash{$cust} };
Now this should copy the data in from $hash{<customer-id>} into a new
hash but instead I don't get jack. But I can loop through %hash and
print out all the keys,values but if I try it with %hash1, I get
"Use of unitialized value in hash dereference at line blah blah.. "
Which just so happens to be where the data should be assiged to the
new hash. ie: %hash1 = %{ $hash{$cust} };
if I enter foo on commanline, I should be able to access
$hash1{foo}{"ports"} and get the value.
I think I'm either misunderstanding something or doing it the wrong
way.
I have a much smaller example prog if your interested.
Thanks btw for all your help.
Allen
Replace invalid with com to reply via email.
PGP key available @ keyserver.pgp.com
------------------------------
Date: Wed, 02 Jul 2003 08:59:56 -0400
From: gw1500se <awingnut@hotmail.com>
Subject: Need help with Win32::GuiTest and Indigo perl
Message-Id: <dgl5gv814rch7dr4ec80jdjajiksomv7gd@4ax.com>
I need some help with a problem running Win32::GuiTest and Indigo
perl. I installed the package using IPM and there were no errors.
However, the statement "use Win32::GuiTest;" get the following error:
Can't load 'C:/OpenSA/perl/site/lib/auto/Win32/GuiTest/GuiTest.dll'
for module Win32::GuiTest: load_file:One of the library files needed
to run this application cannot be found at
C:/OpenSA/perl/lib/DynaLoader.pm line 229.
The path and file are correct and do exist. Can someone help me figure
out why it will not load the library. TIA.
------------------------------
Date: Wed, 2 Jul 2003 11:50:56 +0000 (UTC)
From: Irving Kimura <irving_kimura@lycos.com>
Subject: Need Perl teacher/school: Network programming
Message-Id: <bdugv0$ksn$1@reader1.panix.com>
For months (actually years) I have been trying to learn how to
write a Perl proxy that can do the following: intercept *all* HTTP
and HTTPS traffic to and from my browser, and write all of it to
a log file, decoding and encoding the HTTPS stuff as necessary so
that all the logged text is intelligible. The proxy must be able
to handle redirection, pop-ups, frames, and any other tricks the
browser and server may be up to.
I have looked everywhere for help with this; I have consulted every
Perl book I know, I have asked every Perl programmer I know, and
posted in every Perl forum I know. I have found that Perl programmers
fall in two sets: the ones that don't know how to do this (I am in
this set), and those for whom it is so obvious and trivial that
asking them how to do it is like asking someone to explain to you
how to swallow. "What do you mean how to swallow? Just...
swallow!!!"
I have to conclude that the problem is difficult enough that its
solution cannot be readily explained to someone who doesn't already
know how to solve it. Hence I need a teacher: someone I will *pay*
to explain to me how to do this. Or better yet, someone who will
write the proxy for me, with enough comments that I will be able
to understand it completely.
Where? Who? How much?
Thanks!
-Irv
------------------------------
Date: Wed, 02 Jul 2003 09:55:03 -0500
From: "J. Gleixner" <glex_nospam@qwest.net>
Subject: Re: Need Perl teacher/school: Network programming
Message-Id: <FmCMa.288$yw3.20063@news.uswest.net>
Irving Kimura wrote:
> For months (actually years) I have been trying to learn how to
> write a Perl proxy that can do the following: intercept *all* HTTP
> and HTTPS traffic to and from my browser, and write all of it to
> a log file, decoding and encoding the HTTPS stuff as necessary so
> that all the logged text is intelligible. The proxy must be able
> to handle redirection, pop-ups, frames, and any other tricks the
> browser and server may be up to.
>
> I have looked everywhere for help with this; I have consulted every
> Perl book I know, I have asked every Perl programmer I know, and
> posted in every Perl forum I know. I have found that Perl programmers
> fall in two sets: the ones that don't know how to do this (I am in
> this set), and those for whom it is so obvious and trivial that
> asking them how to do it is like asking someone to explain to you
> how to swallow. "What do you mean how to swallow? Just...
> swallow!!!"
>
> I have to conclude that the problem is difficult enough that its
> solution cannot be readily explained to someone who doesn't already
> know how to solve it. Hence I need a teacher: someone I will *pay*
> to explain to me how to do this. Or better yet, someone who will
> write the proxy for me, with enough comments that I will be able
> to understand it completely.
>
> Where? Who? How much?
>
> Thanks!
>
> -Irv
>
The following should help you do what you want:
http://www.stonehenge.com/merlyn/WebTechniques/col11.html
------------------------------
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 5167
***************************************