Nothing particularly wrong with exporting a constructor to get that syntax, although I'd put it in @EXPORT_OK instead. newButton should pass the entire @_ variable to new.
Perhaps the biggest problem is that subclasses won't be able to be called with newButton. That being the case, newButton might as well call new as new(__PACKAGE__, @_) to improve performance.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: Foo::Button->new vs. newButton()
by hardburn
in thread Foo::Button->new vs. newButton()
by bakunin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |