[30995] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2240 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 27 16:09:45 2009

Date: Fri, 27 Feb 2009 13:09:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 27 Feb 2009     Volume: 11 Number: 2240

Today's topics:
        =?windows-1252?Q?Insight_=238_=93Blue_the_hue_of_creati yinyanggizmo@gmail.com
    Re: Develop a PERL WEB SERVICE that utilizes the Yahoo  <cwilbur@chromatico.net>
    Re: Develop a PERL WEB SERVICE that utilizes the Yahoo  <tfgordon@buffalo.edu>
    Re: Develop a PERL WEB SERVICE that utilizes the Yahoo  <tfgordon@buffalo.edu>
        exit status of a perl script? <bugbear@trim_papermule.co.uk_trim>
    Re: exit status of a perl script? <smallpond@juno.com>
    Re: exit status of a perl script? <ben@morrow.me.uk>
    Re: exit status of a perl script? <RedGrittyBrick@spamweary.invalid>
    Re: exit status of a perl script? (Greg Bacon)
    Re: exit status of a perl script? <bugbear@trim_papermule.co.uk_trim>
    Re: exit status of a perl script? <tadmc@seesig.invalid>
    Re: exit status of a perl script? <nospam-abuse@ilyaz.org>
    Re: exit status of a perl script? <hjp-usenet2@hjp.at>
    Re: Forcing list context on <$fh> <noreply@gunnar.cc>
    Re: Forcing list context on <$fh> <ben@morrow.me.uk>
    Re: Forcing list context on <$fh> (Tim McDaniel)
    Re: Using Perl to connect a Linux box to Linux/Windows  <schaitan@gmail.com>
    Re: Using Perl to connect a Linux box to Linux/Windows  <ben@morrow.me.uk>
    Re: utf8 and chomp <jfeit@ics.muni.cz>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Feb 2009 04:38:19 -0800 (PST)
From: yinyanggizmo@gmail.com
Subject: =?windows-1252?Q?Insight_=238_=93Blue_the_hue_of_creativity=3F_Red_for_de?= =?windows-1252?Q?tail=3F=94?=
Message-Id: <6c0d8860-20de-41ba-9fbe-188a81f1c4da@j35g2000yqh.googlegroups.com>


Message: Ancient Insights and the Real Story behind News Headlines:
Insight #8 =93Blue the hue of creativity? Red for detail?=94
http://sunburstjoy.blogspot.com/2009/02/blue-hue-of-creativity-red-for-deta=
il.html
http://www.youtube.com/watch?v=3DBbGkD402-I8


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

Date: Fri, 27 Feb 2009 09:05:57 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Develop a PERL WEB SERVICE that utilizes the Yahoo Web Services API
Message-Id: <86prh4nfei.fsf@mithril.chromatico.net>

>>>>> "sg" == seef gordon <tfgordon@buffalo.edu> writes:

    sg> Okay ben , please understand that am not asking for any one to
    sg> spoon feed me the answer my teacher just send me that project to
    sg> do , and I have no real idea where to start , I don't want the
    sg> answer , I just want some who knows perl to brake it down to me
    sg> that all thanks for your response

Except that you *are* asking us to spoon-feed you the answer.

No fewer than five people have asked you what you are *specifically*
having trouble with.

No fewer than three people have told you that the question itself TELLS
you where to start.

If you carry on like this, you're probably not going to get any extra
credit -- and, to be honest, if this is the way you approached all the
assignments, you're probably failing and desperately need it.

Oh well.  There will always be low-paid jobs in service industries, and
when you get motivated enough to do your own homework, you can return to
school then.

Charlton



-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Fri, 27 Feb 2009 08:16:43 -0500
From: seef gordon <tfgordon@buffalo.edu>
Subject: Re: Develop a PERL WEB SERVICE that utilizes the Yahoo Web Services API
Message-Id: <C5CD51EB.32D%tfgordon@buffalo.edu>

Okay ben , please understand that am not asking for any one to spoon feed me
the answer my teacher just send me that project to do , and I have no real
idea where to start , I don't want the answer , I just want some  who knows
perl to brake it down to me that all thanks for your response


