Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Output capture of CPAN shell

by jjap (Monk)
on Dec 05, 2012 at 16:51 UTC ( [id://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 (Cardinal) 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 (Saint) 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-03-19 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found