| 1 | package autodie::Scope::Guard; | ||
| 2 | |||
| 3 | 62 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 62 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | # ABSTRACT: Wrapper class for calling subs at end of scope | ||
| 7 | 61 | our $VERSION = '2.37'; # VERSION | |
| 8 | |||
| 9 | # This code schedules the cleanup of subroutines at the end of | ||
| 10 | # scope. It's directly inspired by chocolateboy's excellent | ||
| 11 | # Scope::Guard module. | ||
| 12 | |||
| 13 | 142 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 14 | 142 | my ($class, $handler) = @_; | |
| 15 | 142 | return bless($handler, $class); | |
| 16 | } | ||
| 17 | |||
| 18 | 137 | ▶ | sub DESTROY { |
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||
| 19 | 137 | my ($self) = @_; | |
| 20 | |||
| 21 | 137 | $self->(); | |
| 22 | } | ||
| 23 | |||
| 24 | 61 | 1; | |
| 25 | |||
| 26 | __END__ | ||