| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Astro::VEX::Param; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =head1 NAME | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | Astro::VEX::Param - VEX (VLBI Experiment Definition) parameter class | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =cut | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 2 |  |  | 2 |  | 12 | use strict; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 49 |  | 
| 10 | 2 |  |  | 2 |  | 9 | use warnings; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 82 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | our $VERSION = '0.001'; | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 2 |  |  | 2 |  | 9 | use parent qw/Astro::VEX::NamedItem/; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 10 |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 2 |  |  | 2 |  | 119 | use overload '""' => 'stringify'; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 10 |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | sub new { | 
| 19 | 5 |  | 33 | 5 | 0 | 1820 | my $proto = shift; my $class = ref($proto) || $proto; | 
|  | 5 |  |  |  |  | 21 |  | 
| 20 | 5 |  |  |  |  | 7 | my $name = shift; | 
| 21 | 5 |  |  |  |  | 8 | my $values = shift; | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 5 |  |  |  |  | 83 | return bless { | 
| 24 |  |  |  |  |  |  | NAME => $name, | 
| 25 |  |  |  |  |  |  | VALUES => $values, | 
| 26 |  |  |  |  |  |  | }, $class; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | sub item { | 
| 30 | 6 |  |  | 6 | 0 | 11 | my $self = shift; | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 6 |  |  |  |  | 6 | my $num_val = scalar @{$self->{'VALUES'}}; | 
|  | 6 |  |  |  |  | 10 |  | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 6 | 50 |  |  |  | 19 | if ($num_val == 0) { | 
|  |  | 50 |  |  |  |  |  | 
| 35 | 0 |  |  |  |  | 0 | die 'Parameter has no values'; | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  | elsif ($num_val > 1) { | 
| 38 | 0 |  |  |  |  | 0 | die 'Parameter has multiple values'; | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 | 6 |  |  |  |  | 17 | return $self->{'VALUES'}->[0]; | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | sub value { | 
| 45 | 1 |  |  | 1 | 0 | 3 | my $self = shift; | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 1 |  |  |  |  | 2 | return $self->item->value; | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | sub stringify { | 
| 51 | 5 |  |  | 5 | 0 | 7 | my $self = shift; | 
| 52 |  |  |  |  |  |  |  | 
| 53 | 5 |  |  |  |  | 13 | return (' ' x $self->indent) . $self->{'NAME'} . ' = ' . (join ' : ', @{$self->{'VALUES'}}) . ';'; | 
|  | 5 |  |  |  |  | 61 |  | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | 1; | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | __END__ |