Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > What does "__PACKAGE__->_factory" actually do?

Thread Tools

What does "__PACKAGE__->_factory" actually do?

Ted Byers
Posts: n/a
Here is a class created by, most of which I understand (I'll interject comments representing my understanding and end with the questions):

# obviously I haven't quoted the whol file, but rather the key components
# these I understand as private data members of the class, wth some
# syntactic sugar (ATTR) provided by the class package to automagically make
# the read accessor function (very nice)
my %id_of :ATTR(:get<id>);
my %type_of :ATTR(:get<type>);
my %name_of :ATTR(:get<name>);
my %size_of :ATTR(:get<size>);
my %extension_of :ATTR(:get<extension>);
my %file_of :ATTR(:get<file>);

# I can't find the documentation for this function
# I know wha a factory is in OOP, having written enough of them in C++, but
# I can't find the documentation for this function, and I am especially
# interested in knowing what the arguments are supposed to be and how they're
# used.
# obviously the first appears to be an array reference to an array with field
# names, and the second two are hashes mapping the field names to hashes and
# their types
[ qw( id

) ],
'id' => \%id_of,
'type' => \%type_of,
'name' => \%name_of,
'size' => \%size_of,
'extension' => \%extension_of,
'file' => \%file_of,
'id' => 'SOAP::WSDL::XSD::Typelib::Builtin::int',
'type' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
'name' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
'size' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
'extension' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
'file' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',

'id' => 'id',
'type' => 'type',
'name' => 'name',
'size' => 'size',
'extension' => 'extension',
'file' => 'file',

But, this is confusing as it looks like the data members are supposed to be either an integer or a string (i.e. look at the SOAP types), but why, then, are the data members for this class defined as hashes?

Clarification would be helpful.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How does TinEye actually work to identify a photo (does it useEXIF?) William Don**ly Digital Photography 8 12-28-2012 01:29 PM
thread.start() does not actually execute the assigned method =?Utf-8?B?Y2hyaXN2Yw==?= ASP .Net 4 06-10-2007 11:54 AM
Does QOS on an 828 or 837 actually achieve anything? John Rennie Cisco 4 08-26-2005 04:49 PM
Does WebControls.Image actually contain an image? Jim Hammond ASP .Net 1 11-13-2003 01:20 AM
what does the native keyword do actually ? and how does it work ?when we can use it ? Alek Nazarian Java 7 10-22-2003 04:33 PM