On 2/27/09 3:59 AM, in article 5lmk76-un1.ln1@osiris.mauzo.dyndns.org, "Ben
Morrow" <ben@morrow.me.uk> wrote:

> 
> Quoth seef gordon <tfgordon@buffalo.edu>:
>> Okay I have this project to do for my perl class as extra credit
> 
> Do your own homework. You're unlikely to receive much useful help here
> given that you've told us you're cheating.
> 
> Ben
> 



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

Date: Fri, 27 Feb 2009 09:20:56 -0500
From: seef gordon <tfgordon@buffalo.edu>
Subject: Re: Develop a PERL WEB SERVICE that utilizes the Yahoo Web Services API
Message-Id: <C5CD60F8.332%tfgordon@buffalo.edu>

For the record I I am not failing the class I have a B but would like an A
any way am not going to bicker I already have the answer I was looking for
thanks to RedGrittyBrick thanks for you comments also

On 2/27/09 9:05 AM, in article 86prh4nfei.fsf@mithril.chromatico.net,
"Charlton Wilbur" <cwilbur@chromatico.net> wrote:

>>>>>> "sg" == seef gordon <tfgordon@buffalo.edu> writes:
> 
>     sg> Okay ben , please understand that am not asking for any one to
>     sg> spoon feed me the answer my teacher just send me that project to
>     sg> do , and I have no real idea where to start , I don't want the
>     sg> answer , I just want some who knows perl to brake it down to me
>     sg> that all thanks for your response
> 
> Except that you *are* asking us to spoon-feed you the answer.
> 
> No fewer than five people have asked you what you are *specifically*
> having trouble with.
> 
> No fewer than three people have told you that the question itself TELLS
> you where to start.
> 
> If you carry on like this, you're probably not going to get any extra
> credit -- and, to be honest, if this is the way you approached all the
> assignments, you're probably failing and desperately need it.
> 
> Oh well.  There will always be low-paid jobs in service industries, and
> when you get motivated enough to do your own homework, you can return to
> school then.
> 
> Charlton
> 
> 



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

Date: Fri, 27 Feb 2009 14:47:03 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: exit status of a perl script?
Message-Id: <bK2dndlzt550YTrUnZ2dnUVZ8jqWnZ2d@posted.plusnet>

I've just googled for 10 minutes,
and found lots of stuff about calling the exit function.

What is the defined exit status (as when a perl script
is called from *nix) behaviour of a perl script
when the exit function IS NOT called?

In other words what values can I expect in $?
under varying circumstances?

    BugBear (who did try to google this)


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

Date: Fri, 27 Feb 2009 07:04:50 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: exit status of a perl script?
Message-Id: <09a18450-6025-4506-b290-3ce996d76eb7@t3g2000yqa.googlegroups.com>

On Feb 27, 9:47 am, bugbear <bugbear@trim_papermule.co.uk_trim> wrote:
> I've just googled for 10 minutes,
> and found lots of stuff about calling the exit function.
>
> What is the defined exit status (as when a perl script
> is called from *nix) behaviour of a perl script
> when the exit function IS NOT called?
>
> In other words what values can I expect in $?
> under varying circumstances?
>
>     BugBear (who did try to google this)

0 if the program completes normally.

non-zero if it dies or won't compile or blows up.
non-zero means something like:  errno || 255


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

Date: Fri, 27 Feb 2009 15:03:43 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: exit status of a perl script?
Message-Id: <fvbl76-9ma.ln1@osiris.mauzo.dyndns.org>


Quoth bugbear <bugbear@trim_papermule.co.uk_trim>:
> I've just googled for 10 minutes,
> and found lots of stuff about calling the exit function.
> 
> What is the defined exit status (as when a perl script
> is called from *nix) behaviour of a perl script
> when the exit function IS NOT called?
> 
> In other words what values can I expect in $?
> under varying circumstances?

Under normal circumstances the exit status will be 0. 

