in reply to Re: Foo::Button->new vs. newButton()
in thread Foo::Button->new vs. newButton()

No, no the class names are not long at all. But thanks for the input. Well, it hides OO to some point. And I should of course put the symbol exported in EXPORT_OK.

As for the length, well... this is a static method. And no inheritance is needed beyond Foo::Button along the library. So why write Foo::Button->new and many others (for Text,Menu,FadeMenu,MovieClip,... ) where I can just get away with newFoo()
It was just a thought. :))
Thanks.
  • Comment on Re: Re: Foo::Button->new vs. newButton()

Replies are listed 'Best First'.
Re: Re: Re: Foo::Button->new vs. newButton()
by stvn (Monsignor) on Jan 16, 2004 at 19:58 UTC

    Just because you dont inherit it, doesn't mean someone else wont want to.

    -stvn

      Incidentally, if you wanted to get that syntax elsewhere you could provide an autoload routine:-

      sub AUTOLOAD { my $f = $AUTOLOAD; $f=~s/.*:://; if ($f =~ /^new(.*)/) { return $1->new(@_); } else { die "Undefined subroutine: $f"; } }

      I don't think it's a very good idea though, and that wouldn't give you a Foo::Button, just a button. Probably not good at all :) You can do all sorts of interesting things with AUTOLOAD