in reply to Perl OOP Function Entrance

I strongly advice against using the same subs for different APIs.*

If you really want to go with this strange requirement - what is $self supposed to be in non method calls (?) - you can use a different namespaces to mirror the function/methods.

# UNTESTED package functional_Util; my $default_self= "something"; sub utility { unshift $default_self, @_; goto &methodlike_Util::utility; } package methodlike_Util; sub utility { my $self =shift; # ... do it }

Of course you are free to use it the other way round if $self doesn't matter.

Please note that Perl is flexible enough to autogenerate the needed "mirrors", either/or per

It's a trade: You are gaining large runtime performance and a clean interface for adding little compile-time complexity.

But again I doubt the requirements are well thought off, sounds like a political compromise inside a big team meeting where everyone wants his own private menu in a restaurant just to prove he knows cooking.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

update

*) since checking the arguments is complicated, error prone and slow, see other replies.