If the program is killed by a signal you will get the usual signal +
coredump bits set in the exit status (this has nothing to do with perl,
it applies to any process). Obviously this only applies to Unix systems.
Under other systems, there may be other 'special circumstances' that
cause a process to exit with a particular status: for example, under
Win32 it is possible to terminate another process with any exit status,
and this is in fact what perl's 'kill' function does under Win32.

If the program exits as the result of a 'die', the exit status will be
255 (that is, $? in a waiting perl program will be 255<<8).

If you assign to $? in an END block, that sets perl's final exit status.
This will override both 'exit' and 'die', but not a signalled exit.

I don't think there are any other exceptions, but I could be wrong.

Ben



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

Date: Fri, 27 Feb 2009 16:08:41 +0000
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: exit status of a perl script?
Message-Id: <49a8100c$0$16168$db0fefd9@news.zen.co.uk>


bugbear wrote:
> I've just googled for 10 minutes,
> and found lots of stuff about calling the exit function.
> 
> What is the defined exit status (as when a perl script
> is called from *nix) behaviour of a perl script
> when the exit function IS NOT called?
> 
> In other words what values can I expect in $?
> under varying circumstances?
> 
>    BugBear (who did try to google this)


$ perl -e1
$ echo $?
0

$ perl -e 'adfsgdfg'
$ echo $?
0

$ perl -e'$a=1/0'
Illegal division by zero at -e line 1.
$ echo $?
255

Presumably you already tried stuff like the above
and wanted a pointer to some documentation?

`perldoc perlrun` says "an implicit exit(0) is provided to indicate 
successful completion"

-- 
RGB


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

Date: Fri, 27 Feb 2009 10:12:00 -0600
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: exit status of a perl script?
Message-Id: <u7WdnQKaGIhNjTXUnZ2dnUVZ_vadnZ2d@posted.hiwaay2>

bugbear wrote

: What is the defined exit status (as when a perl script
: is called from *nix) behaviour of a perl script
: when the exit function IS NOT called?

The perlrun manpage makes it explicit:

    If the program runs off the end without hitting
    an exit() or die() operator, an implicit exit(0)
    is provided to indicate successful completion.

See the end of the Description section in

    http://perldoc.perl.org/perlrun.html

or in man perlrun.

Greg
-- 
Probably the most outward sign that electricity "markets" are totally
perverse and clearly not a free market is that the industry devotes large
sums of advertising dollars trying to convince people to purchase less of
their product.                 -- Roy Cordato


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

Date: Fri, 27 Feb 2009 16:14:09 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: exit status of a perl script?
Message-Id: <rMidnW9NqM7MjDXUnZ2dnUVZ8v-WnZ2d@posted.plusnet>

RedGrittyBrick wrote:
> $ perl -e1
> $ echo $?
> 0
> 
> $ perl -e 'adfsgdfg'
> $ echo $?
> 0
> 
> $ perl -e'$a=1/0'
> Illegal division by zero at -e line 1.
> $ echo $?
> 255
> 
> Presumably you already tried stuff like the above
> and wanted a pointer to some documentation?

No - I didn't try to reverse engineer the behaviour,
I tried (and failed...) to find a spec.

> 
> `perldoc perlrun` says "an implicit exit(0) is provided to indicate 
> successful completion"

Ah - the myriad (obvious in hindsight...) sources
of perl information.

Thanks.

   BugBear


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

Date: Fri, 27 Feb 2009 08:57:16 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: exit status of a perl script?
Message-Id: <slrngqfvqc.hpe.tadmc@tadmc30.sbcglobal.net>

bugbear <bugbear@trim_papermule.co.uk_trim> wrote:

> I've just googled for 10 minutes,
> and found lots of stuff about calling the exit function.


The perlrun manpage has information about running perl programs.


> What is the defined exit status (as when a perl script
> is called from *nix) behaviour of a perl script
> when the exit function IS NOT called?


    perldoc perlrun

    If the program runs off the end without hitting an exit() 
    or die() operator, an implicit C<exit(0)> is provided to 
    indicate successful completion.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Fri, 27 Feb 2009 20:30:09 GMT
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: exit status of a perl script?
Message-Id: <slrngqgjad.96b.nospam-abuse@chorin.math.berkeley.edu>

