in reply to RE: RE (tilly) 1: Fly Subroutines on the Fly
in thread Fly Subroutines on the Fly

I could imagine a database access object that was actually a blessed coderef to a SQL query.

You might write the method generally enough that it could return the first appropriate match for the query, or all matches.

With a closure (which will be blessed), you could bind the query to operate on a single table (or a specific query string or whatever)... and you could choose to return a single value from the query or a listref or a hashref.

That's a contrived example, yes, but I could imagine using it somewhere.

  • Comment on RE: RE: RE (tilly) 1: Fly Subroutines on the Fly