Public feed #1356604

Calldepth

public text v1 · immutable
Raw Edit
·published 2009-03-09 16:37 UTC
rendered paste body
a(40);
sub a {
        print calldepth(),$/;
        if ($_[0] > 0) { a($_[0]-1); }
}
sub calldepth {
        my $i = 0;
        while(  @a = caller($i++) ) {

        }
        return $i - 1;
}