Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
    1;
    
    }
    
  2. or download this
    foo
    Use of uninitialized value in subroutine dereference at script.pl line
    + 30.
    ...
    baz
    baz
        (in cleanup) Unable to create sub named "" at script.pl line 30.
    
  3. or download this
    foo
    destroying...
    baz
    baz
    
  4. or download this
        my $closure_self = $self;
        weaken $closure_self;
        $self->{sub} = \&One::foo;
        *One::foo = sub { $closure_self->{x} = 'x'; return "baz\n"; };
        return $self;
    
  5. or download this
    foo
    baz
    destroying...
    foo
    
  6. or download this
    sub DESTROY {
        use Data::Dump;
    ...
        print dd($self), "\n";
        $self->unmock;
    }
    
  7. or download this
    foo
    destroying...
    ...
    1
    baz
    baz
    
  8. or download this
    foo
    baz
    ...
    bless({ sub => sub { ... }, x => "x" }, "Count")
    1
    foo
    
  9. or download this
    sub unmock {
        my $self = shift;
        *One::foo = $self->{sub};
    }