Hi all,
A few days ago I started a conversation with Kake about one unsatisfying aspect of CGI::Wiki's API: that the object-orientedness is not extended to nodes and other concepts in the system. Returning nodes as hashes exposes the internal elements of your implementation, makes it harder for folks to extend nodes via subclasses, and just feels wrong in today's object-oriented world.
I'd love to see CGI::Wiki::Node as a first class object. Then,
* content(), last_modified(), metadata(), etc. are accessor/mutator methods on CGI::Wiki::Node (zero arguments gets the value, one argument sets the value) * verify_checksum() and delete() are methods on CGI::Wiki::Node * retrieve_node() returns an CGI::Wiki::Node object (or undef if it doesn't exist - it is bad form to assume an empty node, IMO) * list_backlinks(), list_dangling_links(), etc. return a list of CGI::Wiki::Node objects
There are some nice utility classes that can help construct the CGI::Wiki::Node class, like Class::Accessor and Class::DBI.
Obviously for backwards compatibility we'd want to keep both APIs around for a while. Kake suggested that we use an api_version parameter in the constructor:
my $wiki = CGI::Wiki->new( api_version => 2, # 1 is hash-based, 2 is object-based ..., );
What do people think?
Jon