Spidy has asked for the wisdom of the Perl Monks concerning the following question:
Recently, I have been tasked with the creation of a system that relies on Perl/CGI and MySQL. It involves the creation of 4 entities within the database, all within different tables, with different attributes. Each of these 4 entries is 'commentable'; that is, users can write short, blogcomment-like comments in response to them. All of the entity comments follow the same template(comment author, content, title, etc...), but the entity attributes do not. I would like to write a script that will output the comments for each entity using exactly the same template. I know that this is possible, because the only variance in regards to commenting is the name of the MySQL table that the comment data is stored in. Does anyone know how I would accomplish this?
And the system would be capable of growing, if I later needed to add another entity type.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pseudo-Polymorphism
by chromatic (Archbishop) on Sep 09, 2006 at 05:41 UTC | |
by Spidy (Chaplain) on Sep 09, 2006 at 17:23 UTC | |
by ikegami (Patriarch) on Sep 09, 2006 at 18:37 UTC | |
by jasonk (Parson) on Sep 10, 2006 at 02:22 UTC |