> I think we're already there. In your example above, $date would be an
> overloaded "object". For example:
>
> $date = localtime(); # date is an object that knows how to:
> print scalar $date; # output itself in scalar context
> $year = $date->{year}; # be accessed as a method
>
> We just need a hook (think "tie") to make $date morph as needed. Of
> course, we'd probably need to expand all of the special tie methods
> (FETCH, STORE, etc.)
This sounds perfect to me, and has major positive implications for what
I'm trying to do with open():
$fh = open $file;
print $fh "$stuff\n";
$dup = $fh->dup; # thanks Tom!
die unless $dup and $dup->is_open;
Granted there's many ways to implement this internally, but having
open() act like a specialized, optimized tie() that returns a fileobject
has some appeal to me (at least initially).
-Nate