On 2009-02-27, Tad J McClellan <tadmc@seesig.invalid> wrote:
>     perldoc perlrun
>
>     If the program runs off the end without hitting an exit() 
>     or die() operator, an implicit C<exit(0)> is provided to 
>     indicate successful completion.

What is the point of quoting Perl docs when one knows that in most
cases it is wrong?

  perl -wle "system $^X, @ARGV and print $?>>8" -- -we "END{$? = 14}; 1"
  14

(Mentioned by Ben too...)

Puzzled,
Ilya

P.S.  Same as Ben: I do not remember any other exception...


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

Date: Fri, 27 Feb 2009 21:53:57 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: exit status of a perl script?
Message-Id: <slrngqgkn5.nfd.hjp-usenet2@hrunkner.hjp.at>

On 2009-02-27 20:30, Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> On 2009-02-27, Tad J McClellan <tadmc@seesig.invalid> wrote:
>>     perldoc perlrun
>>
>>     If the program runs off the end without hitting an exit() 
>>     or die() operator, an implicit C<exit(0)> is provided to 
>>     indicate successful completion.
>
> What is the point of quoting Perl docs when one knows that in most
> cases it is wrong?

How is this wrong "in most cases"?

	hp



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

Date: Fri, 27 Feb 2009 18:00:54 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Forcing list context on <$fh>
Message-Id: <70qkeiFhnqo0U1@mid.individual.net>

