[26071] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8273 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 24 11:05:32 2005

Date: Sun, 24 Jul 2005 08:05:08 -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           Sun, 24 Jul 2005     Volume: 10 Number: 8273

Today's topics:
         Re: Error.pm and try/catch/throw <ron@savage.net.au>
    Re: "Can't return a temporary from lvalue subroutine... <nospam-abuse@ilyaz.org>
    Re: "Can't return a temporary from lvalue subroutine... <nospam-abuse@ilyaz.org>
    Re: Connecting to oracle from perl <Juha.Laiho@iki.fi>
        How does a scalar know what it is? <lfs.1@spam.net>
    Re: How does a scalar know what it is? <klaus_gb@yahoo.com>
    Re: How does a scalar know what it is? <daveandniki@ntlworld.com>
    Re: How does a scalar know what it is? <tadmc@augustmail.com>
    Re: Mod_Perl vs PHP in memory, speed, varibles <nntp@alexa.com>
    Re: Mod_Perl vs PHP in memory, speed, varibles <jstucklex@attglobal.net>
    Re: Mod_Perl vs PHP in memory, speed, varibles <tadmc@augustmail.com>
    Re: posting an array   <joe@inwap.com>
    Re: posting an array <usenet@NOSPAM.obantec.net>
    Re: posting an array <spam-block-@-SEE-MY-SIG.com>
    Re: posting an array <noreply@gunnar.cc>
    Re: standalone perl interpreter for Windows? <tadmc@augustmail.com>
    Re: standalone perl interpreter for Windows? <jurgenex@hotmail.com>
    Re: standalone perl interpreter for Windows? <sherm@dot-app.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 24 Jul 2005 11:55:24 +1000
From:     Ron Savage <ron@savage.net.au>
Subject:  Re: Error.pm and try/catch/throw
Message-Id: <2005724115524.316271@ron>

On Thu, 21 Jul 2005 15:54:02 +1000, fishfry wrote:

Hi Fishy

If you search the archives of (I think) mod_perl's mailing list you'll see=
 Error 
has been repeatedly criticised. The alternative recommended is=
 Exception::Class.




------------------------------

Date: Sun, 24 Jul 2005 10:59:26 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: "Can't return a temporary from lvalue subroutine..."
Message-Id: <dbvsae$2pc5$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Brian McCauley 
<nobull@mail.com>], who wrote in article <dbjg31$d4q$1@slavica.ukpost.com>:
> There are bugs in Perl.  In particular if the reference returned by the 
> %{} overload is the only reference to the tied hash some very nasty 
> things happen very soon.  Even if it's not, nasty things seem to happen 
> after a while.

Could you be more specific?

Thanks,
Ilya




------------------------------

Date: Sun, 24 Jul 2005 11:14:39 +0000 (UTC)
From:  Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: "Can't return a temporary from lvalue subroutine..."
Message-Id: <dbvt6v$2pvr$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>], who wrote in article <dbgjls$l1e$1@mamenchi.zrz.TU-Berlin.DE>:
> > What "temporary" is the error message referring to?  Is there a
> > work around?
> 
> It looks like "temporary" refers to the state of a scalar of being
> "mortal".  Mortal SVs are all over the Perl source, but normally
> only concern XS programmers.  This is the first time I see the
> distinction appear at Perl level.

There is no way to determine that a thing is mortal (short of walking
up the mortalization stack and checking whether a value is there).
So, obviously, it is not that.  Here "a temporary" is an intermediate
variable created by Perl without a direct intervention of a programmer.

I'm afraid that it was me who put this error message there; so all the
blame on its wording may be on me.  When I introduced the lvalue subs,
there was a lot of suspicion on p5p that the whole idea is junk; as a
result, the handling is over-protecting.  This "can't" in the message,
for example, is red herring; there would be no problem for Perl to
change a value of a temporary; it is just that usually it is not what
a programmer wants:

  sub add5 : lvalue {
      my $x = shift;
      return $x + 5;
  }

So the main usage of this message is to warn the programmer of
*possibly* flaky code.

The problem is that the current implementation of tied hashes is using
a temporary to handle access to a value for a key.  I did not realize
this when implementing the lvalue subs, so there is no special case to
handle this "legitimate" use of temporaries in lvalue subs.

Hope this helps,
Ilya


------------------------------

Date: Sun, 24 Jul 2005 05:58:43 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Connecting to oracle from perl
Message-Id: <dbvamj$k5b$1@ichaos.ichaos-int>

