Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

class::methodmaker::optext(3) [suse man page]

Class::MethodMaker::OptExt(3)				User Contributed Perl Documentation			     Class::MethodMaker::OptExt(3)

NAME
Class::MethodMaker::OptExt - Constants for C::MM's option extension mechanism SYNOPSIS
This class is internal to Class::MethodMaker and should not be used by any clients. It is not part of the public API. DESCRIPTION
This class contains the constants used by Class::MethodMaker to determine the names of its methods dependent upon options invoked. CLASS CONSTANTS
OPTEXT OPTEXT is a map from options that are implemented as method extensions to the option parameters. Parameter keys are: encode code number (to allow the option combination to be encoded whilst keeping the length of the subr name no more than 8 chars). encode is required for all opts (for determining method extension), and must be a power of two. refer Code for referring to storage (default: '$_[0]->{$name}'). decl Code for declaring storage. postac Code to execute immediately after any assignment check --- for example, to initialize storage if necessary asgnchk Code for checking assignments. defchk Code for default checking. reset Code to execute when resetting an element read Code to execute each time an value is read store Code to execute each time a value is stored CLASS COMPONENTS
CLASS HIGHER-LEVEL FUNCTIONS encode Take a set of options, return a two-letter code being the extension to add to the method to incorporate the extensions, and a list (arrayref) of the extensions represented. SYNOPSIS my ($ext, $opt) = Class::MethodMaker::OptExt->encode([qw( static type foobar )]); ARGUMENTS options The options to encode, as an arrayref of option names RETURNS ext A code (string) to append to a methodname to represent the options used. opts The options represented by the ext . This is generally a subset of the of those provided in options, for not all general options are handled by an encoded methodname. CLASS HIGHER-LEVEL PROCEDURES INSTANCE CONSTRUCTION
INSTANCE COMPONENTS
INSTANCE HIGHER-LEVEL FUNCTIONS INSTANCE HIGHER-LEVEL PROCEDURES EXAMPLES
BUGS
REPORTING BUGS
Email the development mailing list "class-mmaker-devel@lists.sourceforge.net". AUTHOR
Martyn J. Pearce COPYRIGHT
Copyright (c) 2003 Martyn J. Pearce. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl v5.12.1 2008-12-03 Class::MethodMaker::OptExt(3)

Check Out this Related Man Page

Class::MethodMaker::scalar(3pm) 			User Contributed Perl Documentation			   Class::MethodMaker::scalar(3pm)

NAME
Class::Method::scalar - Create methods for handling a scalar value. SYNOPSIS
package MyClass; use Class::MethodMaker [ scalar => [qw/ a -static s /]]; sub new { my $class = shift; bless {}, $class; } package main; my $m = MyClass->new; my $a, $x; $a = $m->a; # *undef* $x = $m->a_isset; # false $a = $m->a(1); # 1 $m->a(3); $x = $m->a_isset; # true $a = $m->a; # 3 $a = $m->a(5); # 5; $m->a_reset; $x = $m->a_isset; # false DESCRIPTION
Creates methods to handle array values in an object. For a component named "x", by default creates methods "x", "x_reset", "x_isset", "x_clear". Methods available are: "*" $m->a(3); $a = $m->a; # 3 $a = $m->a(5); # 5; Created by default. If an argument is provided, the component is set to that value. The method returns the value of the component (after assignment to a provided value, if appropriate). *_reset $m->a_reset; Created by default. Resets the component back to its default. Normally, this means that *_isset will return false, and "*" will return undef. If "-default" is in effect, then the component will be set to the default value, and *_isset will return true. If "-default_ctor" is in effect, then the default subr will be invoked, and its return value used to set the value of the component, and *_isset will return true. Advanced Note: actually, defaults are assigned as needed: typically, the next time a the value of a component is read. *_isset print $m->a_isset ? "true" : "false"; Created by default. Whether the component is currently set. This is different from being defined; initially, the component is not set (and if read, will return undef); it can be set to undef (which is a set value, which also returns undef). Having been set, the only way to unset the component is with <*_reset>. If a default value is in effect, then <*_isset> will always return true. *_clear $m->a(5); $a = $m->a; # 5 $x = $m->a_isset; # true $m->a_clear; $a = $m->a; # *undef* $x = $m->a_isset; # true Created by default. A shorthand for setting to undef. Note that the component will be set to undef, not reset, so *_isset will return true. *_get package MyClass; use Class::MethodMaker [ scalar => [{'*_get' => '*_get'}, 'a'], new => new, ]; package main; my $m = MyClass->new; $m->a(3); $a = $m->a_get; # 3 $a = $m->a_get(5); # 3; ignores argument $a = $m->a_get(5); # 3; unchanged by previous call Created on request. Retrieves the value of the component without setting (ignores any arguments passed). *_set package MyClass; use Class::MethodMaker [ scalar => [{'*_set' => '*_set'}, 'a'], new => new, ]; package main; my $m = MyClass->new; $m->a(3); $a = $m->a_set; # *undef* $a = $m->a_set(5); # *undef*; value is set but not returned $a = $m->a; # 5 Created on request. Sets the component to the first argument (or undef if no argument provided). Returns no value. perl v5.14.2 2011-11-15 Class::MethodMaker::scalar(3pm)
Man Page