in reply to Re: Re: Re: Safe::Logs - Feedback appreciated
in thread Safe::Logs - Feedback appreciated

Another approach is to subclass the module, or intercept calls. For a work project, I wasn't happy with the Pod::Html output, so I hacked in some changes that vary depending on the version:

sub per_version { if ($Pod::Html::VERSION eq '1.01') { # perl5.005_03 *Pod::Html::process_text2 = \&Pod::Html::process_text1; undef *Pod::Html::process_text1; *Pod::Html::process_text1 = \&my_process; @options = qw/ --recurse --header /; } elsif ($Pod::Html::VERSION =~ /^1\.0[34]$/) { # perl-5.6.0, 5.6.1, 5.8.0 *Pod::Html::process_L2 = \&Pod::Html::process_L; undef *Pod::Html::process_L; *Pod::Html::process_L = \&my_oldprocess; @options = qw/ --recurse /; } else { die "Don't know how to hack Pod::Html v$Pod::Html::VERSION\n"; } sub my_process ($$;$$) { my($lev, $rstr, $func, $closing) = @_; my $closer = '>' x (($closing||0) + 1); if ($func && $func eq 'L') { # suppress 'the ... manpage' markup $$rstr =~ s{^ ^ ( \w+ (?: ::\w+ )* ) (?: -(?!$closer)> (\w+) )? (.*?) (\s* $closer) }{ defined($2) ? qq{$1-E<gt>$2$3|$1/"item_$2$4} : "$1$3|$1$4" }xe; } Pod::Html::process_text2($lev, $rstr, $func, $closing); } sub my_oldprocess { my($str) = @_; $str =~ s,^(\w+(::\w+)*)$,$1|$1/,; Pod::Html::process_L2($str); }

This approach isn't always the right one, but it's a useful tool to have.

Hugo

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Safe::Logs - Feedback appreciated
by demerphq (Chancellor) on Mar 04, 2003 at 13:59 UTC

    I did something like this at the beginning. I set up patches for MIME::Lite and then included the patches in the distribution for my code. When makefile.pl ran it would check the version of MIME::Lite and if it was unpatched (turns out that MIME::Lites version string doesnt compare properly) it would apply the patch first. The problem is that I work on Win32 so having patch handy wasnt guarenteed, yada yada. In the end it was much simpler just to modify the released version and include it directly. Although overriding existing subs with new code never occured to me I admit.

    Incidentally are you aware of any CPAN policy for unmaintained modules? Is there a "takeover" mechanism available or not? Have the senior Perl people ever discussed this?

    ---
    demerphq


      I seem to remember there was a p5p discussion about policy for unmaintained modules some time last year, and I think someone set up a website to highlight modules in limbo. But I'm afraid I can't find the thread back right now, nor the bookmark - please let me know if you manage to track down either of them.

      Hugo