| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Aspect::Loader; | 
| 2 | 2 |  |  | 2 |  | 114632 | use 5.008008; | 
|  | 2 |  |  |  |  | 7 |  | 
|  | 2 |  |  |  |  | 89 |  | 
| 3 | 2 |  |  | 2 |  | 13 | use strict; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 70 |  | 
| 4 | 2 |  |  | 2 |  | 10 | use warnings; | 
|  | 2 |  |  |  |  | 10 |  | 
|  | 2 |  |  |  |  | 117 |  | 
| 5 |  |  |  |  |  |  | our $VERSION = '0.03'; | 
| 6 | 2 |  |  | 2 |  | 9914 | use Aspect; | 
|  | 2 |  |  |  |  | 107662 |  | 
|  | 2 |  |  |  |  | 15 |  | 
| 7 | 2 |  |  | 2 |  | 2978 | use Aspect::Loader::Configuration::YAML; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | use Aspect::Loader::Definition; | 
| 9 |  |  |  |  |  |  | use UNIVERSAL::require; | 
| 10 |  |  |  |  |  |  | use Class::Inspector; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub new{ | 
| 13 |  |  |  |  |  |  | my $class     = shift; | 
| 14 |  |  |  |  |  |  | my $configuration  = shift; | 
| 15 |  |  |  |  |  |  | my $self = { | 
| 16 |  |  |  |  |  |  | _configuration => $configuration, | 
| 17 |  |  |  |  |  |  | }; | 
| 18 |  |  |  |  |  |  | bless $self,$class; | 
| 19 |  |  |  |  |  |  | $self->load_aspect; | 
| 20 |  |  |  |  |  |  | return $self; | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | sub yaml_loader{ | 
| 24 |  |  |  |  |  |  | my $class = shift; | 
| 25 |  |  |  |  |  |  | my $file_path = shift; | 
| 26 |  |  |  |  |  |  | my $configuration = Aspect::Loader::Configuration::YAML->new($file_path); | 
| 27 |  |  |  |  |  |  | return $class->new($configuration); | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub load_aspect{ | 
| 31 |  |  |  |  |  |  | my $self = shift; | 
| 32 |  |  |  |  |  |  | my $configuration = $self->{_configuration}->get_configuration(); | 
| 33 |  |  |  |  |  |  | foreach my $conf (@$configuration){ | 
| 34 |  |  |  |  |  |  | my $definition = Aspect::Loader::Definition->new($conf); | 
| 35 |  |  |  |  |  |  | my $class = $definition->get_class_name; | 
| 36 |  |  |  |  |  |  | unless(Class::Inspector->loaded($class )){ | 
| 37 |  |  |  |  |  |  | $class->require or die "cant load class $class"; | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  | if($definition->get_class_name){ | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  | aspect $definition->get_library  => $definition->get_call; | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | 1; | 
| 48 |  |  |  |  |  |  | __END__ |