Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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!

Replies are listed 'Best First'.
Re: Output capture of CPAN shell
by marto (Bishop) on Dec 05, 2012 at 16:55 UTC
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.
Re: Output capture of CPAN shell
by LanX (Chancellor) 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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1007333]
Front-paged by Arunbear
[marinersk]: And what fact are you curious about, Discipulus?

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2017-05-30 08:04 GMT
Find Nodes?
    Voting Booth?