[29683] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 927 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 11 14:14:21 2007

Date: Thu, 11 Oct 2007 11:14:12 -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           Thu, 11 Oct 2007     Volume: 11 Number: 927

Today's topics:
    Re: string compare problem xhoster@gmail.com
    Re: threads, Sys::SigAction, alarm, timeout  lincoln.a.baxter@gmail.com
    Re: threads, Sys::SigAction, alarm, timeout <zentara@highstream.net>
        Use of "caller" is ambiguous <ferry.bolhar@chello.at>
    Re: Use of "caller" is ambiguous <mritty@gmail.com>
        Using system() like an http "get" <bill@ts1000.us>
    Re: Using system() like an http "get" <mritty@gmail.com>
    Re: Using system() like an http "get" <elvis-85363@notatla.org.uk>
    Re: Using system() like an http "get" <bill@ts1000.us>
    Re: Using system() like an http "get" (Doug Miller)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 11 Oct 2007 17:26:15 GMT
From: xhoster@gmail.com
Subject: Re: string compare problem
Message-Id: <20071011132617.191$Zh@newsreader.com>

Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth Lars Eighner <usenet@larseighner.com>:
> > Then make it a string, because the value of ERROR is empty, whereas
> > the value of 'ERROR' is ERROR.
>
> No, ERROR calls the sub ERROR; unless it doesn't exist and use strict
> 'subs' is not in effect, when it is autoquoted to 'ERROR'.

In this case, ERROR is a file handle (probably not an open one), not a sub
call, and $_ is being printed to it.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Thu, 11 Oct 2007 02:31:38 -0000
From:  lincoln.a.baxter@gmail.com
Subject: Re: threads, Sys::SigAction, alarm, timeout
Message-Id: <1192069898.531617.47080@57g2000hsv.googlegroups.com>

On Oct 9, 7:19 am, "Loving...@gmail.com" <Loving...@gmail.com> wrote:
> On 9    , 00:03, Martijn Lievaart <m...@rtij.nl.invlalid> wrote:
>
>
>
> > On Mon, 08 Oct 2007 11:12:56 -0400, zentara wrote:
> > > I don't know about how Sys::Sigaction works, but threads and ALARM
> > > and/or signals don't work with threads. The parent thread receives all
> > > signals, so using them in threads is useless unless you have the parent
> > > handle them.
>
> > > zentara
>
> > from perlthrtut:
>
> > ] Similarly, mixing signals and threads should not be attempted.
> > ] Implementations are platform-dependent, and even the POSIX semantics
> > ] may not be what you expect (and Perl doesn't even give you the full
> > ] POSIX API).
>
> > So I would not even count on the main thread receiving all signals. Or am
> > I missing something here?
>
> > M4
>
> Hmmm... So anybody know how to create timeout catcher for some code in
> thread script like I wrote? Such simple example is written herehttp://search.cpan.org/~lbaxter/Sys-SigAction-0.10/dbd-oracle-timeout...
> and I need to use it in code with threads.

I am the author of the sys-sigaction module. Referenced here. I have
privately corresponded with a person I think is the original poster of
this thread.  I believe Martijn Lievaart in the post above has nailed
it with his quote from the from perlthrtut:
>
> > ] Similarly, mixing signals and threads should not be attempted.
> > ] Implementations are platform-dependent, and even the POSIX semantics
> > ] may not be what you expect (and Perl doesn't even give you the full
> > ] POSIX API).

Until perl threads (and the POSIX sigaction API) support this, there
is very little that I think I can do with sys-sigaction to support
it.  I have offered to produce a documentation update to sys-sigaction
calling this out, perhaps to at least warn others to avoid trying to
do this.  I think one is stuck with not using threads if you wants to
use the technique referenced in sys-sigaction for timing out hung
oracle connection attempts. This post should close this topic with
respect to sys-sigaction, for now.



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

Date: Thu, 11 Oct 2007 14:52:20 GMT
From: zentara <zentara@highstream.net>
Subject: Re: threads, Sys::SigAction, alarm, timeout
Message-Id: <9mcsg39cc627u8hlsvaatgcn6denutubbb@4ax.com>

