Gantry::Plugins::Uaf::User - A module that defines a basic user object.


Gantry-Plugins-Uaf documentation Contained in the Gantry-Plugins-Uaf distribution.

Index


Code Index:

NAME

Top

Gantry::Plugins::Uaf::User - A module that defines a basic user object.

SYNOPSIS

Top

 use Gantry::Plugins::Uaf::User;

 my $username = 'joe blow';
 my $user = Gantry::Plugins::Uaf::User->new($username);
 $user->attribute('birthday', '01-Jan-2008');

DESCRIPTION

Top

Gantry::Plugins::Uaf::User is a base module that can be used to create an user object. The object is extremely flexiable and is not tied to any one data source.

METHODS

Top

new

This method initializes the user object. It takes one parameter, the username.

Example:

 my $username = 'joeblow';
 my $user = Gantry::Plugins::Uaf::User->new($username);

MUTATORS

Top

attribute

Set/Returns a user object attribute.

Example:

 $birthday = $user->attribute('birthday');
 $user->attribute('birthday', $birthday);

SEE ALSO

Top

 Gantry::Plugins::Uaf

AUTHOR

Top

Kevin L. Esteb

COPYRIGHT AND LICENSE

Top


Gantry-Plugins-Uaf documentation Contained in the Gantry-Plugins-Uaf distribution.

package Gantry::Plugins::Uaf::User;

use 5.008;
use strict;
use warnings;

our $VERSION = '0.01';

sub new {
    my ($proto, $username) = @_;

    my $class = ref($proto) || $proto;
    my $self = {
        username => $username, 
        attributes => {}
    };

    bless($self, $class);

    return $self;

}

sub username {
    my ($self) = shift;

    return $self->{username};

}

sub attribute {
    my ($self, $name, $p) = @_;

    $self->{attributes}->{$name} = $p if (defined($p));
    return $self->{attributes}->{$name};

}

1;

__END__