1 | # ------------------------------------------------------------------------------ |
---|
2 | # (C) Crown copyright Met Office. All rights reserved. |
---|
3 | # For further details please refer to the file COPYRIGHT.txt |
---|
4 | # which you should have received as part of this distribution. |
---|
5 | # ------------------------------------------------------------------------------ |
---|
6 | use strict; |
---|
7 | use warnings; |
---|
8 | |
---|
9 | package Fcm::Keyword::Entry; |
---|
10 | |
---|
11 | sub new { |
---|
12 | my ($class, $args_ref) = @_; |
---|
13 | if (!$args_ref) { |
---|
14 | $args_ref = {}; |
---|
15 | } |
---|
16 | return bless({%{$args_ref}}, $class); |
---|
17 | } |
---|
18 | |
---|
19 | ################################################################################ |
---|
20 | ### Methods: get_* |
---|
21 | for my $name ( |
---|
22 | # Returns the key of this entry |
---|
23 | 'key', |
---|
24 | # Returns the value of this entry |
---|
25 | 'value', |
---|
26 | ) { |
---|
27 | no strict qw{refs}; |
---|
28 | my $getter = "get_$name"; |
---|
29 | *$getter = sub { |
---|
30 | my ($self) = @_; |
---|
31 | return $self->{$name}; |
---|
32 | } |
---|
33 | } |
---|
34 | |
---|
35 | 1; |
---|
36 | __END__ |
---|
37 | |
---|
38 | =head1 NAME |
---|
39 | |
---|
40 | Fcm::Keyword::Entry |
---|
41 | |
---|
42 | =head1 SYNOPSIS |
---|
43 | |
---|
44 | use Fcm::Keyword::Entry; |
---|
45 | |
---|
46 | $entry = Fcm::Keyword::Entry->new({key => $key, value => $value}); |
---|
47 | $key = $entry->get_key(); |
---|
48 | $value = $entry->get_value(); |
---|
49 | |
---|
50 | =head1 DESCRIPTION |
---|
51 | |
---|
52 | An object of this class represents a FCM keyword entry. |
---|
53 | |
---|
54 | =head1 METHODS |
---|
55 | |
---|
56 | =over 4 |
---|
57 | |
---|
58 | =item C<new({key =E<gt> $key, value =E<gt> $value})> |
---|
59 | |
---|
60 | Constructor. |
---|
61 | |
---|
62 | =item get_key() |
---|
63 | |
---|
64 | Returns the key of this keyword entry. |
---|
65 | |
---|
66 | =item get_value() |
---|
67 | |
---|
68 | Returns the value of this keyword entry. |
---|
69 | |
---|
70 | =back |
---|
71 | |
---|
72 | Simple formatter for displaying an entry. |
---|
73 | |
---|
74 | =head1 SEE ALSO |
---|
75 | |
---|
76 | L<Fcm::Keyword|Fcm::Keyword>, |
---|
77 | L<Fcm::Keyword::Entries|Fcm::Keyword::Entries> |
---|
78 | |
---|
79 | =head1 COPYRIGHT |
---|
80 | |
---|
81 | E<169> Crown copyright Met Office. All rights reserved. |
---|
82 | |
---|
83 | =cut |
---|