| 1 | package CPAN::Testers::WWW::Reports::Parser::YAML; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use vars qw($VERSION); | ||
| 7 | $VERSION = '0.05'; | ||
| 8 | |||
| 9 | #---------------------------------------------------------------------------- | ||
| 10 | # Library Modules | ||
| 11 | |||
| 12 | use YAML::XS qw(Load LoadFile); | ||
| 13 | |||
| 14 | #---------------------------------------------------------------------------- | ||
| 15 | # Variables | ||
| 16 | |||
| 17 | #---------------------------------------------------------------------------- | ||
| 18 | # The Application Programming Interface | ||
| 19 | |||
| 20 | sub new { | ||
| 21 | my $class = shift; | ||
| 22 | my $self = {}; | ||
| 23 | bless $self, $class; | ||
| 24 | return $self; | ||
| 25 | } | ||
| 26 | |||
| 27 | sub DESTROY { | ||
| 28 | my $self = shift; | ||
| 29 | } | ||
| 30 | |||
| 31 | # full data set methods | ||
| 32 | |||
| 33 | sub register { | ||
| 34 | my $self = shift; | ||
| 35 | my %hash = @_; | ||
| 36 | $self->{file} = $hash{file}; | ||
| 37 | $self->{data} = $hash{data}; | ||
| 38 | } | ||
| 39 | |||
| 40 | sub raw_data { | ||
| 41 | my $self = shift; | ||
| 42 | if($self->{file}) { | ||
| 43 | seek($self->{file},0,0) if(ref $self->{file} eq 'GLOB'); | ||
| 44 | return LoadFile($self->{file}); | ||
| 45 | } | ||
| 46 | return Load($self->{data}); | ||
| 47 | } | ||
| 48 | |||
| 49 | q{ Kein Zurück für dich }; | ||
| 50 | |||
| 51 | __END__ |