| March 2002 | Perl Hardware Store | 18 | 
You wish that $dbh supported a myquery method
Subclassing is a pain in the butt
Do this instead:
         sub Msql::myquery {
           my $dbh = shift;
           # Just stick the method here, dummy.
         }
Now you can say
          @list_of_hashes = $dbh->myquery(...);
myquery is inherited by Msql's subclasses just the way you'd want.
Downside: The programmer in the next cubicle might do the same thing
If you add a lot of new methods, consider making a subclass
Downside: People from those other languages may be appalled
Solution: Ignore them
| Next |  | Copyright © 2002 M-J. Dominus |