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

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 ?

Replies are listed 'Best First'.
Re^5: How to print out package code ?
by choroba (Cardinal) on Mar 18, 2013 at 21:50 UTC
    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 ?

        Martin90:

        If it's a module found on CPAN, you can always download the package, untar it and brows the source to your hearts content.

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.