| 1 | # | ||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||
| 3 | # | ||||||||||
| 4 | # vim: set ts=2 sw=2 tw=0: | ||||||||||
| 5 | # vim: set expandtab: | ||||||||||
| 6 | |||||||||||
| 7 | package Rex::Repositorio::Repository_Factory; | ||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use common::sense; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Params::Validate qw(:all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use English; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | our $VERSION = '1.2.1'; # VERSION | |||||||||
| 15 | |||||||||||
| 16 | 1 | ▶ | sub create { | ||||||||
|
Subroutine
create: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 17 | 1 | my $class = shift; | |||||||||
| 18 | 1 | my %option = validate( | |||||||||
| 19 | @_, | ||||||||||
| 20 | { | ||||||||||
| 21 | type => { | ||||||||||
| 22 | type => SCALAR | ||||||||||
| 23 | }, | ||||||||||
| 24 | options => { | ||||||||||
| 25 | type => HASHREF | ||||||||||
| 26 | } | ||||||||||
| 27 | } | ||||||||||
| 28 | ); | ||||||||||
| 29 | |||||||||||
| 30 | 1 | my $type = $option{type}; | |||||||||
| 31 | 1 | my $repo_mod = "Rex::Repositorio::Repository::$type"; | |||||||||
| 32 | 1 | ▶ | eval "use $repo_mod;1;"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 33 | 1 | ▶ | if ($EVAL_ERROR) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | confess "Error loading repository type: $type. ($EVAL_ERROR)"; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 1 | return $repo_mod->new( %{ $option{options} } ); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 1 | 1; | |||||||||