Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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 (Bishop) 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
and a log crumbles through the grate...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2018-02-21 23:43 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (288 votes). Check out past polls.