Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

class::makemethods::template::packagevar(3pm) [debian man page]

MakeMethods::Template::PackageVar(3pm)			User Contributed Perl Documentation		    MakeMethods::Template::PackageVar(3pm)

NAME
Class::MakeMethods::Template::PackageVar - Static methods with global variables SYNOPSIS
package MyObject; use Class::MakeMethods::Template::PackageVar ( scalar => [ 'foo' ] ); package main; MyObject->foo('bar') print MyObject->foo(); $MyObject::foo = 'bazillion'; print MyObject->foo(); DESCRIPTION
These meta-methods provide access to package (class global) variables. These are essentially the same as the Static meta-methods, except that they use a global variable in the declaring package to store their values. Common Parameters: The following parameters are defined for PackageVar meta-methods. variable The name of the variable to store the value in. Defaults to the same name as the method. Standard Methods The following methods from Generic should all be supported: scalar string string_index (?) number boolean bits (?) array (*) hash (*) tiedhash (?) hash_of_arrays (?) object (?) instance (?) array_of_objects (?) code (?) code_or_scalar (?) See Class::MakeMethods::Template::Generic for the interfaces and behaviors of these method types. The items marked with a * above are specifically defined in this package, whereas the others are formed automatically by the interaction of this package's generic settings with the code templates provided by the Generic superclass. The items marked with a ? above have not been tested sufficiently; please inform the author if they do not function as you would expect. PackageVar:vars This rewrite rule converts package variable names into PackageVar methods of the equivalent data type. Here's an example declaration: package MyClass; use Class::MakeMethods::Template::PackageVar ( vars => '$DEBUG %Index' ); MyClass now has methods that get and set the contents of its $MyClass::DEBUG and %MyClass::Index package variables: MyClass->DEBUG( 1 ); MyClass->Index( 'foo' => 'bar' ); perl v5.10.1 2004-09-06 MakeMethods::Template::PackageVar(3pm)

Check Out this Related Man Page

MakeMethods::Attribute(3pm)				User Contributed Perl Documentation			       MakeMethods::Attribute(3pm)

NAME
Class::MakeMethods::Attribute - Declare generated subs with attribute syntax SYNOPSIS
package MyObject; use Class::MakeMethods::Attribute 'Standard::Hash'; sub new :MakeMethod('new'); sub foo :MakeMethod('scalar'); sub bar :MakeMethod('scalar', { hashkey => 'bar_data' }); sub debug :MakeMethod('Standard::Global:scalar'); DESCRIPTION
This package allows common types of methods to be generated via a subroutine attribute declaration. (Available in Perl 5.6 and later.) Adding the :MakeMethod() attribute to a subroutine declaration causes Class::MakeMethods to create and install a subroutine based on the parameters given to the :MakeMethod attribute. You can declare a default method-generation class by passing the name of a MakeMethods subclass in the use Class::MakeMethods::Attribute statement. This default method-generation class will also apply as the default to any subclasses declared at compile time. If no default method-generation class is selected, you will need to fully-qualify all method type declarations. EXAMPLE
Here's a typical use of Class::MakeMethods::Attribute: package MyObject; use Class::MakeMethods::Attribute 'Standard::Hash'; sub new :MakeMethod('new'); sub foo :MakeMethod('scalar'); sub bar :MakeMethod('scalar', { hashkey => 'bar_data' }); sub debug :MakeMethod('Standard::Global:scalar'); package MySubclass; use base 'MyObject'; sub bazzle :MakeMethod('scalar'); This is equivalent to the following explicit Class::MakeMethods invocations: package MyObject; use Class::MakeMethods ( -MakerClass => 'Standard::Hash', new => 'new', scalar => 'foo', scalar => [ 'ba', { hashkey => 'bar_data' } ], 'Standard::Global:scalar' => 'debug', ); package MySubclass; use base 'MyObject'; use Class::MakeMethods ( -MakerClass => 'Standard::Hash', scalar => 'bazzle', ); DIAGNOSTICS
The following warnings and errors may be produced when using Class::MakeMethods::Attribute to generate methods. (Note that this list does not include run-time messages produced by calling the generated methods, or the standard messages produced by Class::MakeMethods.) Can't apply MakeMethod attribute to %s declaration. You can not use the ":MakeMethod" attribute with lexical or anonymous subroutine declarations. No method type provided for MakeMethod attribute. You called ":MakeMethod()" without the required method-type argument. SEE ALSO
See Attribute::Handlers byEDamian Conway. See Class::MakeMethods for general information about this distribution. perl v5.10.1 2004-09-06 MakeMethods::Attribute(3pm)
Man Page