NAME

KuPortal::Entry - A KuPortal authentication service user object

SYNOPSIS

 use KuPortal;
 
 $user_info = KuPortal::user_status(-application => $myapp,
                                    -timeout     => 2*60,
                                    -asref       => 1);
 
 # Walk through the attributes, printing the values
 foreach my $attr ( $user_info->attributes ) {
   print $attr;
   foreach my $value ($user_info->get_value( $attr ) ) {
     print "\t$value";
   }
   print "\n";
 }
 
 # or
 
 use KuPortal::Entry;
 
 $user_info = new KuPortal::Entry $stringval;

DESCRIPTION

The KuPortal::Entry object represents the user information returned by the KuPortal authentication system for a user session. It is a container for attribute-value pairs.

A KuPortal::Entry object is used to retrieve the user's attributes by name. It retrieves multiple valued attributes as well.

CONSTRUCTORS

new ( $binary_string_from_kuportal, [ $delimiter_ord ] )

Create a new entry object from the string using values beginning with the ASCII delimiter value to split the string. The default delimiter value is zero.

In practice, this is only called from KuPortal::user_status.

METHODS

attributes ( )
Return a sorted list of non-empty attributes in this entry
exists ( ATTR )
Returns TRUE if the entry has an attribute called ATTR.
get_value ( ATTR, OPTIONS )

Get the values for the attribute ATTR. In a list context returns all values for the given attribute, or the empty list if the attribute does not exist. In a scalar context returns the first value for the attribute or undef if the attribute does not exist.

asref => 1

The result will be a reference to an array containing all the values for the attribute, or undef if the attribute does not exist.

 $scalar = $entry->get_value ( 'givenName' );

$scalar will be the first value for the givenName attribute, or undef if the entry does not contain a givenName attribute.

 $ref = $entry->get_value ( 'givenName', asref => 1 );

$ref will be a reference to an array, which will have all the values for the givenName attribute. If the entry does not have an attribute called givenName then $ref will be undef.

NOTE: In the interest of performance the array references returned by get_value are references to structures held inside the entry object. These values and thier contents should NOT be modified directly.

as_text ( OPTIONS )

Returns an TEXT table describing the attributes. The table may be customized using the options below.

-entry_begin => $string_val
A string representing text to begin the result with. The default is ''.
-entry_end => $stringval
A string representing text to end the result with. The default is ''.
-attribute_begin => $stringval
A string representing text to begin each attribute description with. The default is ''.
-attribute_end => $stringval
A string representing text to end each attribute description with. The default is ''.
-attribute_sep => $stringval
A string representing text to separate each attribute with. The default is ''.
-label_begin => $stringval
A string representing text to begin each attribute label with. The default is ''.
-label_end => $stringval
A string representing text to end each attribute label with. The default is ''.
-values_begin => $stringval
A string representing text to begin each value list with. The default is ''.
-values_end => $stringval
A string representing text to end each value list with. The default is ''.
-value_begin => $stringval
A string representing text to begin each value with. The default is ''.
-value_end => $stringval
A string representing text to end each value with. The default is ''.
-value_sep => $stringval
A string representing text to separate the individual values with. The default is ''.
-subentry_begin => $stringval
A string representing text to begin each sub-entry with. The default is ''.
-subentry_end => $stringval
A string representing text to end each sub-entry with. The default is ''.

Example

  $result = $user_info->as_text(-attribute_end => "\n",
                                -label_end     => ": ",
                                -value_sep     => "\n\t";
                               );

SEE ALSO

KuPortal

AUTHOR

Kathryn Huxtable <lt>khuxtable@ku.edu>.

Please report any bugs, or post any suggestions, to <argus@ku.edu>.

COPYRIGHT

Copyright (c) 2004 The University of Kansas. All rights reserved.


$Id: Entry.html,v 1.1 2005/11/15 23:27:23 huxtable Exp $