I was really tired last night and it occurred to me that it could be handy to be able to smush objects together and call one object like it was two different objects.
"Objects? You can play with them however you like," I hear you saying. True. However, if you're going to the trouble of smushing objects together, and usually you're getting your object from a module (a la CGI, HTML::Template, etc.), then wouldn't it just be easier to have some sort of thing that smushes them together for you?
And, following a dastardly and insane sort of reasoning, I've cobbled together the rough notion of the Smush module.
The idea is that, instead of
use HTML::Template; and
use CGI qw( params );
you would put in
use Smush qw( HTML::Template CGI->params );
and it would let you call a Smush object that was an HTML::Template object but also had a params sub that acted exactly like the CGI params sub. The truly bored could have
use Smush qw( HTML::Template CGI );
and would get a Smush object that acted like both.
I haven't the faintest clue if this sounds vaguely useful or not (it does to me, but I just learned about closures last week, too). I just want to see if it's possible, and I'm pretty sure it is.