NAME

LS::ID - Life Science Identifiers

SYNOPSIS

 use LS::ID;

 $lsid = LS::ID->new('URN:LSID:pdb.org:PDB:112L:');

 $authority_id = $lsid->authority;
 $namespace = $lsid->namespace;
 $object_id = $lsid->object;
 $revision = $lsid->revision;

DESCRIPTION

LS::ID provides an interface to parse an LSID into its constituent parts and to build an LSID as described at http://www.omg.org/cgi-bin/doc?dtc/04-05-01

CONSTRUCTORS

The following method is used to construct a new LS::ID object:

new ( $str )

This class method creates a new LS::ID object. The string representation of the LSID is given as an argument. If $str is not a valid LSID, undef is returned. Otherwise, the new LSID object is returned.

Examples:

 $lsid = LS::ID->new('URN:LSID:pdb.org:PDB:112L:')

 if (!$lsid) {
        print "Invalid LSID!";
 }

METHODS

LS::ID supports the methods of URI::urn, plus the following.

authority ( [$new_authority] )

Sets or retrieves the authority ID component of the LSID.

If the method is called with no argument, the current authority is returned. The string returned by this method is always lowercase. If you want the authority as it was written in the LSID in its original case, use _authority instead.

If the method is called with a string argument, the authority is set to the new value if it is a valid authority ID. A true value is returned if the authority was successfully set, or a false value otherwise.

namespace ( [$new_namespace] )

Sets or retrieves the namespace component of the LSID.

If the method is called with no argument, the current namespace is returned. The string returned by this method is always lowercase. If you want the namespace as it was written in the LSID in its original case, use _namespace instead.

If the method is called with a string argument, the namespace is set to the new value if it is a valid namespace. A true value is returned if the namespace was successfully set, or a false value otherwise.

object ( [$new_object] )

Sets or retrieves the object ID component of the LSID.

If the method is called with no argument, the current object ID is returned. The string returned by this method is always lowercase. If you want the object ID as it was written in the LSID in its original case, use _object instead.

If the method is called with a string argument, the object ID is set to the new value if it is a valid object ID. A true value is returned if the object ID was successfully set, or a false value otherwise.

revision ( [$new_revision] )

Sets or retrieves the revision component of the LSID.

If the method is called with no argument, the current revision is returned. The string returned by this method is always lowercase. If you want the revision as it was written in the LSID in its original case, use _revision instead.

If the method is called with a string argument, the revision is set to the new value if it is a valid revision. A true value is returned if the revision was successfully set, or a false value otherwise.

canonical ( )

Returns an LS::ID object which is a normalized version of the LSID. All components are converted to lowercase, and if no revision is present, any trailing : is removed.

For efficiency reasons, if the LSID already was in normalized form, then a reference to it is returned instead of a copy.

COPYRIGHT

Copyright (c) 2002,2003 IBM Corporation. All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at http://www.opensource.org/licenses/cpl.php