From: Ilya Zakharevich on
C::Scan module uses this construct

my $cmd = qq(echo '#include "$filename"' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |);

Obviously, is supposes Bourne (or C) shell; so this breaks on ports
which use DOSISH shells.

a) is $^O =~ /win32/i a fool-proof way to detect such ports?

b) if so, where is it documented? (I want to comment this edit in details)

Thanks,
Ilya

P.S. I grepped through ./pod/* of 5.8.8, and did not find any info...
From: Ben Morrow on

Quoth Ilya Zakharevich <nospam-abuse(a)ilyaz.org>:
> C::Scan module uses this construct
>
> my $cmd = qq(echo '#include "$filename"' | $Cpp->{cppstdin} $Defines
> $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |);
>
> Obviously, is supposes Bourne (or C) shell; so this breaks on ports
> which use DOSISH shells.
>
> a) is $^O =~ /win32/i a fool-proof way to detect such ports?

DOS itself ($^O eq "dos") is dead. I presume you know better than I what
shell is available on OS/2. NetWare, however, also sets $^O = "Win32",
but looking at ExtUtils::MM_NW5 suggests that it has (or can have?
$ENV{EMXSHELL} seems to be important) a shish shell.

As for other shells, MacOS Classic and RISC OS are dead, and the Symbian
port is no longer maintained, so I believe that leaves VMS.

> b) if so, where is it documented? (I want to comment this edit in details)

Well, grepping through perlport for 'shell' gives some answers, and the
entry in that file for 'system' gives some more. I don't know that
there's any definitive list anywhere of which platforms use which shell:
that's an OS matter, and outside the remit of the perl docs. I believe
that all supported (and formerly supported) platforms are listed in
perlport, though, together with their respective values for $^O.

Ben

From: Ilya Zakharevich on
On 2010-03-04, Ben Morrow <ben(a)morrow.me.uk> wrote:
>> C::Scan module uses this construct
>>
>> my $cmd = qq(echo '#include "$filename"' | $Cpp->{cppstdin} $Defines
>> $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |);
>>
>> Obviously, is supposes Bourne (or C) shell; so this breaks on ports
>> which use DOSISH shells.
>>
>> a) is $^O =~ /win32/i a fool-proof way to detect such ports?
>
> DOS itself ($^O eq "dos") is dead. I presume you know better than I what
> shell is available on OS/2. NetWare, however, also sets $^O = "Win32",
> but looking at ExtUtils::MM_NW5 suggests that it has (or can have?
> $ENV{EMXSHELL} seems to be important) a shish shell.
>
> As for other shells, MacOS Classic and RISC OS are dead, and the Symbian
> port is no longer maintained, so I believe that leaves VMS.

Thanks for this info. However, I do not see what is the relationship
of this list of dead platforms (whatever this means) to my question...

Reiterating again: is there a way to distinguish (e.g., a Windows)
port which uses "native" shell vs Korn-syntax shell.

> that's an OS matter, and outside the remit of the perl docs.

This, of course, has nothing to do with OS. Just what the creator of
a particular port decided to use as a shell. (And, repeating myself:
IMO, if people would listen to me a decade ago, one would not have
this mess at all - all shells would use Bourne syntax...)

And having docs mentioning how to write portable code would be nice,
would not it?

Thanks,
Ilya
From: Martin Str|mberg on
Ilya Zakharevich <nospam-abuse(a)ilyaz.org> wrote:
> my $cmd = qq(echo '#include "$filename"' | $Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |);

> Obviously, is supposes Bourne (or C) shell; so this breaks on ports
> which use DOSISH shells.

> a) is $^O =~ /win32/i a fool-proof way to detect such ports?

If you still support dos, this isn't fool-proof.


--
MartinS
From: Ben Morrow on

Quoth Ilya Zakharevich <nospam-abuse(a)ilyaz.org>:
> On 2010-03-04, Ben Morrow <ben(a)morrow.me.uk> wrote:
> >> C::Scan module uses this construct
> >>
> >> my $cmd = qq(echo '#include "$filename"' | $Cpp->{cppstdin} $Defines
> >> $addincludes $Cpp->{cppflags} $Cpp->{cppminus} |);
> >>
> >> Obviously, is supposes Bourne (or C) shell; so this breaks on ports
> >> which use DOSISH shells.
> >>
> >> a) is $^O =~ /win32/i a fool-proof way to detect such ports?
> >
> > DOS itself ($^O eq "dos") is dead. I presume you know better than I what
> > shell is available on OS/2. NetWare, however, also sets $^O = "Win32",
> > but looking at ExtUtils::MM_NW5 suggests that it has (or can have?
> > $ENV{EMXSHELL} seems to be important) a shish shell.
> >
> > As for other shells, MacOS Classic and RISC OS are dead, and the Symbian
> > port is no longer maintained, so I believe that leaves VMS.
>
> Thanks for this info. However, I do not see what is the relationship
> of this list of dead platforms (whatever this means) to my question...
>
> Reiterating again: is there a way to distinguish (e.g., a Windows)
> port which uses "native" shell vs Korn-syntax shell.

Sorry, I thought your question was 'which platforms use DOSish shells'
not 'are there any Win32 ports which don't'. There is presently only one
Win32 port, the one in the core, and that uses $ENV{PERL5SHELL} to
decide which shell to use, falling back to command.com/cmd.exe if it's
empty.

> > that's an OS matter, and outside the remit of the perl docs.
>
> This, of course, has nothing to do with OS. Just what the creator of
> a particular port decided to use as a shell.

Meh. IMHO a perl which doesn't use the same shell as used by system(3)
in the standard C library is somewhat broken.

> (And, repeating myself:
> IMO, if people would listen to me a decade ago, one would not have
> this mess at all - all shells would use Bourne syntax...)

So you would have Win32 perl ship with a sh.exe, and use that for system
and exec? I suspect that would have made Win32 people coming to perl
rather unhappy.

> And having docs mentioning how to write portable code would be nice,
> would not it?

The docs repeatedly suggest avoiding the shell wherever possible, and
doing things in Perl instead.

Ben