™.. Class::MethodMaker::V1Compat - Online Linux Manual PageSection : 3
Updated : 2008-12-03
Source : perl v5.10.1
Note : User Contributed Perl Documentation
NAMEClass::MethodMaker::V1Compat − V1 compatibility code for C::MM
SYNOPSISThis class is for internal implementation only. It is not a public API.
DESCRIPTIONClass::MethodMaker version 2 strives for backward-compatiblity with version 1 as far as possible. That is to say, classes built with version 1 should work with few if any changes. However, the calling conventions for building new classes are significantly different: this is necessary to achieve a greater consistency of arguments. Version 2 takes all arguments within a single arrayref: use Class::MethodMaker
[ scalar => 'a' ];
If arguments are presented as a list, then Class::MethodMaker assumes that this is a version 1 call, and acts accordingly. Version 1 arguments are passed and internally rephrased to version 2 arguments, and passed off to the version 2 engine. Thus, the majority of version 1 calls can be upgraded to version 2 merely by rephrasing. However, there are a number of behaviours that in version 1 that are internally inconsistent. These behaviours are mimicked in version 1 mode as far as possible, but are not reproducible in version 2 (to allow version 2 clients to rely on a more internally consistent interface).
Version 2 ImplementationsThe nearest equivalent to each 1 component (slot) available in version 2 is shown below using the indicated data-structures & options to create a component called \*(C`a\*(C'\fR that mimicks the V1 component behaviour as closely as possible: abstract use Class::MethodMaker
[ abstract => 'a' ];
boolean Boolean is available as a backwards compatiblity hack, but there is currently no V2 equivalent. It is likely that some replacement mechanism will be introduced in the future, but that it will be incompatible with the version 1 boolean. code use Class::MethodMaker
[ scalar => 'a' ];
Let's face it, the v1 store-if-it's-a-coderef-else-retrieve semantics are rather broken. How do you pass a coderef as argument to one of these? It is on the TODO list to recognize code as fundamental restricted type (analogous to INTEGER), which would add in a *_invoke method. copy use Class::MethodMaker
[ copy => 'a' ];
The v2 method is the same as v1. counter use Class::MethodMaker
[ scalar => [{−type => Class::MethodMaker::Constants::INTEGER}, 'a'] ];
copy deep_copy use Class::MethodMaker
[ copy => [ −deep => 'a' ] ];
get_concat use Class::MethodMaker
[ scalar => [{ −store_cb => sub {
defined $_[1] ? ( defined $_[3] ?
"$_[3] $_[1]" : $_[1] )
: undef;
}
},
'a' ]
];
get_set use Class::MethodMaker
[ scalar => 'a' ];
hash use Class::MethodMaker
[ hash => 'a' ];
key_attrib Although v1 calls will continue to work, this is not supported in v2. key_with_create Although v1 calls will continue to work, this is not supported in v2. list use Class::MethodMaker
[ list => 'a' ];
Note that the \*(C`*\*(C'\fR method now \fIsets\fR the whole array if given arguments. method See \*(C`code\*(C'\fR. new use Class::MethodMaker
[ new => 'a' ];
new_hash_init use Class::MethodMaker
[ new => [ −hash => 'a' ] ];
new_hash_with_init use Class::MethodMaker
[ new => [ −hash => −init => 'a' ] ];
new_with_args Although v1 calls will continue to work, this is not supported in v2, for it is a trivial application of \*(C`new_with_init\*(C'\fR. new_with_init use Class::MethodMaker
[ new => [ −init => 'a' ] ];
object use Class::MethodMaker
[ scalar => [{ −type => 'MyClass',
−forward => [qw/ method1 method2 /] }, 'a' ]
];
object_tie_hash use Class::MethodMaker
[ hash => [{ −type => 'MyClass',
−forward => [qw/ method1 method2 /],
−tie_class => 'Tie::MyTie',
−tie_args => [qw/ foo bar baz /],
}, 'a' ]
];
object_tie_list use Class::MethodMaker
[ array => [{ −type => 'MyClass',
−forward => [qw/ method1 method2 /],
−tie_class => 'Tie::MyTie',
−tie_args => [qw/ foo bar baz /],
}, 'a' ]
];
set_once use Class::MethodMaker
[ scalar => [{ −store_cb => sub {
die "Already stored $_[3]"
if @_ > 3;
}
},
'a' ]
];
set_once_static use Class::MethodMaker
[ scalar => [{ −store_cb => sub {
die "Already stored $_[3]"
if @_ > 3;
},
−static => 1,
},
'a' ]
];
singleton use Class::MethodMaker
[ new => [ −singleton => −hash => −init => 'a' ] ];
static_get_set use Class::MethodMaker
[ scalar => [ −static => 'a' ], ];
static_hash use Class::MethodMaker
[ hash => [ −static => 'a' ], ];
static_list use Class::MethodMaker
[ list => [ −static => 'a' ], ];
tie_hash use Class::MethodMaker
[ hash => [ { −tie_class => 'MyTie',
−tie_args => [qw/ foo bar baz /],
} => 'a' ], ];
tie_list use Class::MethodMaker
[ array => [ { −tie_class => 'MyTie',
−tie_args => [qw/ foo bar baz /],
} => 'a' ], ];
tie_scalar use Class::MethodMaker
[ scalar => [ { −tie_class => 'MyTie',
−tie_args => [qw/ foo bar baz /],
} => 'a' ], ];
Caveats & Expected BreakagesThe following version 1 component (slot) types are not currently supported in version 2: grouped_fields hash_of_lists listed_attrib struct
EXAMPLES
BUGS
REPORTING BUGSEmail the development mailing list \*(C`class\-mmaker\-devel@lists.sourceforge.net\*(C'\fR.
AUTHORMartyn J. Pearce
COPYRIGHTCopyright (c) 2003, 2004 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 0
Johanes Gumabo
Data Size : 28,573 byte
man-Class::MethodMaker::V1Compat.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 4 / 181,299
Visitor ID : :
Visitor IP : 3.15.1.23 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|Class::MethodMaker::V1Compat.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Class::MethodMaker::V1Compat.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|Class::MethodMaker::V1Compat.3pm|41|br══─}─══|'br══─}─══
) (htmlprn|149|Class::MethodMaker::V1Compat.3pm|41|'br══─}─══ |'br══─}─══
) (rof_nr_x|149|Class::MethodMaker::V1Compat.3pm|51/52|\nF|.ie \nF ══─{─══. de IX
) (rof_unit_scale_px|41|Class::MethodMaker::V1Compat.3pm|51/52|F|.ie \nF ══─{─══. de IX
) (rof_if|19|Class::MethodMaker::V1Compat.3pm|51/52|\nF|.ie \nF ══─{─══. de IX
) (htmlprn|149|Class::MethodMaker::V1Compat.3pm|51/52|.ie \nF ══─{─══. de IX|.ie \nF ══─{─══. de IX
) (rof_escape_sequence|91|Class::MethodMaker::V1Compat.3pm|53|\$1\t\\n%\t"\\$2" |. tm Index:\\$1\t\\n%\t"\\$2"
) (parse_manual_page_|249|Class::MethodMaker::V1Compat.3pm|57|══─}─══|.══─}─══
) (htmlprn|149|Class::MethodMaker::V1Compat.3pm|57|.══─}─══ |.══─}─══
) (rof_escape_sequence|91|Class::MethodMaker::V1Compat.3pm|165|\*(C`a\*(C'\fR that mimicks the V1 component behaviour as closely as |component called \f(CW\*(C`a\*(C'\fR that mimicks the V1 component behaviour as closely as
) (rof_escape_sequence|91|Class::MethodMaker::V1Compat.3pm|252|\*(C`*\*(C'\fR method now \fIsets\fR the whole array if given arguments. |Note that the \f(CW\*(C`*\*(C'\fR method now \fIsets\fR the whole array if given arguments.
) (rof_escape_sequence|91|Class::MethodMaker::V1Compat.3pm|255|\*(C`code\*(C'\fR. |See \f(CW\*(C`code\*(C'\fR.
) (rof_escape_sequence|91|Class::MethodMaker::V1Compat.3pm|277|\*(C`new_with_init\*(C'\fR. |is a trivial application of \f(CW\*(C`new_with_init\*(C'\fR.
) (rof_escape_sequence|91|Class::MethodMaker::V1Compat.3pm|409|\*(C`class\-mmaker\-devel@lists.sourceforge.net\*(C'\fR. |Email the development mailing list \f(CW\*(C`class\-mmaker\-devel@lists.sourceforge.net\*(C'\fR.
)