mkrogsru@online.no (Anne-Marte) said:
>I'm piping from procmail to perl where I want to connect to an oracle
>DB. The problem is that this isn't working when I call the script from
>my .procmailrc-file, but it is working nicely when  I run the script
>from xterm. The exeption I get looks like this:
>
>install_driver(Oracle) failed: Can't load
>'/local/perl/lib/site_perl/5.6.0/sun4-solaris/auto/DBD/Oracle/Oracle.so'
>for module DBD::Oracle: ld.so.1: /local/perl/bin/perl: fatal:
>libclntsh.so.1.0: open failed: No such file or directory at
>/local/perl/lib/5.6.0/sun4-solaris/DynaLoader.pm line 200.
> at (eval 29) line 3
>Compilation failed in require at (eval 29) line 3.
>Perhaps a required shared library or dll isn't installed where
>expected
> at /ssb/ursus/h1/amk/lib/OracleBase.pm line 49
>procmail: Error while writing to "/perl/DBtest.pl"
>procmail: Program failure (255) of "/perl/DBtest.pl" 
>
>Is anyone familiar with this problem??

In your xterm session something is setting the LD_LIBRARY_PATH -variable
for you, which gives your DBD::Oracle driver the requisite information
to find the Oracle client library (libclntsh.so).

When executed through procmail, LD_LIBRARY_PATH is not set, and thus the
client library is not found. Getting LD_LIBRARY_PATH set for procmail
scripts can be tricky, as the scripts may be run setuid, in which case
LD_LIBRARY_PATH is ignored for security reasons.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)


------------------------------

Date: Sun, 24 Jul 2005 02:16:41 -0500
From: "Tom" <lfs.1@spam.net>
Subject: How does a scalar know what it is?
Message-Id: <toqdnVRhz5Wr3X7fRVn-og@comcast.com>

In C, I can just read the K&R book and know
how everything is pretty much coded at the
machine level.  At least to some extent.

But how does Perl know when you type

print $ref

for example that it is not an integer, string or what have
you?

And how does

print $num;    2  or "Two"

again at the machine level, how does perl know
what it has?






------------------------------

Date: Sun, 24 Jul 2005 12:26:54 +0100
From: "Klaus Eichner" <klaus_gb@yahoo.com>
Subject: Re: How does a scalar know what it is?
Message-Id: <42e36b31$0$12641$636a15ce@news.free.fr>

"Tom" <lfs.1@spam.net> wrote in message
news:toqdnVRhz5Wr3X7fRVn-og@comcast.com...
> In C, I can just read the K&R book and know
> how everything is pretty much coded at the
> machine level.  At least to some extent.
>
> But how does Perl know when you type
>
> print $ref
>
> for example that it is not an integer, string or what have
> you?
>
> And how does
>
> print $num;    2  or "Two"
>
> again at the machine level, how does perl know
> what it has?

it's not the complete answer, but the Devel::Peek module could give some
hints. Try
http://search.cpan.org/~nwclark/perl-5.8.7/ext/Devel/Peek/Peek.pm

-- 
Klaus




------------------------------

Date: Sun, 24 Jul 2005 12:09:15 GMT
From: "Dave" <daveandniki@ntlworld.com>
Subject: Re: How does a scalar know what it is?
Message-Id: <LxLEe.15418$Ag3.7534@newsfe4-gui.ntli.net>

I think this is what you want to read:

From Klaus' link:
http://search.cpan.org/~nwclark/perl-5.8.7/pod/perlguts.pod#Datatypes

or type:

perldoc perlguts

at the CLI.

Dave

"Tom" <lfs.1@spam.net> wrote in message 
news:toqdnVRhz5Wr3X7fRVn-og@comcast.com...
> In C, I can just read the K&R book and know
> how everything is pretty much coded at the
> machine level.  At least to some extent.
>
> But how does Perl know when you type
>
> print $ref
>
> for example that it is not an integer, string or what have
> you?
>
> And how does
>
> print $num;    2  or "Two"
>
> again at the machine level, how does perl know
> what it has?
>
>
>
> 




------------------------------

Date: Sun, 24 Jul 2005 08:24:37 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How does a scalar know what it is?
Message-Id: <slrnde75kl.a8.tadmc@magna.augustmail.com>

Tom <lfs.1@spam.net> wrote:

> In C, I can just read the K&R book 


The docs that ship with the perl distribution are to Perl what
K&R is to C.


> and know
> how everything is pretty much coded at the
> machine level.  At least to some extent.
> 
> But how does Perl know when you type
> 
> print $ref
> 
> for example that it is not an integer, string or what have
> you?


The first sentence of:

   perldoc -f print

says "Prints a string or a list of strings."

So all arguments to print() are strings. 

Perl must then use the string value of the variable.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 23 Jul 2005 21:29:48 -0400
From: "nntp" <nntp@alexa.com>
Subject: Re: Mod_Perl vs PHP in memory, speed, varibles
Message-Id: <FYadnSW8TL2Gcn_fRVn-ig@rogers.com>

