From: Chris W. <la...@us...> - 2005-02-13 20:19:19
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1405/lib/OpenInteract2 Modified Files: ParamContainer.pm Log Message: update docs using examples removed from OI2::Action Index: ParamContainer.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/ParamContainer.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ParamContainer.pm 13 Feb 2005 20:09:50 -0000 1.1 --- ParamContainer.pm 13 Feb 2005 20:19:10 -0000 1.2 *************** *** 148,160 **** B<param_add( $key, @values )> ! Add C<@values> to C<$key> instead of overwriting the previous value. B<param_clear( $key )> ! Delete any value(s) set in C<$key>. This is the only way to clear out ! a value -- using the following will not work: $foo->param( myvar => undef ); B<param_assign( \%params )> --- 148,190 ---- B<param_add( $key, @values )> ! Adds (rather than replaces) the values C<@values> to the parameter ! C<$key>. If there is a value already set for C<$key>, or if you pass ! multiple values, it is turned into an array reference and C<@values> ! C<push>ed onto the end. If there is no value already set and you only ! pass a single value it acts like the call to C<param( $key, $value )>. ! ! This is useful for potential multivalued parameters, such as if you're ! collecting messages during a process for ultimately displaying to the ! user. For instance, say we want to collect error messages: ! ! $foo->param( error_msg => "Ooops I..." ); ! $foo->param_add( error_msg => "did it again" ); ! my $full_msg = join( ' ', $foo->param( 'error_msg' ) ); ! # $full_msg = 'Ooops I... did it again' ! ! $foo->param( error_msg => "Ooops I..." ); # Set to value ! $foo->param_add( error_msg => "did it again" ); # ...add new value to existing ! $foo->param( error_msg => 'and again' ); # ...replace the earlier values entirely ! my $full_msg = join( ' ', $foo->param( 'error_msg' ) ); ! # $full_msg = 'and again' ! ! $foo->param( error_msg => "Ooops I..." ); ! $foo->param_add( error_msg => "did it again" ); ! my $messages = $foo->param( 'error_msg' ); ! # $messages->[0] = 'Ooops I...' ! # $messages->[1] = 'did it again' ! ! Returns: Context senstive value in of C<$key> B<param_clear( $key )> ! Removes all parameter values defined by C<$key>. This is the only way ! to remove a parameter -- using the following will not work: $foo->param( myvar => undef ); + Returns: value(s) previously set for the parameter C<$key>, + non-context sensitive. + B<param_assign( \%params )> |