[Israel.pm] Horrible Code

Shmuel Fomberg semuelf at 012.net.il
Sun Oct 22 11:10:43 PDT 2006


Hello there.

Today I come accrose some really strange code. 
I'll write it from the memory - so be toleranting. 
But the code went something like that:

Package Mama;

Sub new {
   ... not intrestiong
   my $self = {};
   bless $self, 'Mama';
   ... more code

   my %retval = ();
   tie %retval, 'Mama';
   bless \%retval, 'Mama';
   return \%retval;
}

sub TIEHASH {
   my $obj = shift;
   $real_obj = $obj;  # a global
   bless $obj, 'Mama';
}

Don't ask me what the writer was thinking.
The object does not implement any other function of the tie-hash
interface, so it is completely useless. 
Should I mention that the object also has 100 functions that are
copy-paste of each other, and all of them have the same bug?

The plus side in all this - more work for me. YaY!
And Gabor is said to come tomorrow to give a course on Perl in the
company. (not for me - I was hired as perl expert - they won't send me
to perl course.)

Well, see ya at lunch, Gabor!

Shmuel. 





More information about the Perl mailing list