EntropyOrg / p5-Devel-IPerl

:microscope::books: Perl5 language kernel for Jupyter <http://jupyter.org/>
http://p3rl.org/Devel::IPerl
93 stars 15 forks source link

stty: stdin isn't a terminal #31

Closed demianriccardi closed 9 years ago

demianriccardi commented 9 years ago

using the command line from a cell with back ticks worked for me before (e.g. perldoc Foo::Bar), but not with the most recent changes.

zmughal commented 9 years ago

Oh, this is a particular issue with using a backtick on perldoc. perldoc tries to detect if it is on a terminal or not.

Try:

print `perldoc Try::Tiny 2>/dev/null`;
zmughal commented 9 years ago

You can make a helper function for that too!

IPerl->helper( get_perldoc => sub {
    shift;
    print `perldoc @_ 2>/dev/null`;
    return; # so that the final return value is not printed
});

# ...
IPerl->get_perldoc('Try::Tiny');
zmughal commented 9 years ago

Or, if you want to get fancy:

IPerl->helper( get_perldoc => sub {
    shift;
    my $html =  `perldoc -ohtml @_ 2>/dev/null`;
    return IPerl->html( $html );
});

# ...
IPerl->get_perldoc('Try::Tiny');
zmughal commented 9 years ago

Here's what it looks like: http://nbviewer.ipython.org/github/zmughal/zmughal-iperl-notebooks/blob/master/IPerl-demos/20150211_An_IPerl_helper_for_perldoc_HTML.ipynb.

selection_107

demianriccardi commented 9 years ago

WOW!