Eric Lease Morgan > MyLibrary-3.0.4 > MyLibrary::Resource::Location::Type

Download:
MyLibrary-3.0.4.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

MyLibrary::Resource::Location::Type

SYNOPSIS ^

        # require the necessary module
        use MyLibrary::Resource::Location::Type;

        # create a new Location Type object
        my $location_type = MyLibrary::Resource::Location::Type->new();

        # set the attributes of a Location Type object
        $location_type->name();
        $location_type->description();

        # commit Location Type
        $location_type->commit();

        # output the Location Type id
        my $location_type_id = $location_type->location_type_id();

        # delete a Location Type from the database
        $location_type->delete();

        # return a list of all type ids for processing
        my @location_type_ids = MyLibrary::Resource::Location::Type->all_types();

DESCRIPTION ^

This is a sub-class of the Location class which is used to represent individual resource location types and allow manipulation of resource location type data. Each location will be assigned one location type. Multiple location types can exist, each representing a method by which a resource can be accessed. Certain resources will be accessed only via physical methods, while others will be purely digital. Each type should have a description assigned which clearly states the mode of access for that type.

METHODS ^

new()

This constructor method is used to create a resource location type object. The object can then be manipulated using the various accessor methods supplied with this module.

        # create a new resource location type object
        my $resource_location_type = MyLibrary::Resource::Location::Type->new();

This method can also be called using an id parameter which will then return an object using the persistent data store. If the called location does not exist, this method will return 'undef'.

        # create an object from persistent data using the location type id
        my $resource_location_type = MyLibrary::Resource::Location::Type->new(id => $loc_id);

This method can also be called using the 'name' parameter, so that an object can be created based on the name of the location type. Each location type name must be unique, so only one type will be retrieved using the method in this fashion.

        # create an object from persistent data using the location type name
        my $resource_location_type = MyLibrary::Resource::Location::Type->new(name => $loc_name);

name()

This attribute method should be used to either set or retrieve the name for this location type. This name will appear in any context where location type labeling is required.

        # get location type name
        my $location_type_name = $location_type->name();

        # set the location type name
        $location_type->name('URL WEB SITE');

description()

The description should indicate the mode of access for a location type. This will assist in the usage of a particular type.

        # retrieve the current location type
        my $location_type_description = $location_type->description();

        # set the location type description
        $location_type->description('This location type applies to any resource which is web accessible.');

location_type_id()

This method can only be used to retrieve the location type id of the current location type. It cannot be used to set the location type id, as this is set internally.

        # get the current location type id
        my $location_type_id = location_type_id();

commit()

This method is used to save a location type to the database.

        # commit the location type
        $location_type->commit();

delete()

Use this method to remove a location type from the database

        # remove a location type from the database
        $location_type->delete();

all_types()

This is a class method which will return upon invocation the full list of location type ids. If no location types exist in the databse, the method will return undef.

        # return a list of all location type ids
        my @location_type_ids = MyLibrary::Resource::Location::Type->all_types();

SEE ALSO ^

For more information, see the MyLibrary home page: http://dewey.library.nd.edu/mylibrary/.

AUTHOR ^

Robert Fox <rfox2@nd.edu>

syntax highlighting: