Skip Menu |

This queue is for tickets about the Term-Shell CPAN distribution.

Report information
The Basics
Id: 2463
Status: open
Priority: 0/
Queue: Term-Shell

People
Owner: Nobody in particular
Requestors: corion [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: run_help does not produce a summary via catch_smry
(I already posted this to you via mail, but as people had problems with "nonexistent" online help, and I forgot that I patched my local version of Term::Shell, I'm posting the report here again) The summary does not get filled for commands that are caught via a catch_smry handler. The fix is to always call $o->summary(), and worry later. In sub summary : #my $smry = exists $o->{handlers}{$h}{smry} #? $o->summary($h) #: "undocumented"; my $smry = $o->summary($h); $smry = 'undocumented' unless defined $smry and length $smry; The error happens under Perl 5.6.1 and Perl 5.8.
[CORION - Wed Apr 30 12:34:34 2003]: Attached is the test I use ...
use strict; use Test::More tests => 1; { package Catch; sub TIEHANDLE { my($class, $var) = @_; return bless { var => $var }, $class; } sub PRINT {}; }; SKIP: { #skip "Can't load Term::ReadKey without a terminal", 1 # unless -t STDIN; eval { require Term::ReadKey; Term::ReadKey::GetTerminalSize() }; if ($@) { diag "Term::ReadKey seems to want a terminal"; no warnings 'redefine'; *Term::ReadKey::GetTerminalSize = sub {80,24}; }; # Now check that the Term::Shell summary calls catch_smry require Term::Shell; use vars qw( $called ); { package Term::Shell::Test; use base 'Term::Shell'; sub summary { $::called++ }; sub print_pairs {}; }; my $s = { handlers => { foo => { run => sub {}}} }; bless $s, 'Term::Shell::Test'; { local *STDOUT; tie *STDOUT, 'Catch'; $s->run_help(); }; if (not is($called,1,"Term::Shell::Test::catch_smry gets called for unknown methods")) { diag "Term::Shell did not call a custom catch_smry handler"; diag "This is most likely because your version of Term::Shell"; diag "has a bug. Please upgrade to v0.02 or higher, which"; diag "should close this bug."; diag "If that is no option, patch sub help() in Term/Shell.pm, line 641ff."; diag "to:"; diag ' #my $smry = exists $o->{handlers}{$h}{smry};'; diag ' #? $o->summary($h);'; diag ' #: "undocumented";'; diag ' my $smry = $o->summary($h);'; diag 'Fixing this is not necessary - you will get no online help'; diag 'but the shell will otherwise work fine. Help is still'; diag 'available through ``perldoc WWW::Mechanize::Shell``'; }; };
Hi Max, does this bug still happen with Term-Shell-0.04? If so, can you provide a patch (or better - a pull request) against the git repository: https://github.com/shlomif/Term-Shell Note that the test program needs some cleanups and modernisations. Regards, -- Shlomi Fish?
Subject: Re: [rt.cpan.org #2463] run_help does not produce a summary via catch_smry
Date: Mon, 10 Jun 2013 18:33:41 +0200
To: bug-Term-Shell [...] rt.cpan.org
From: Max Maischein <corion [...] cpan.org>
Hello Shlomi, thank you for maintaining Term::Shell! Show quoted text
> does this bug still happen with Term-Shell-0.04?
No, it seems the bug is fixed - at least my test case as attached to the bug report, and also included with WWW::Mechanize::Shell, passes now. Show quoted text
> Note that the test program needs some cleanups and modernisations.
Do you mean the test program as attached to the bug report or a different test program? Thanks for working on the bug queue! -max
Hi Max, thanks for the quick response. On Mon Jun 10 12:34:15 2013, CORION wrote: Show quoted text
> Hello Shlomi, > > thank you for maintaining Term::Shell! >
you are welcome. Show quoted text
> > does this bug still happen with Term-Shell-0.04?
> No, it seems the bug is fixed - at least my test case as attached to the > bug report, and also included with WWW::Mechanize::Shell, passes now.
Ah, OK. That's good. Show quoted text
>
> > Note that the test program needs some cleanups and modernisations.
> Do you mean the test program as attached to the bug report or a > different test program?
The one attached to the bug report. Show quoted text
> Thanks for working on the bug queue!
You're welcome. Regards, — Shlomi Fish