> nntp wrote:
> > Gunnar Hjalmarsson wrote:
> >> Did you study this document about porting CGI scripts to mod_perl:
> >> http://perl.apache.org/docs/1.0/guide/porting.html
> >
> > That does not work.
>
> I should have realized that you are just a pitiful troll. Show us some
> hard evidence supporting your claim, or else there is no reason to talk.
Fuck off. Stupid shit.

>
> -- 
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl




------------------------------

Date: Sat, 23 Jul 2005 23:56:30 -0500
From: Jerry Stuckle <jstucklex@attglobal.net>
Subject: Re: Mod_Perl vs PHP in memory, speed, varibles
Message-Id: <KJqdnVkYR9H5jH7fRVn-ug@comcast.com>

nntp wrote:
>>nntp wrote:
>>
>>>Gunnar Hjalmarsson wrote:
>>>
>>>>Did you study this document about porting CGI scripts to mod_perl:
>>>>http://perl.apache.org/docs/1.0/guide/porting.html
>>>
>>>That does not work.
>>
>>I should have realized that you are just a pitiful troll. Show us some
>>hard evidence supporting your claim, or else there is no reason to talk.
> 
> Fuck off. Stupid shit.
> 
> 
>>-- 
>>Gunnar Hjalmarsson
>>Email: http://www.gunnar.cc/cgi-bin/contact.pl
> 
> 
> 

LOL.

Gunnar,

You got him nailed.  Typical troll response.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================


------------------------------

Date: Sun, 24 Jul 2005 07:52:35 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Mod_Perl vs PHP in memory, speed, varibles
Message-Id: <slrnde73oj.a8.tadmc@magna.augustmail.com>


[ Followups set ]


nntp <nntp@alexa.com> wrote:
>> nntp wrote:
>> > Gunnar Hjalmarsson wrote:


>> Show us some
>> hard evidence supporting your claim, or else there is no reason to talk.


> Fuck off. Stupid shit.


Very intellectual of you, we are surely impressed.

I guess that means that you cannot support your claim.

We were all wondering if Gunnar had it right or not, thanks for
posting your confirmation of which way it is.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sun, 24 Jul 2005 06:48:41 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: posting an array  
Message-Id: <Tb6dnYnfG82hAX7fRVn-pA@comcast.com>

Mark D Smith wrote:

> print "<input type=hidden name=accounts value=\"@accounts\">";
> 
> the page that receives the data should be able to unpack the array but i am
> having problems
> 
> &ReadParse();
> what have i missed

One of the things to consider is that you should 'use CGI;' instead
of cgi-lib.pl.  It also appears that you are not aware of qq():

   print qq(<input type=hidden name=accounts value="@accounts">\n);

or

   print qq(<input type="hidden" name="accounts" value="$_">\n)
						for @accounts;


> but
> 
> $cnt=0;
> @accounts = $in{'accounts'};
> foreach $line(@accounts) {
> print "$line<br>\n";
> $cnt++;
> }
> print $cnt;
> 
> username username_001 username_002 username_003
> 1
> 
> all on 1 line, not 1 line for each value in the array.

Of course.  print("@accounts") outputs a single string consisting
of the printable equivalent of all the items in the array
separated by blanks (or whatever $" is set to).

Either
   1) leave the form creation script as is and change the receiving
      script to convert the incoming string back into an array,
or
   2) leave the form receiving script as is and change the creation
      script to output multiple input tags with the same name.

Use
   print qq(<input type="hidden" name="accounts" value="$_">\n)
						for @accounts;
to create multiple lines of output like this:
<input type="hidden" name="accounts" value="$accounts[0]">
<input type="hidden" name="accounts" value="$accounts[1]">
<input type="hidden" name="accounts" value="$accounts[2]">
 ...

	-Joe


------------------------------

Date: Sun, 24 Jul 2005 07:25:02 +0100
From: "Mark D Smith" <usenet@NOSPAM.obantec.net>
Subject: Re: posting an array
Message-Id: <42e334f7$0$30396$db0fefd9@news.zen.co.uk>


"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:3kflcuFtuh2fU1@individual.net...
> Mark D Smith wrote:
<snip>
>
> You seem to have missed a few things. First, what you post via a form
> control is a string, not a list.
>
> An array, such as
>
>      my @accounts = qw/name1 name2 name3/;
>
> returns a string with the elements separated with spaces and
> concatenated, if you surround it with double quotes.
>
> If the usernames don't contain space characters, you can try
>
>      @accounts = split ' ', $in{'accounts'};
>
> Another thing is that your Perl coding style seems to be outdated.
> Please make it a habit to my() declare the variables and enable
> strictures and warnings. Also, it may be a good idea to start using the
> standard module CGI.pm instead of cgi-lib.pl (or whatever code you are
> referring to with "&ReadParse();").
>
> -- 
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl

