>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:

  SB> Jenda Krynicky wrote:
  >> 
  >> Use whatever feels more natural to you.

  SB> I really think I'll stick with OO for consistency throughout, even if
  SB> it's just for the simple purpose of having a consistent

  SB> my $self = shift;

  SB> ...as the first statement of every subroutine definition.

but if there is nothing passed in, what do you do? compare these
examples:

Foo::bar() ;

Foo->bar() ;

what is passed in @_ in those two cases? one is a procedural call and
the other is an OO style call.

  SB> Many of the methods that could-be functions create external objects
  SB> anyway, and in the event I do need the module to generate an object, I'm
  SB> already set up for it.

class level subs (no object is passed in nor any class name is needed)
is common enough. it isn't a faux pas in most cases but a style
issue. making a basic procedural sub into a class method for no reason
means you pass useless data (the class name) and ignore it in the
sub. that to me is a poor API.

  SB> Besides... I'm at a stage where I'd rather carry on with Perl BCP and
  SB> coding, as opposed to changing gears and learning how the Exporter
  SB> works. Uri's suggestion of the '_' private prefix keeps things well in
  SB> check.

that _ prefix isn't my idea, it is in perlstyle i believe and is a
common convention for internal methods (those only called by other
methods in the current class). class methods are external and shouldn't
use that (see the second call above).

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to