>>>>> "MGS" == Michael G Schwern <[EMAIL PROTECTED]> writes:

  >> even better than just be a poorly written constructor is that it is
  >> inside a 'factory' module that is inherited by 80 other modules!!

  MGS> If that's an example of "poorly written" code in your project,
  MGS> can I come work there?  It at least gets it right, if verbosely.

well it is a live system so it must be 'right'. i was hired to review it
and the double copy of the hash data is what bothers me. as this is
called zillions of times by all those modules it is a quick and easy
speedup.

and they are hiring more outsource indians so you won't be contacted. :(

  MGS> sub new {
  MGS>  my $class = shift;
  MGS>  return bless( [EMAIL PROTECTED], $class );
  MGS> }

my clean version is:

sub new {
        my ( $class, %self ) = @_ ;
        return bless \%self, $class ;
}

i don't like using shift for args if i can help it.

  MGS> sub new [EMAIL PROTECTED],shift}

that is the same as my shorter golf answer. maybe i counted mine wrong.

  MGS> sub new {$a=shift;[EMAIL PROTECTED],$a}

  MGS> 21.  And it's even strict clean. :)

that is nice. the other replies beat it though!

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to