Ben Morrow wrote:
> Quoth Tad J McClellan <tadmc@seesig.invalid>:
>> Jim Gibson <jimsgibson@gmail.com> wrote:
>>>> At 2009-02-26 07:45AM, "Tad J McClellan" wrote:
>>>>> 
>>>>>  BTW, there are *two* strings that will match /^mycompany$/
>>>>>  (so it isn't really an equality test...).

<snip>

>>> Perhaps "mycompany" and "mycompany\n" (on certain platforms).
>> 
>> On what platforms is that not true?
>>
>> I thought that perl's IO layer normalized line endings, so that that
>> should be true on ALL platforms.
> 
> IO is irrelevant here. If you have a Perl string containing
> "mycompany\n" it will match /^mycompany$/, regardless of how it ended up
> with those contents.
> 
> Of course, if you read a line from an ordinary text file on Win32 with a
> binmoded filehandle, the string returned will be "mycompany\r\n" and
> will not match,

You don't need binmode() for that to be true.

$ cat -vE w32.txt
mycompany^M$
$ cat test.pl
open my $fh, '<', 'w32.txt' or die $!;
print <$fh> =~ /^mycompany$/ ? "Match\n" : "No match\n";
$ perl test.pl
No match
$

To make it *not* be true, i.e. to make the string match, you can binmode 
the filehandle with the :crlf layer.

$ cat test.pl
open my $fh, '<', 'w32.txt' or die $!;
binmode $fh, ':crlf';
print <$fh> =~ /^mycompany$/ ? "Match\n" : "No match\n";
$ perl test.pl
Match
$

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


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

Date: Fri, 27 Feb 2009 18:16:50 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Forcing list context on <$fh>
Message-Id: <i9nl76-akb.ln1@osiris.mauzo.dyndns.org>


Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
> Ben Morrow wrote:
> > 
> > Of course, if you read a line from an ordinary text file on Win32 with a
> > binmoded filehandle, the string returned will be "mycompany\r\n" and
> > will not match,
> 
> You don't need binmode() for that to be true.
> 
> $ cat -vE w32.txt
> mycompany^M$
> $ cat test.pl
> open my $fh, '<', 'w32.txt' or die $!;
> print <$fh> =~ /^mycompany$/ ? "Match\n" : "No match\n";
> $ perl test.pl
> No match
> $

Given that most Win32 machines don't have cat(1), and that the usual
prompt on Win32 isn't '$', I am going to presume that you are not,
in fact, running this on Win32.

On Win32, unless you've set the PERLIO environment variable, the default
filehandle layers are ":unix:crlf".

Ben



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

Date: Fri, 27 Feb 2009 20:28:59 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Forcing list context on <$fh>
Message-Id: <go9ieb$jsq$1@reader1.panix.com>

In article <i9nl76-akb.ln1@osiris.mauzo.dyndns.org>,
Ben Morrow  <ben@morrow.me.uk> wrote:
>
>Quoth Gunnar Hjalmarsson <noreply@gunnar.cc>:
>> Ben Morrow wrote:
>> > 
>> > Of course, if you read a line from an ordinary text file on Win32
>> > with a binmoded filehandle, the string returned will be
>> > "mycompany\r\n" and will not match,
>> 
>> You don't need binmode() for that to be true.
>> 
>> $ cat -vE w32.txt
>> mycompany^M$
>> $ cat test.pl
>> open my $fh, '<', 'w32.txt' or die $!;
>> print <$fh> =~ /^mycompany$/ ? "Match\n" : "No match\n";
>> $ perl test.pl
>> No match
>> $
>
>Given that most Win32 machines don't have cat(1), and that the usual
>prompt on Win32 isn't '$', I am going to presume that you are not,
>in fact, running this on Win32.

MinGW and Cygwin, no matter how they perturb the environment, run
under Windows.  ActiveState Perl does not, I believe, depend on
anything else, and therefore could be run equally well from cmd or a
shell.

As a practical matter, I run enough scripts on Windows (whether
under bash or cmd) and have hit the problem enough that I do
    chomp;
    s/\r+$//;
as a matter of rote, or instead use \s if I want to strip all trailing
whitespace whatsoever.

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 27 Feb 2009 03:44:16 -0800 (PST)
From: Krishna Chaitanya <schaitan@gmail.com>
Subject: Re: Using Perl to connect a Linux box to Linux/Windows boxes
Message-Id: <23f4376f-44cc-4141-a5a6-a3c0d1e9011e@r36g2000prf.googlegroups.com>

Linux->Linux : key exchange is not in my hands.....the client's
network admin will most probably not allow that practice. I've to do
the expect-like thing to get around authentication. Will checkout
sudo ...

Linux->Windows: Again, I have no control on what is present on the
Windows boxes in the client's network. This push installer has to work
in most cases which would kinda leave sshd out of picture as normally
Windows network admins rely on the domain controller's power. :(

Would it help to know that this installer has to work for plain-
vanilla windows boxes without any sshd server or so running on
them....any way?

Thanks, Ben.

-Chaitanya


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

Date: Fri, 27 Feb 2009 12:37:02 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Using Perl to connect a Linux box to Linux/Windows boxes
Message-Id: <ec3l76-3u9.ln1@osiris.mauzo.dyndns.org>


Quoth Krishna Chaitanya <schaitan@gmail.com>:
> Linux->Linux : key exchange is not in my hands.....the client's
> network admin will most probably not allow that practice. I've to do
> the expect-like thing to get around authentication. Will checkout
> sudo ...

Um, if you've never heard of sudo I would venture to suggest that you
are not qualified to write something like this. Running commands as root
on a remote machine is an extremely security-sensitive operation.

> Linux->Windows: Again, I have no control on what is present on the
> Windows boxes in the client's network. This push installer has to work
> in most cases which would kinda leave sshd out of picture as normally
> Windows network admins rely on the domain controller's power. :(
> 
> Would it help to know that this installer has to work for plain-
> vanilla windows boxes without any sshd server or so running on
> them....any way?

I know of no way of remotely running arbitrary commands on a vanilla
windows box. Win2k came with a telnet server, but it was disabled by
default. I don't know if it's still present in later versions of
windows, and in any case I would not recommend using telnet for anything
nowadays. AFAIK the 'recommended' way of doing remote installs is by
pushing an MSI down from the domain controller; I know there's an MSI
dev kit called WiX available for free from Microsoft, but I've no idea
how to use it.

Ben



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

Date: Fri, 27 Feb 2009 19:23:32 GMT
From: Josef Feit <jfeit@ics.muni.cz>
Subject: Re: utf8 and chomp
Message-Id: <KFqo9L.7nH@news.muni.cz>

Thanks to all who helped.
Now some of my (rather long lasting) utf8 problems
should be solved.

JF


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

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


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