Subject: | [PATCH] delay building of stack trace's frames |
The latest Devel::StackTrace has code to delay trace processing, however
Exception::Class::base calls frame method in its constructor what mkaes
all those performance improvements in D::ST useless.
This patch delays any frame related calls.
--
Best regards, Ruslan.
Subject: | EC-1.24-delay_trace_frames_building.patch |
Only in Exception-Class-1.24-my/: Makefile
Only in Exception-Class-1.24-my/: blib
diff -ur Exception-Class-1.24/lib/Exception/Class.pm Exception-Class-1.24-my/lib/Exception/Class.pm
--- Exception-Class-1.24/lib/Exception/Class.pm 2008-03-30 21:27:48.000000000 +0400
+++ Exception-Class-1.24-my/lib/Exception/Class.pm 2008-10-21 10:01:42.000000000 +0400
@@ -223,13 +223,26 @@
# Create accessor routines
BEGIN
{
- my @fields = qw( message pid uid euid gid egid time trace package file line );
+ my @fields = qw( message pid uid euid gid egid time trace);
no strict 'refs';
foreach my $f (@fields)
{
*{$f} = sub { my $s = shift; return $s->{$f}; };
}
+
+ my %trace_fields = (package => 'package', file => 'filename', line => 'line');
+ while (my ($f, $m) = each %trace_fields)
+ {
+ *{$f} = sub {
+ my $s = shift;
+ return $s->{$f} if exists $s->{$f};
+
+ my $frame = $s->trace->frame(0);
+ return $s->{$f} = undef unless $frame;
+ return $s->{$f} = $frame->$m();
+ };
+ }
*{'error'} = \&message;
}
@@ -305,13 +318,6 @@
max_arg_length => $self->MaxArgLength,
);
- if ( my $frame = $self->trace->frame(0) )
- {
- $self->{package} = $frame->package;
- $self->{line} = $frame->line;
- $self->{file} = $frame->filename;
- }
-
my %fields = map { $_ => 1 } $self->Fields;
while ( my ($key, $value) = each %p )
{
Only in Exception-Class-1.24-my/: pm_to_blib