| 1 | #!/usr/bin/perl | ||
| 2 | package WWW::StatusBadge; | ||
| 3 | $WWW::StatusBadge::VERSION = '0.0.2'; | ||
| 4 | 135 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 135 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 135 | ▶ | use Carp (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 135 | ▶ | use Hash::Util::FieldHash (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 0 | ▶ | use Module::Pluggable::Object (); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 10 | |||
| 11 | Hash::Util::FieldHash::fieldhash my %Arg; | ||
| 12 | |||
| 13 | sub new { | ||
| 14 | my $class = shift; | ||
| 15 | my %arg = @_; | ||
| 16 | |||
| 17 | my $self = do { | ||
| 18 | my $o; bless \( $o ), ref $class || $class || __PACKAGE__ | ||
| 19 | }; | ||
| 20 | |||
| 21 | $Arg{ $self } = { %arg }; | ||
| 22 | |||
| 23 | return $self; | ||
| 24 | } | ||
| 25 | |||
| 26 | sub args { return %{ $Arg{ shift() } }; } | ||
| 27 | |||
| 28 | my $package = __PACKAGE__; | ||
| 29 | my $finder = Module::Pluggable::Object->new( | ||
| 30 | 'package' => $package, 'require' => 1, | ||
| 31 | ); | ||
| 32 | |||
| 33 | { | ||
| 34 | no strict 'refs'; | ||
| 35 | for my $plugin ( $finder->plugins ) { | ||
| 36 | my $service = $plugin->can('service') | ||
| 37 | || next; | ||
| 38 | my $method = join( '_', ( split '::', lc $plugin )[3,] ); | ||
| 39 | *{ sprintf '%s::%s', $package, $method } = $service; | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | 1; | ||
| 44 | # ABSTRACT: Plugin based Status Badge generator | ||
| 45 | # vim:ts=4:sw=4:syn=perl | ||
| 46 | |||
| 47 | __END__ | ||