Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

How to get installtion Perl modules log?

by Misha (Acolyte)
on Oct 23, 2007 at 13:47 UTC ( [id://646685]=perlquestion: print w/replies, xml ) Need Help??

Misha has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

Sorry for asking again but am really stuck with this. I need to collect output of Perl modules installation. I am running on UNIX environment.
I am installing Perl modules (via Perl script) by using following command:
system (" perl -MCPAN -e 'install Bundle::Snapshot_2007_07_23_00' ")
The installation completed successfully.
In order to collect logs and see the output on the screen (because installation of some models is interactive) I did following changes:
system (" perl -MCPAN -e 'install Bundle::Snapshot_2007_07_23_00' | './1.pl' ")
when 1.pl is very simple:

while ($tmp = <STDIN> || $tmp = <STDERR>)
{
print $tmp;
write_to_log($tmp);
}

Now have 3 problems:
1. The interactive questions which were during installation are missing.
2. The program stuck during the modules installation.
3. The output is different from what I have before and some important parts are missing.

How I can solve those problems? Is there other way to collect Perl module installation logs?

Many thanks
  • Comment on How to get installtion Perl modules log?

Replies are listed 'Best First'.
Re: How to get installtion Perl modules log?
by moritz (Cardinal) on Oct 23, 2007 at 13:58 UTC
    Why didn't you use script as I previously suggested?

    You current approach doesn't log everything because some things might be written to STDERR which the redirect doesn't capture.

    Also CPAN might write directly to the terminal (instead of STDIN/STDOUT) which could be the reason why you don't see it.

    script takes care of such things, which is why I suggested it.

    By the way: your perl script 1.pl has a unix equivalent, it's called tee

    Update: Another solution could use Expect.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://646685]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-25 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found