On Thu, 11 Oct 2007 02:31:38 -0000, lincoln.a.baxter@gmail.com wrote:

>On Oct 9, 7:19 am, "Loving...@gmail.com" <Loving...@gmail.com> wrote:
>> On 9    , 00:03, Martijn Lievaart <m...@rtij.nl.invlalid> wrote:
>>
>>
>>
>> > On Mon, 08 Oct 2007 11:12:56 -0400, zentara wrote:
>> > > I don't know about how Sys::Sigaction works, but threads and ALARM
>> > > and/or signals don't work with threads. The parent thread receives all
>> > > signals, so using them in threads is useless unless you have the parent
>> > > handle them.
>> > > zentara


>> Hmmm... So anybody know how to create timeout catcher for some code in
>> thread script like I wrote? Such simple example is written herehttp://search.cpan.org/~lbaxter/Sys-SigAction-0.10/dbd-oracle-timeout...
>> and I need to use it in code with threads.

What you do is create a separate thread to be a timer, and use shared
variables to communicate when the timeout occurred.

It helps if you have an eventloop system going like Glib, POE,
Tk, etc. That way you can schedule a callback every 10 ms to
see if the timer shared variable has expired. Otherwise you
will need to setup a while loop (which can get complicated or
even impossible).

zentara



-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


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

Date: Thu, 11 Oct 2007 19:04:25 +0200
From: "Ferry Bolhar" <ferry.bolhar@chello.at>
Subject: Use of "caller" is ambiguous
Message-Id: <36318$470e579b$54718838$29565@news.chello.at>

Hi,

when writing

*{caller . '::vtx_get_page'} = sub {....};

Perl complains with

Use of "caller" without parentheses is ambiguous

Why is this expression ambiguous?

Greetings, Ferry
--





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

Date: Thu, 11 Oct 2007 10:17:44 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: Use of "caller" is ambiguous
Message-Id: <1192123064.323399.324380@k79g2000hse.googlegroups.com>

On Oct 11, 1:04 pm, "Ferry Bolhar" <ferry.bol...@chello.at> wrote:
> Hi,
>
> when writing
>
> *{caller . '::vtx_get_page'} = sub {....};
>
> Perl complains with
>
> Use of "caller" without parentheses is ambiguous
>
> Why is this expression ambiguous?

Hmm.  I'm not entirely sure.  `perldoc perldiag` says about this
warning:
     Warning: Use of "%s" without parentheses is ambiguous
         (S ambiguous) You wrote a unary operator followed by
         something that looks like a binary operator that could
         also have been interpreted as a term or unary operator.

But I don't see how that applies here.  Obviously, "caller" is the
unary operator, but I don't see how the binary operator "." could also
be interpreted as a term or unary operator.  `perldoc perlop`
certainly doesn't make reference to any unary "." operator.

I'm curious to see what other responses you get in this thread...

FWIW, you can reduce the issue to something as simple as:
perl -wle'$x = caller . "foo";'

Paul Lalli



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

Date: Thu, 11 Oct 2007 10:02:12 -0700
From:  Bill H <bill@ts1000.us>
Subject: Using system() like an http "get"
Message-Id: <1192122132.151687.76860@g4g2000hsf.googlegroups.com>

I have a number of pages on a website that run perl scripts to create
different content. They are all basically accessed with an HREF such
as:

scriptname.pl?param1=1&param2=2 etc

The question I have is, an I use the same syntax in a system call from
another perl program, ie:

system("scriptname.pl?param1=1&param2=2");

Bill



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

Date: Thu, 11 Oct 2007 10:06:06 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: Using system() like an http "get"
Message-Id: <1192122366.384813.263350@k79g2000hse.googlegroups.com>

