| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  | package NetApp::Snapshot::Schedule; | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | our $VERSION = '500.002'; | 
| 5 |  |  |  |  |  |  | $VERSION = eval $VERSION;  ##  no critic: StringyEval | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 1 |  |  | 1 |  | 7 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 38 |  | 
| 8 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 30 |  | 
| 9 | 1 |  |  | 1 |  | 5 | use Carp; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 66 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 1 |  |  | 1 |  | 6 | use Class::Std; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 12 | 1 |  |  | 1 |  | 110 | use Params::Validate qw( :all ); | 
|  | 1 |  |  |  |  | 10 |  | 
|  | 1 |  |  |  |  | 741 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | { | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | my %parent_of		:ATTR( get => 'parent' ); | 
| 17 |  |  |  |  |  |  | my %weekly_of		:ATTR( get => 'weekly' ); | 
| 18 |  |  |  |  |  |  | my %daily_of		:ATTR( get => 'daily' ); | 
| 19 |  |  |  |  |  |  | my %hourly_of		:ATTR( get => 'hourly' ); | 
| 20 |  |  |  |  |  |  | my %hourlist_of		:ATTR; | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub BUILD { | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 0 |  |  | 0 | 0 | 0 | my ($self,$ident,$args_ref) = @_; | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 0 |  |  |  |  | 0 | my @args = %$args_ref; | 
| 27 |  |  |  |  |  |  |  | 
| 28 | 0 |  |  |  |  | 0 | my (%args) 	= validate( @args, { | 
| 29 |  |  |  |  |  |  | parent	=> { type	=> OBJECT }, | 
| 30 |  |  |  |  |  |  | weekly	=> { type	=> SCALAR }, | 
| 31 |  |  |  |  |  |  | daily	=> { type	=> SCALAR }, | 
| 32 |  |  |  |  |  |  | hourly	=> { type	=> SCALAR }, | 
| 33 |  |  |  |  |  |  | hourlist	=> { type	=> ARRAYREF, | 
| 34 |  |  |  |  |  |  | default	=> [], | 
| 35 |  |  |  |  |  |  | optional	=> 1 }, | 
| 36 |  |  |  |  |  |  | }); | 
| 37 |  |  |  |  |  |  |  | 
| 38 | 0 |  |  |  |  | 0 | $parent_of{$ident}	= $args{parent}; | 
| 39 | 0 |  |  |  |  | 0 | $weekly_of{$ident}	= $args{weekly}; | 
| 40 | 0 |  |  |  |  | 0 | $daily_of{$ident}	= $args{daily}; | 
| 41 | 0 |  |  |  |  | 0 | $hourly_of{$ident}	= $args{hourly}; | 
| 42 | 0 |  |  |  |  | 0 | $hourlist_of{$ident}	= $args{hourlist}; | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | sub get_hourlist { | 
| 47 | 0 |  |  | 0 | 1 | 0 | return @{ $hourlist_of{ident shift} }; | 
|  | 0 |  |  |  |  | 0 |  | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | sub _parse_snap_sched { | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 2 |  |  | 2 |  | 2855 | my $class		= shift; | 
| 55 | 2 |  |  |  |  | 4 | my $line		= shift; | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 2 |  |  |  |  | 19 | my ($weekly,$daily,$hourly,$hourlist) = (split( /[@\s]+/, $line ))[2..5]; | 
| 58 |  |  |  |  |  |  |  | 
| 59 | 2 | 100 |  |  |  | 8 | if ( $hourlist ) { | 
| 60 | 1 |  |  |  |  | 7 | $hourlist	= [ split( /,/, $hourlist ) ]; | 
| 61 |  |  |  |  |  |  | } else { | 
| 62 | 1 |  |  |  |  | 2 | $hourlist	= []; | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 | 2 | 50 | 33 |  |  | 348 | if ( $weekly !~ /^\d+$/ || $daily !~ /^\d+$/ || $hourly !~ /^\d+$/ ) { | 
|  |  |  | 33 |  |  |  |  | 
| 66 | 0 |  |  |  |  | 0 | croak("Unable to parse snap sched: $line\n"); | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | return { | 
| 70 | 2 |  |  |  |  | 15 | weekly		=> $weekly, | 
| 71 |  |  |  |  |  |  | daily		=> $daily, | 
| 72 |  |  |  |  |  |  | hourly		=> $hourly, | 
| 73 |  |  |  |  |  |  | hourlist	=> $hourlist, | 
| 74 |  |  |  |  |  |  | }; | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | 1; |