New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
User.pm in vendors/fcm/current/examples/lib/FCM/Admin – NEMO

source: vendors/fcm/current/examples/lib/FCM/Admin/User.pm @ 1980

Last change on this file since 1980 was 1980, checked in by flavoni, 14 years ago

importing fcm vendor

File size: 2.1 KB
Line 
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
7use strict;
8use warnings;
9
10package FCM::Admin::User;
11
12use overload q{""} => \&get_name;
13
14# The default values of the attributes
15my %DEFAULT = (
16    name         => undef,
17    display_name => undef,
18    email        => undef,
19);
20
21# ------------------------------------------------------------------------------
22# Returns a new instance of this class.
23sub new {
24    my ($class, $args_ref) = @_;
25    return bless({%DEFAULT, %{$args_ref}}, $class);
26}
27
28# ------------------------------------------------------------------------------
29# Getters and setters.
30for my $key (keys(%DEFAULT)) {
31    no strict qw{refs};
32    my $getter = qq{get_$key};
33    my $setter = qq{set_$key};
34    *$getter = sub {
35        my ($self) = @_;
36        return $self->{$key};
37    };
38    *$setter = sub {
39        my ($self, $value) = @_;
40        $self->{$key} = $value;
41    };
42}
43
441;
45__END__
46
47=head1 NAME
48
49FCM::Admin::User
50
51=head1 SYNOPSIS
52
53    use FCM::Admin::User;
54    $user = FCM::Admin::User->new({name => 'bob'});
55    $user->set_display_name('Robert Smith');
56    $user->set_email('robert.smith@somewhere.org');
57
58=head1 DESCRIPTION
59
60An object of this class is used to store the data model of a user.
61
62=head1 METHODS
63
64=over 4
65
66=item FCM::Admin::User->new(\%arguments)
67
68Creates a new instance. The keys of the %argument hash may contain "name",
69"display_name", and/or "email".
70
71=item $user->get_name()
72
73Returns the name/ID of the user.
74
75=item $user->get_display_name()
76
77Returns the display name of the user.
78
79=item $user->get_email()
80
81Returns the e-mail address of the user.
82
83=item $user->set_name($value)
84
85Sets the name/ID of the user.
86
87=item $user->set_display_name($value)
88
89Sets the display name of the user.
90
91=item $user->set_email($value)
92
93Sets the e-mail address of the user.
94
95=back
96
97=head1 COPYRIGHT
98
99E<169> Crown copyright Met Office. All rights reserved.
100
101=cut
Note: See TracBrowser for help on using the repository browser.