Peter Scott wrote:
>
> No-one AFAICT has yet brought up formats, and what would happen to them if
> bareword filehandles go the way of the dodo. 

Here's some thoughts I've been tooling with. If we take advantage of the
indirect object syntax, we can actually make format into a member
function:

   format $FILE (q{
@<<<<<<<<<<<<<<<<, @<<<<<<<<<<<<
$stuff, $junk
   });

This would automatically flip around and call $FILE->format(...). And it
looks pretty darn familiar.

However, there's lots of problems. For one, it requires $FILE exists.
For another, if you want to use your $FILE format to refer to multiple
handles, you have to call your format function multiple times. Both are
showstoppers, IMO.

Another approach would be to have a separate format type:

   my format $FILE_FORMAT = q(
@<<<<<<<<<<<<<<<<, @<<<<<<<<<<<<
$stuff, $junk
);

This is better. Now we simply have a variable which holds our format, a
member of the format class. To use this format, now what we do is call
the original form shown above to assign it:

   format $FILE ($FILE_FORMAT);    # $FILE->format($FILE_FORMAT)

Input is appreciated. If anyone thinks it's worth one, I'll RFC it...

-Nate

Reply via email to