| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Astro::VEX::Param::Number; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =head1 NAME | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | Astro::VEX::Param::Number - VEX (VLBI Experiment Definition) number parameter  class | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =cut | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 2 |  |  | 2 |  | 12 | use strict; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 56 |  | 
| 10 | 2 |  |  | 2 |  | 9 | use warnings; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 65 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | our $VERSION = '0.001'; | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 2 |  |  | 2 |  | 10 | use parent qw/Astro::VEX::Param::Value/; | 
|  | 2 |  |  |  |  | 2 |  | 
|  | 2 |  |  |  |  | 10 |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 2 |  |  | 2 |  | 77 | use overload '""' => 'stringify'; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 11 |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | sub new { | 
| 19 | 3 |  | 33 | 3 | 0 | 13728 | my $proto = shift; my $class = ref($proto) || $proto; | 
|  | 3 |  |  |  |  | 17 |  | 
| 20 | 3 |  |  |  |  | 18 | my $value = shift; | 
| 21 | 3 |  |  |  |  | 5 | my $unit = shift; | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 3 |  |  |  |  | 58 | return bless { | 
| 24 |  |  |  |  |  |  | VALUE => $value, | 
| 25 |  |  |  |  |  |  | UNIT => $unit, | 
| 26 |  |  |  |  |  |  | }, $class; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | sub unit { | 
| 30 | 3 |  |  | 3 | 0 | 6 | my $self = shift; | 
| 31 | 3 |  |  |  |  | 11 | return $self->{'UNIT'}; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub stringify { | 
| 35 | 3 |  |  | 3 | 0 | 4 | my $self = shift; | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 3 |  |  |  |  | 6 | my $value = $self->{'VALUE'}; | 
| 38 | 3 |  |  |  |  | 5 | my $unit = $self->{'UNIT'}; | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 3 | 100 |  |  |  | 9 | return $value unless defined $unit; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 2 |  |  |  |  | 12 | return sprintf '%s %s', $value, $unit; | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | 1; | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | __END__ |