[libmixin-extrafields-param-perl] 15/25: r20943 at knave: rjbs | 2006-04-12 23:01:13 -0400 fix docs
Florian Schlichting
fsfs at moszumanska.debian.org
Wed Jan 29 21:00:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
fsfs pushed a commit to annotated tag 0.001
in repository libmixin-extrafields-param-perl.
commit bf9122ae7117e1fbbf2a494f7b5a1c604ecf7708
Author: Ricardo SIGNES <rjbs at codesimply.com>
Date: Thu Apr 13 15:32:28 2006 +0000
r20943 at knave: rjbs | 2006-04-12 23:01:13 -0400
fix docs
---
lib/Mixin/Param.pm | 54 +++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 41 insertions(+), 13 deletions(-)
diff --git a/lib/Mixin/Param.pm b/lib/Mixin/Param.pm
index 10c7bdb..d314782 100644
--- a/lib/Mixin/Param.pm
+++ b/lib/Mixin/Param.pm
@@ -8,7 +8,6 @@ use Scalar::Util ();
use Tie::RefHash::Weak;
use Sub::Exporter -setup => {
- # exports => [ param => \&_param_gen ],
groups => {
default => [ '-param' ],
param => \&_param_gen,
@@ -43,26 +42,36 @@ our $VERSION = '0.01';
=head1 DESCRIPTION
This module mixes in to your class to provide a C<param> method like the ones
-provided by L<CGI>, L<CGI::Application>, and other classes.
+provided by L<CGI>, L<CGI::Application>, and other classes. It doesn't store
+any information on your object, so it can work on any sort of object. It
+doesn't need a DESTROY method, so you don't need to worry about cleaning up
+your Mixin::Param values when your object is destroyed.
-=head1 METHODS
+By default, the methods provided are:
-=head2 C< param >
+=over
- my @params = $object->param; # get names of existing params
+=item * param
- my $value = $object->param('name'); # get value of a param
+=item * has_param
- my $value = $object->param(name => $value); # set a param's value
+=item * delete_param
- my @values = $object->param(n1 => $v1, n2 => $v2, ...); # set many values
+=back
-=cut
+These are documented below. They are mixed in by default if you use
+Mixin::Param. You can also import them explicitly by importing the "param"
+group. These group can be passed a hashref of named arguments; see
+L<Sub::Exporter> for more information on how it works. One important argument
+is "noun", which changes the names of the methods by replacing "param" with the
+value of the "noun" argument.
-#my %_params_for;
-#BEGIN { tie %_params_for, 'Tie::RefHash::Weak'; }
+If the "param" group is imported multiple times with different noun values, the
+methods will operate on distinct sets of data.
-#sub __params_storage_guts { %_params_for }
+=head1 METHODS
+
+=cut
sub _param_gen {
my (undef, undef, $arg) = @_;
@@ -74,6 +83,20 @@ sub _param_gen {
$sub{"__$P\_storage_guts"} = sub { %_params_for };
+=head2 param
+
+ my @params = $object->param; # get names of existing params
+
+ my $value = $object->param('name'); # get value of a param
+
+ my $value = $object->param(name => $value); # set a param's value
+
+ my @values = $object->param(n1 => $v1, n2 => $v2, ...); # set many values
+
+This method sets or retrieves parameters.
+
+=cut
+
$sub{$P} = sub {
my $self = shift;
@@ -105,7 +128,7 @@ sub _param_gen {
return wantarray ? @assigned : $assigned[0];
};
-=head2 C< delete_param >
+=head2 delete_param
my $deleted = $object->delete_param('name'); # delete the param entirely
@@ -113,6 +136,8 @@ sub _param_gen {
my $deleted = $object->delete_param(@names); # returns the first deleted value
+This method deletes any entry for the named parameter(s).
+
=cut
$sub{"delete_$P"} = sub {
@@ -133,6 +158,9 @@ sub _param_gen {
if ($object->has_param($name) { ... }
+This method is true if the named parameter exists in the object's set of
+parameters, even if it is undefined.
+
=cut
$sub{"has_$P"} = sub {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmixin-extrafields-param-perl.git
More information about the Pkg-perl-cvs-commits
mailing list