The following module was proposed for inclusion in the Module List:
modid: Object::Exporter
DSLIP: Rdphp
description: Export class methods as regular subroutines
userid: SPLICE (David James)
chapterid: 6 (Data_Type_Utilities)
communities:
Mailinglists
similar:
Exporter::Lite
rationale:
This package allows you to export object methods as regular
subroutines. It supports C<import()>, C<@EXPORT> and C<@EXPORT_OK>
and not a whole lot else. Each package into which your object
methods are imported gets its own instance of the object. This
ensures that there are no interaction effects between multiple
packages that use your object.
This module makes it much easier to set up a hybrid interface ala
CGI.pm. You can take any old module that has an object-oriented
interface and convert it to have a hybrid interface by simply adding
"use base 'Object::Exporter'" to your code.
Here's the SYNOPSIS: package MagicNumber; use base
'Object::Exporter';
# Export object-oriented methods! @EXPORT_OK = qw(magic_number);
sub new { my $class = shift; bless { magic_number=>3, @_ }, $class
} sub magic_number { my $self = shift; @_ and $self->{magic_number}
= shift; $self->{magic_number} }
# Meanwhile, in another piece of code! package Bar; use
MagicNumber; # exports magic_number print magic_number; # prints 3
magic_number(7); print magic_number; # prints 7 # Each package gets
its own instance of the object. This ensures that # two packages
both using your module via import semantics don't mess # with each
other. package Baz; use MagicNumber; # exports magic_number print
magic_number; # prints 3!
Most of the code and documentation was borrowed from
Exporter::Lite. Exporter::Lite was written by Michael G Schwern
<[EMAIL PROTECTED]>
enteredby: SPLICE (David James)
enteredon: Sat Apr 5 21:05:04 2003 GMT
The resulting entry would be:
Object::
::Exporter Rdphp Export class methods as regular subroutines SPLICE
Thanks for registering,
--
The PAUSE
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=c6200000_08fd35c753238390&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=c6200000_08fd35c753238390&SUBMIT_pause99_add_mod_insertit=1