Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Output capture of CPAN shell

by jjap (Monk)
on Dec 05, 2012 at 16:51 UTC ( #1007333=perlquestion: print w/ replies, xml ) Need Help??
jjap has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

The installation of a module fails (PDL in this instance). I am running Strawberry Perl. I just want to capture the cpan shell output for further examination.

I intuitively tried the following with no success:
cpan> install PDL > c:\path\logfile
Thanks for any suggestion

UPDATE: Needed to double escape the backslashes (Windows) in the path, I should have though of it. Thanks!
UPDATE 2: Clarification brought following greengaroo's reply, indeed one is in Perl when at the cpan prompt!

Comment on Output capture of CPAN shell
Download Code
Re: Output capture of CPAN shell
by marto (Bishop) on Dec 05, 2012 at 16:55 UTC
Re: Output capture of CPAN shell
by LanX (Canon) on Dec 05, 2012 at 16:59 UTC
    cpan modulename >/tmp/log

    works for me

    Could be that you need to redirect STDERR too.

    cpan modulename >/tmp/log 2> /tmp/err

    Cheers Rolf

Re: Output capture of CPAN shell
by greengaroo (Hermit) on Dec 05, 2012 at 21:56 UTC

    Why do you think you need to double the backslash on Windows? It's not because of Windows, it's because Perl uses the backslash as the escape character.

    In your first attempt, Perl was trying to escape "p" and "l", converting regular characters to special characters, but then the path you were trying to reach didn't exists.

    In your second attempt, you double the backslash, basically you escape the special character "\" and it becomes a regular character, so Perl really see a backslash, and the path now exists.

    But, in Perl on Windows, you can also use the forward slash "/" in file paths.

    Hope this help you understand what was going on internally.

    Testing never proves the absence of faults, it only shows their presence.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1007333]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2014-12-18 15:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (56 votes), past polls