Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^3: How to print out package code ?

by choroba (Canon)
on Mar 18, 2013 at 21:20 UTC ( #1024154=note: print w/ replies, xml ) Need Help??

in reply to Re^2: How to print out package code ?
in thread How to print out package code ?

You are opening the file for each line, overwriting the previous output. Open it just once before entering the loop.

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Comment on Re^3: How to print out package code ?
Replies are listed 'Best First'.
Re^4: How to print out package code ?
by Martin90 (Sexton) on Mar 18, 2013 at 21:44 UTC
    Unfortunatelly, still doesn't work. Now, I am getting empty file ;/
    my @tab; open MODULE, "perldoc -m ModuleX|" or die "Failed to open pipeline +($!)"; open(X,"> xxx_dump.txt")|| warn "Fail: ($!)"; while (<MODULE>) { @tab = split; foreach $_ (@tab) { print X $_; } } close X; close MODULE;
    What is wrong ? Maybe perldoc -m ModuleX doesn't work with used modules ?
      Why did you introduce @tab and the inner loop? This works for me:
      open MODULE, "perldoc -m ModuleX |" or die "Failed to open pipeline($! +)"; open(X,"> xxx_dump.txt")|| warn "Fail: ($!)"; while (<MODULE>) { print X $_; } close X; close S;
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        Yes you are right, it works but not for my module which before is attached to script is decompiled by .so file. Have you got good solution for this case ?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024154]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2015-11-27 08:09 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (720 votes), past polls