Subject: | second call to sub process fails |
Date: | Tue, 18 Oct 2011 09:38:06 +0200 |
To: | "bug-Pod-Perldoc [...] rt.cpan.org" <bug-Pod-Perldoc [...] rt.cpan.org> |
From: | Christian Holland <Christian.Holland [...] NashTech.Com> |
Hi all,
this is the first time I repoort a bug from a perl module, so I try my best.
E.g.
PERLDOC=-T perl -e 'use Pod::Perldoc; my $p=Pod::Perldoc->new; $p->{formatter_classes}=[Pod::Perldoc::ToPod]; $p->{args}=[perldoc]; $p->process; $p->process;'
My analysis:
First time calling "sub process" is ok.
Second time it calls as before "sub find_good_formatter_class".
In "sub find_good_formatter_class" exists two
local hashes "%class_seen" and "%class_loaded".
In the "foreach" in "sub find_good_formatter_class":
1. nowhere %class_loaded is set (as I see), but checked.
2. %class_seen is checked "if($class_seen{$c})" and
set "$class_seen{$c} = 1" afterwards.
So first time the module is loaded (eval "require $c").
But a second call will skip the successful loaded module and try next one.
So I recommend to set "$class_loaded{$c} = 1" after successful loading.
As far I can see this bug exists in every version of Pod::Perldoc
Regards
Christian