On Oct 11, 1:02 pm, Bill H <b...@ts1000.us> wrote:
> I have a number of pages on a website that run perl scripts to
> create different content. They are all basically accessed with
> an HREF such as:
>
> scriptname.pl?param1=1&param2=2 etc
>
> The question I have is, an I use the same syntax in a system
> call from another perl program, ie:
>
> system("scriptname.pl?param1=1&param2=2");

No.  system() executes a program specified on the command line.
Unless "scriptname.pl?param1=1&param2=2" is a valid command you could
type at your console window, you can't use system() for it.

You want LWP::Simple, and it's "get" method:

use LWP::Simple;
my $content = get("http://www.example.com/scriptname.pl?
param1=1&param2=2");

Paul Lalli



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

Date: 11 Oct 2007 17:15:41 GMT
From: all mail refused <elvis-85363@notatla.org.uk>
Subject: Re: Using system() like an http "get"
Message-Id: <slrnfgslsd.kl6.elvis-85363@notatla.org.uk>

On 2007-10-11, Bill H <bill@ts1000.us> wrote:

> scriptname.pl?param1=1&param2=2 etc
> The question I have is, an I use the same syntax in a system call from
> another perl program, ie:
> system("scriptname.pl?param1=1&param2=2");

I'm afraid Hotspur and Glendower got to this one first.
    http://www.alanhoward.org.uk/spell.htm
What's the shell produced by system() going to think when it sees "&",
and does "scriptname.pl?param1=1" match anything in the PATH ?

-- 
Elvis Notargiacomo  master AT barefaced DOT cheek
http://www.notatla.org.uk/goen/


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

Date: Thu, 11 Oct 2007 10:19:54 -0700
From:  Bill H <bill@ts1000.us>
Subject: Re: Using system() like an http "get"
Message-Id: <1192123194.976221.14020@d55g2000hsg.googlegroups.com>

On Oct 11, 1:06 pm, Paul Lalli <mri...@gmail.com> wrote:
> On Oct 11, 1:02 pm, Bill H <b...@ts1000.us> wrote:
>
> > I have a number of pages on a website that run perl scripts to
> > create different content. They are all basically accessed with
> > an HREF such as:
>
> > scriptname.pl?param1=1&param2=2 etc
>
> > The question I have is, an I use the same syntax in a system
> > call from another perl program, ie:
>
> > system("scriptname.pl?param1=1&param2=2");
>
> No.  system() executes a program specified on the command line.
> Unless "scriptname.pl?param1=1&param2=2" is a valid command you could
> type at your console window, you can't use system() for it.
>
> You want LWP::Simple, and it's "get" method:
>
> use LWP::Simple;
> my $content = get("http://www.example.com/scriptname.pl?
> param1=1&param2=2");
>
> Paul Lalli

Thats what I realized after I posted the message. But thinking about
it, since the script I want to call is on the same server and in the
same directory I should be able to modify the ENV{'QUERY_STRING'} to
contain the new data then if I use system on the other script it
"should" work the same as if I called it from an HREF, or am I really
missing something here?

Bill H



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

Date: Thu, 11 Oct 2007 17:37:13 GMT
From: spambait@milmac.com (Doug Miller)
Subject: Re: Using system() like an http "get"
Message-Id: <dbtPi.7865$6p6.4257@newssvr25.news.prodigy.net>

In article <1192122132.151687.76860@g4g2000hsf.googlegroups.com>, Bill H <bill@ts1000.us> wrote:
>I have a number of pages on a website that run perl scripts to create
>different content. They are all basically accessed with an HREF such
>as:
>
>scriptname.pl?param1=1&param2=2 etc
>
>The question I have is, an I use the same syntax in a system call from
>another perl program, ie:

Probably...
>
>system("scriptname.pl?param1=1&param2=2");

 .. but not like that. On my web server (Sun Solaris), this works at the 
command line:

env -i QUERY_STRING="param1=1&param2=2" /path/scriptname.pl

and presumably would work in a system() call as well, although I have not 
tested it. Similar behavior would be expected under other flavors of Unix.

-- 
Regards,
        Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.


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

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 V11 Issue 927
**************************************


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