);
BEGIN {
- $VERSION = '2.05';
+ $VERSION = '2.06';
$PACKAGE_EXCEPTION = 'CGI::Ex::Template::Exception';
$PACKAGE_ITERATOR = 'CGI::Ex::Template::Iterator';
$WHILE_MAX = 1000;
$EXTRA_COMPILE_EXT = '.sto';
+
+ eval {require Scalar::Util};
};
###----------------------------------------------------------------###
$sub_tree = $sub_tree->[0]->[4];
}
- my $self_copy = $self->weak_copy;
+ my $self_copy = $self;
+ eval {require Scalar::Util; Scalar::Util::weaken($self_copy)};
### install a closure in the stash that will handle the macro
$self->set_variable($name, sub {
};
}
-### get a copy of self without circular refs for use in closures
-sub weak_copy {
- my $self = shift;
- my $self_copy;
- if (eval { require Scalar::Util }
- && defined &Scalar::Util::weaken) {
- $self_copy = $self;
- Scalar::Util::weaken($self_copy);
- } else {
- $self_copy = bless {%$self}, ref($self); # hackish way to avoid circular refs on old perls (pre 5.8)
- }
- return $self_copy;
-}
-
sub debug_node {
my ($self, $node) = @_;
my $info = $self->node_info($node);