[Israel.pm] Horrible Code

Yosef Meller mellerf at netvision.net.il
Mon Oct 23 01:49:43 PDT 2006


ציטוט Shmuel Fomberg:
> 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 here's your answer: maybe the previous writer wanted more work for 
himself. Or maybe he was writing defensively, so npbody would fire him.

> 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. 
> 
> 
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
> 




More information about the Perl mailing list