Hi

i do a my @accounts=();
it was only a code snippet.
as to cgi-lib.pl i know but i am updating some old code and it would take a
while to fix all the other bits.

@accounts = split ' ', $in{'accounts'}; works on second page and give the
results i wanted.

what i don't get is the in the first script i am building the array with

push (@accounts, $Euser);
in a while loop so i thought this would build an array which i could then
pass.

the same loop as the second script is used to display what is going to be
passed and that works.

Mark










------------------------------

Date: Sun, 24 Jul 2005 09:44:54 +0100
From: James Taylor <spam-block-@-SEE-MY-SIG.com>
Subject: Re: posting an array
Message-Id: <ant240854190fNdQ@riscpc.jtnet>

In article <42e334f7$0$30396$db0fefd9@news.zen.co.uk>,
Mark D Smith <usenet@NOSPAM.obantec.net> wrote:
> 
> what i don't get is the in the first script i am building
> the array with
> 
> push (@accounts, $Euser);
> 
> in a while loop so i thought this would build an array
> which i could then pass.

You need to show us the while loop if you want someone to tell
you what's wrong with it.

-- 
James Taylor, London, UK                              PGP key: 3FBE1BF9
To protect against spam, the address in the "From:" header is not valid.
In any case, you should reply to the group so that everyone can benefit.
If you must send me a private email, use james at oakseed demon co uk.



------------------------------

Date: Sun, 24 Jul 2005 11:59:30 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: posting an array
Message-Id: <3kh744Fttf9fU1@individual.net>

Mark D Smith wrote:
> Gunnar Hjalmarsson wrote:
>> 
>> what you post via a form control is a string, not a list.
>
> what i don't get is the in the first script i am building the array with
> 
> push (@accounts, $Euser);
> in a while loop so i thought this would build an array

How you build the array is irrelevant.

> which i could then pass.

You don't post a variable via a form control. *You post a string.*

I suggest that you read up on the basics about CGI to straight out a few 
misconceptions. 
http://www.cgi.resourceindex.com/Documentation/CGI_Tutorials/

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Sat, 23 Jul 2005 21:13:44 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: standalone perl interpreter for Windows?
Message-Id: <slrnde5uao.l12.tadmc@magna.augustmail.com>


[ Newsgroups trimmed ]


DN <dn@dn.dn2.dn.invalid> wrote:

> Are there any free or inexpensive standalone perl interpreters for writing 
> and testing PHP code on Windows? 


I assume you meant "Perl" rather than "PHP", otherwise you'd be
in the wrong newsgroup.

Sure, most Perl interpreters are free and standalone.

Have you already checked the Perl FAQ?

   perldoc -q Perl

       What machines support Perl?  Where do I get it?

       How can I get a binary version of Perl?

       I don't have a C compiler on my system.  How can I compile perl?

See also http://www.activestate.com.


> I'd like to avoid having to install or 
> activate web server software.


That's fine, as Perl is used much more often for non-web stuff
than for web stuff anyway.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sun, 24 Jul 2005 12:59:17 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: standalone perl interpreter for Windows?
Message-Id: <FgMEe.2628$sc3.2266@trnddc07>

DN wrote:
> Are there any free or inexpensive standalone perl interpreters

Well, dahhh, Perl is public domain, of course there are. Did you check the 
FAQ?
The most commonly used one is probably from http://activestate.com

> for
> writing and testing PHP code on Windows? I'd like to avoid having to
> install or activate web server software.

Well, do you mean a PHP interpreter written in Perl?
You should have checked CPAN first:

There is http://search.cpan.org/author/KARASIK/PHP-0.09/PHP.pm:

NAME
PHP - embedded PHP interpreter
DESCRIPTION
The module makes it possible to execute PHP code, [...]

Does that fit the bill?

jue 




------------------------------

Date: Sun, 24 Jul 2005 10:48:55 -0400
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: standalone perl interpreter for Windows?
Message-Id: <m2oe8sdzu0.fsf@Sherm-Pendleys-Computer.local>

"Jürgen Exner" <jurgenex@hotmail.com> writes:

> Well, dahhh, Perl is public domain, of course there are. Did you check the 
> FAQ?

Um... No, Perl is not in the public domain. It's copyrighted, and distributed
according to the terms of either the GNU GPL or Perl's own Artistic License.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


------------------------------

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 8273
***************************************


home help back first fref pref prev next nref lref last post