On Nov 23, 2007 11:36 PM, Matisse Enzer <[EMAIL PROTECTED]> wrote:
>
> On Nov 21, 2007, at 2:44 PM, Michael G Schwern wrote:
> >
> > While it is not documented, you can override what perl CPAN.pm uses
> > with
> > $CPAN::Shell.  So you can write a little @INC modification module
> > and set
> >
> >       $CPAN::Shell = "$^X -MINC::Surgery";
>
>
> I think it is actually
>      $CPAN::Perl
> and, if the value you use contains any whitespace the entire command
> will get quoted, which could break things.

I think this is because the assumption is that the spaces will be due
to spaces in the path (such as on Win32), not spaces due to
command/argument separator.

> For example, if you set:
>
>    $CPAN::Perl = "$^X -MINC::Surgery";
>
> then CPAN will convert that to:
>
>        'perl -MINC::Surgery'
> and if you have any makepl_args then:
>
>       'perl -MINC::Surgery' INSTALL_BASE=/some/path
>
> which will break when CPAN calls:
>        system('perl -MINC::Surgery' INSTALL_BASE=/some/path);
> with "file not found".
>
> If you include some quotes when setting  $CPAN::Perl then the auto-
> quoting won't happen:
>
>     $CPAN::Perl = "$^X -M'INC::Surgery'";  # Will not get "safe_quote"

On win32 you would want to quote $^X, as it could very likely (and
annoyingly) resolve to

"C:\program files\perl\bin\perl.exe"

And given that you can create directories with spaces in them on Linux
as well I guess the same applies there, although the likely its needed
is much lower.

I think maybe what you really want to do is use the environment
variable PERL5OPT for this instead of messing with $CPAN::Perl.

$ENV{PERL5OPT}='-MINC::Surgery';

before spawning a new perl process should do the trick.

Yves



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Reply via email to