pospos | tiens, j'avais fait une petite version en Tk plus simple à utilser (et un peu porcho), et qui peu aussi chercher dans les faq ou directement dans les pod des modules (en indiquant le nom complet du module, si il est installé):
Code :
- #!/usr/bin/perl
- use strict;
- use Tk;
- use Tk::ROText;
- use Tk::Radiobutton;
- use Tk::Font;
- $|=1;
- my $mw = tkinit();
- my $search;
- my $instruction = 'f';
- my $wEntry = $mw->Entry(
- -width => 50,
- -font => $mw->Font(-size => 14),
- -textvariable => \$search,
- )->grid(-row => 0, -column => 0);
- $mw->Button(
- -width => 20,
- -text => 'search',
- -command => \&search,
- )->grid(-row => 0, -column => 1);
- $mw->Radiobutton(
- -width => 20,
- -anchor => 'w',
- -variable => \$instruction,
- -value => 'f',
- -text => 'functions',
- )->grid(-row => 1, -column => 1);
- $mw->Radiobutton(
- -width => 20,
- -anchor => 'w',
- -variable => \$instruction,
- -value => 'q',
- -text => 'FAQ',
- )->grid(-row => 2, -column => 1);
- $mw->Radiobutton(
- -width => 20,
- -anchor => 'w',
- -variable => \$instruction,
- -value => 't',
- -text => 'Pod',
- )->grid(-row => 3, -column => 1);
- my $wText = $mw->Scrolled(
- 'ROText',
- -scrollbars => 'se',
- -font => $mw->Font(-size => 14),
- -width => 80,
- -height => 30,
- -wrap => 'none',
- )->grid(-row => 20, -column => 0, -columnspan => 2);
- $mw->bind("<KeyPress-Return>" => \&search);
- tie(*STDOUT, 'Tk::ROText', $wText);
- tie(*STDERR, 'Tk::ROText', $wText);
- $wEntry->focus;
- MainLoop;
- sub search {
- printH($search);
- my $result = `perldoc -$instruction $search`;
- if (length($result)) {
- print $result;
- } else {
- print "Empty";
- }
- print "\n\n";
- }
- sub printH {
- my $msg = join('', @_);
- my $symbol = "#";
- print "\n";
- print $symbol x (length($msg) + 6);
- print "\n$symbol$symbol ", $msg, " $symbol$symbol\n";
- print $symbol x (length($msg) + 6);
- print "\n";
- }
|
|