| 1 | package OAuthomatic::Internal::UsageGuard; | ||||||||||
| 2 | # ABSTRACT: support for RAII for some roles | ||||||||||
| 3 | |||||||||||
| 4 | |||||||||||
| 5 | 5 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 5 | ▶ | use namespace::sweep; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 5 | has 'obj' => (is => 'ro', isa=>'Object'); | |||||||||
| 9 | 5 | has '_active' => (is=>'rw', isa=>'Bool'); | |||||||||
| 10 | |||||||||||
| 11 | sub prepare { | ||||||||||
| 12 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
prepare: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 13 | 0 | ▶ | return if $self->_active; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 0 | $self->obj->prepare_to_work; | |||||||||
| 15 | 0 | $self->_active(1); | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | sub finish { | ||||||||||
| 19 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
finish: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 20 | 0 | ▶ | return unless $self->_active; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 0 | $self->obj->cleanup_after_work; | |||||||||
| 22 | 0 | $self->_active(0) | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | sub DEMOLISH { | ||||||||||
| 26 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
DEMOLISH: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 27 | 0 | $self->finish; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 5 | 1; | |||||||||
| 31 | |||||||||||
| 32 | __END__ | ||||||||||
| 33 | |||||||||||
| 34 | =pod | ||||||||||
| 35 | |||||||||||
| 36 | =encoding UTF-8 | ||||||||||
| 37 | |||||||||||
| 38 | =head1 NAME | ||||||||||
| 39 | |||||||||||
| 40 | OAuthomatic::Internal::UsageGuard - support for RAII for some roles | ||||||||||
| 41 | |||||||||||
| 42 | =head1 VERSION | ||||||||||
| 43 | |||||||||||
| 44 | version 0.01 | ||||||||||
| 45 | |||||||||||
| 46 | =head1 DESCRIPTION | ||||||||||
| 47 | |||||||||||
| 48 | Internally used by L<OAuthomatic> | ||||||||||
| 49 | |||||||||||
| 50 | =head1 AUTHOR | ||||||||||
| 51 | |||||||||||
| 52 | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> | ||||||||||
| 53 | |||||||||||
| 54 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 55 | |||||||||||
| 56 | This software is copyright (c) 2015 by Marcin Kasperski. | ||||||||||
| 57 | |||||||||||
| 58 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 59 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 60 | |||||||||||
| 61 | =cut | ||||||||||