[25950] in Perl-Users-Digest
Perl-Users Digest, Issue: 8169 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 13 11:05:29 2005
Date: Mon, 13 Jun 2005 08:05:06 -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 Mon, 13 Jun 2005 Volume: 10 Number: 8169
Today's topics:
Re: ActiveState: Can't spawn "cmd.exe"? <occitan@esperanto.org>
Re: ActiveState: Can't spawn "cmd.exe"? <sisyphus1@nomail.afraid.org>
Re: Glob Q <shawn.corey@sympatico.ca>
Re: Masking by columns for grep (Anno Siegel)
Re: mod_perl error <""alexjaquet\"@[no spam]msn.com">
Re: mod_perl error <mark.clementsREMOVETHIS@wanadoo.fr>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 13 Jun 2005 10:38:40 +0200
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Re: ActiveState: Can't spawn "cmd.exe"?
Message-Id: <42AD4610.8060109@esperanto.org>
la 13.06.2005 04:23 Sisyphus skribis:
> "Daniel Pfeiffer" <occitan@esperanto.org> wrote in message
> news:42AC1642.1090906@esperanto.org...
>> This single string gets passed to the system function:
>>
>>echo nocc -g -I subdir1 -I- -Isubdir2 -c compilation_test.c -o
>
> compilation_test.o
>
>>This gives a warning (I installed a $SIG{__WARN__} locally around system):
>>
>>Can't spawn "cmd.exe": No such file or directory at C:/TEMP/cvs/Rule.pm
>> line 1128.
>
>
>
> I don't quite understand. Line 1128 of Rule.pm is:
> system( format_exec_args( $action ));
format_exec_args is a workaround for Perl's buggy system function. When Perl
sees no special chars in the string it internally does a split on whitespace
and execs. But it misses some special characters and builtin commands. On
anything except ActiveState this function returns ('/bin/sh', '-c', $_[0]) in
such cases.
> Precisely what is the full string returned by 'format_exec_args($action)' ?
On ActiveState it returns the string verbatim.
> (I couldn't understand the meaning of "with CC set to the first two words".)
The make rule in question runs $(CC) ..., and since I'm not yet at the point
of messing with the weirdness of Windows compilers, I "set CC=echo nocc".
>>And system gives a return of 255 << 8. What could be causing this, and
>
> how
>
>>could it be evited?
>>
>>NB: Passing the identical string to perl -e "system '...'" works just
>
> fine.
>
>
> The "identical string" is the string returned by 'format_exec_args($action)'
> ..... right ?
Yes.
> And it's working fine in the 'perl -e....' system call, but producing that
> error when run from Rule.pm .... right ?
Yes.
> When testing with ActiveState perl what shell are you running in ?
Normal DOS command window, so I suppose cmd.exe.
> When testing with MinGW perl what shell are you running in ?
/usr/bin/sh which is MinGW's bash 2.04.
> Could it be that you're invoking the wrong shell without realising it?
Probably! In all three environments, I reduce the PATH to a minimum, so as to
not get any "goodies" from another environment. E.g. ActiveState would
happily pick up Unix commands from MKS, MinGW and Cygwin, so I do
set PATH=C:\WINNT\system32;C:\WINNT;C:\Perl\bin
The first directory contains CMD.EXE. (Which answers your 2nd post). The
funny thing is that when I don't reduce the PATH, something does happen. I
modified export.test to do
echo %X% %Y% >testfile
and then testfile contains the line "Syntaxfehler." (german for error), which
is not what happens when I type that command in the DOS window.
Thanks for taking so much time!
Daniel
------------------------------
Date: Mon, 13 Jun 2005 21:15:13 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: ActiveState: Can't spawn "cmd.exe"?
Message-Id: <42ad6acc$0$15470$afc38c87@news.optusnet.com.au>
"Daniel Pfeiffer" <occitan@esperanto.org> wrote in message
news:42AD4610.8060109@esperanto.org...
> la 13.06.2005 04:23 Sisyphus skribis:
> > "Daniel Pfeiffer" <occitan@esperanto.org> wrote in message
> >
> > The "identical string" is the string returned by
'format_exec_args($action)'
> > ..... right ?
>
> Yes.
>
> > And it's working fine in the 'perl -e....' system call, but producing
that
> > error when run from Rule.pm .... right ?
>
> Yes.
>
> > When testing with ActiveState perl what shell are you running in ?
>
> Normal DOS command window, so I suppose cmd.exe.
>
> > When testing with MinGW perl what shell are you running in ?
>
> /usr/bin/sh which is MinGW's bash 2.04.
>
Normally, perl is built using MinGW in the cmd.exe shell, following the
instructions in the README.win32 (which involves editing the
Win32\makefile.mk). It's also normal to run that perl in the cmd.exe shell.
I believe it's quite a trivial thing to run MinGW-built perl (and
ActiveState perl, too) in a bash shell, though I've not personally done
that. Not sure why I'm mentioning this .... I guess it's just that the
reference to MinGW's bash shell makes me wonder whether you've built perl
with MinGW in some unusual way .... and if that's the case I'm further
wondering whether it should be brought to your attention :-)
> > Could it be that you're invoking the wrong shell without realising it?
>
> Probably! In all three environments, I reduce the PATH to a minimum, so
as to
> not get any "goodies" from another environment. E.g. ActiveState would
> happily pick up Unix commands from MKS, MinGW and Cygwin, so I do
>
> set PATH=C:\WINNT\system32;C:\WINNT;C:\Perl\bin
>
> The first directory contains CMD.EXE. (Which answers your 2nd post).
That makes it very hard (for me) to work out why a system call that works
when invoked by 'perl -e ..' is unable to spawn the cmd.exe when called from
file (Rule.pm).
What happens if you run a script containing a system command (such as the
test.pl in my 2nd post) from that very same shell ? Does it fail to spawn
cmd.exe, too ?
Maybe:
#### test.pl ####
use warnings;
$ENV{PATH} = '';
system "cd";
__END__
D:\pscrpt>perl -lwe "system 'cd'"
D:\pscrpt
D:\pscrpt>perl try.pl
Can't spawn "cmd.exe": No such file or directory at try.pl line 3.
D:\pscrpt>perl -lwe "system 'cd'"
D:\pscrpt
That's one simple way of getting a system command to work with 'perl -e...'
but fail when called from file. Now, I'm not suggesting that Rule.pm
explicitly removes C:\winnt\system32 from the path - but could that be
happening somehow ??
I'll continue to puzzle over this, and post again if I think of something -
but it doesn't look like I'll be able to offer much help.
Maybe you could also try perlmonks if there's no useful help here.
Cheers,
Rob
------------------------------
Date: Mon, 13 Jun 2005 07:47:50 -0400
From: Shawn Corey <shawn.corey@sympatico.ca>
Subject: Re: Glob Q
Message-Id: <Dnere.1491$Qr3.266997@news20.bellglobal.com>
Jim Keenan wrote:
> Other than telling you that typeglobs are rarely used these days, I
> don't think anyone has grappled with your original question. OTOH, I've
> puzzled for days over what the context of your question is.
>
> Suppose that I simply evaluated the 3 variables above:
>
> use Data::Dumper;
>
> my $x = *VAR;
> my $y = local *VAR;
> my $z = do { local *VAR };
Actually, I'm still trying to figure out what the following is doing:
my $y = local *VAR;
This is (I think) create a local variable VAR and assign its type glob
to $y. Since VAR has no value, why would you want to do this? Shouldn't
this be:
local $y = *VAR;
--- Shawn
------------------------------
Date: 13 Jun 2005 13:07:50 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Masking by columns for grep
Message-Id: <d8k0f6$s1h$2@mamenchi.zrz.TU-Berlin.DE>
Brian McCauley <nobull@mail.com> wrote in comp.lang.perl.misc:
>
>
> Jim Gibson wrote:
> > In article <42a7cd2b_2@news1.prserv.net>, Shannon Jacobs
> > <shanen@cashette.com> wrote:
> >
> >
> >>Shannon Jacobs wrote:
> >><snip>
> >>
> >>>@foo = grep(/.{50}$theString.{6},@foo);
> >>
> >>Should be:
> >>
> >>@foo = grep(/.{50}$theString.{6}/,@foo);
> >>
> >
> >
> > If you really want to ignore the first 50 columns and ignore the last
> > 6, you should anchor your pattern:
> >
> > @foo = grep(/^.{50}$theString.{6}$/,@foo);
>
> Actually sinde the OP stated fixed length records you can ignore the
> last 6 by, er, simply ignoring them.
>
> @foo = grep(/^.{50}\Q$theString/,@foo);
>
> (Note: \Q inserted as per other branch of this thread as $theString is a
> target string not a target regex).
Another way to skip the first 50 (untested):
@foo = grep /\G\Q$theString/, map pos = 50, @foo;
It's longer, but it may be faster (or not) if efficiency matters.
Anno
------------------------------
Date: Mon, 13 Jun 2005 09:59:28 +0200
From: Alexandre Jaquet <""alexjaquet\"@[no spam]msn.com">
Subject: Re: mod_perl error
Message-Id: <42ad3ce1$0$1154$5402220f@news.sunrise.ch>
Mark a écrit :
> Alexandre Jaquet wrote:
>
>> Hi,
>>
>> I'm trying to run a script under mod_perl and I got the following
>> error : ModPerl::Registry : Undefined subroutine CGI:delete
>>
>> I've done some search about it but didn't find anything.
>>
>> Here is a short part of my script :
>>
> <snip>
>
> Your script doesn't contain anything mod_perl specific. Have you copied
> and pasted the error message or retyped it? It looks suspicious. Which
> version of mod_perl are you using? The API changed in quite a late 2.0.0
> release candidate.
>
> I would guess you have a mod_perl installation or configuration issue.
> Possibly you have conflicting mod_perl modules on your system. What
> happens when you try to run a bare-bones script?
>
> eg
>
> use warnings;
> use strict;
>
> use CGI;
>
> BEGIN {
> our $test = 0;
>
> };
>
> my CGI $cgi = CGI->new();
> our $test;
> $test++;
> print $cgi->header();
>
> print "count = $test\n";
>
> Mark
still having the same error message
I'm running Apache/2.0.44 (Win32) mod_perl/1.99_08 Perl/v5.8.6 Server
on windows xp with indigoperl bundle of perl / apache / mod_perl
------------------------------
Date: Mon, 13 Jun 2005 12:15:38 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: mod_perl error
Message-Id: <1hufx5bqjdxbh.11nu31ks0c5te$.dlg@40tude.net>
On Mon, 13 Jun 2005 09:59:28 +0200, Alexandre Jaquet wrote:
> Mark a écrit :
>> Alexandre Jaquet wrote:
>>
>>> Hi,
>>>
>>> I'm trying to run a script under mod_perl and I got the following
>>> error : ModPerl::Registry : Undefined subroutine CGI:delete
>>>
>>> I've done some search about it but didn't find anything.
>>>
>>> Here is a short part of my script :
>>>
>> <snip>
>>
>> Your script doesn't contain anything mod_perl specific. Have you copied
>> and pasted the error message or retyped it? It looks suspicious. Which
>> version of mod_perl are you using? The API changed in quite a late 2.0.0
>> release candidate.
>>
>> I would guess you have a mod_perl installation or configuration issue.
>> Possibly you have conflicting mod_perl modules on your system. What
>> happens when you try to run a bare-bones script?
>>
>> eg
>>
>> use warnings;
>> use strict;
>>
>> use CGI;
>>
>> BEGIN {
>> our $test = 0;
>>
>> };
>>
>> my CGI $cgi = CGI->new();
>> our $test;
>> $test++;
>> print $cgi->header();
>>
>> print "count = $test\n";
>>
>> Mark
>
> still having the same error message
> I'm running Apache/2.0.44 (Win32) mod_perl/1.99_08 Perl/v5.8.6 Server
> on windows xp with indigoperl bundle of perl / apache / mod_perl
Try it without using the CGI module. Also, you need to copy-and-paste your
error message.
Mark
------------------------------
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 8169
***************************************