| 1 | # Prefer numeric version for backwards compatibility | ||
| 2 | 7 | ▶ | BEGIN { require 5.008_009 }; ## no critic ( RequireUseStrict, RequireUseWarnings ) |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 7 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 7 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | package MooX::Role::HasLogger::Types; | ||
| 7 | |||
| 8 | 7 | $MooX::Role::HasLogger::Types::VERSION = 'v1.0.0'; | |
| 9 | |||
| 10 | 7 | ▶ | use Type::Library qw( -base ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 7 | ▶ | use Type::Tiny::Duck qw(); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 7 | my $Logger = __PACKAGE__->add_type( | |
| 14 | Type::Tiny::Duck->new( | ||
| 15 | name => 'Logger', | ||
| 16 | methods => [ qw( is_trace trace is_debug debug is_info info is_warn warn is_error error is_fatal fatal ) ] | ||
| 17 | ) | ||
| 18 | ); | ||
| 19 | |||
| 20 | __PACKAGE__->add_type( | ||
| 21 | Type::Tiny::Duck->new( | ||
| 22 | name => 'LoggerAny', | ||
| 23 | 7 | methods => [ @{ $Logger->methods }, qw( category tracef debugf infof warnf errorf fatalf ) ] | |
| 24 | ) | ||
| 25 | ); | ||
| 26 | |||
| 27 | 7 | __PACKAGE__->make_immutable; | |
| 28 | |||
| 29 | 7 | 1 | |