[Catalyst] Why does $c->stats require -Debug flag?

Jon Schutz jon+catalyst at youramigo.com
Mon Apr 21 03:19:56 BST 2008


On Sun, 2008-04-20 at 15:15 +0100, Matt S Trout wrote:

> So far as I can see, all we really need to do is supply a proxy of the
> common Tree::Simple method from the C::Stats object through to $self->{tree}
> and we're done. That'll provide compatibility with obvious usages without
> adding any significant compatibility overhead.
> 
> I was hoping Jon would do this because he was the original author of C::Stats
> and could see any subtleties that needed paying attention to that I've
> missed.
> 

I would have to review the pre-5.7012 code but from memory there were
some differences in when internal fields in the tree were set, so
returning $self->{tree} will stop crashes but there may be some side
effects, such as inaccuracies in the resulting reports.

Trouble with explicitly proxying the methods is that Tree::Simple has
many methods and who knows how many people have used what out there (I
suspect, very few and very little, but who knows?).

You've heard my objections on principle and resistance due to minimal
residual impact in practice, but if one were to fix it, I suppose a
simple compromise would be something like this (untested):

our $AUTOLOAD;

sub AUTOLOAD {
    my $self = shift;

    my $name = $AUTOLOAD;
    $name =~ s/.*://o;
    warn "Catalyst::Stats method $name is deprecated.";
    return $self->{tree}->$name(@_);
}

-- 
Jon Schutz                        My tech notes http://notes.jschutz.net
Chief Technology Officer                        http://www.youramigo.com
YourAmigo         




More information about the Catalyst mailing list