Class::DBI and CGI::Application make heavy use of inheritance, as does Exporter, though I wouldn't really call that OO--it's more like using Perl's OO-ish features in a non-OO way.
Right now, I'm in the middle of a project that needs to generate reports based on certain data. The reports could come out in HTML, PDF, Excel, or even a CSV for exporting to another system. I've worked this by having an ExportFormat class which specific report formats inheirt from. After the constructor is called, a record() method is called many times with the argument as a single row from the database (actually, a Class::DBI subclass containing a single row). When the application is done filling the data, it calls a done() method, which returns a filehandle that contains the completed report. Since this is a web application, each report also has a mime_type() method that gives the MIME type that should be sent back to the client for this report.
I find this solution to be quite elegant.
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: Real live usage of inheritance?
by hardburn
in thread Real live usage of inheritance?
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |