Working on new module: Requests for Suggestions to API

miyagawa on 2003-12-02T15:55:59

Long time no blogging on use.perl journals ...

Now I'm working on a module called "WWW::GooglishQuery" that parses Googlish query parameters like

XML url:foobar.com title:-"XSLT"

and packs it into appropriate data structure. What's the best API for it? Maybe something like this:

use WWW::GooglishQuery;
use CGI;

my $query = CGI->new(); my $text = $query->param('q');

my $q = WWW::GooglishQuery->new(); $q->parse_query($text);

# ...


Then, how do I extract query parameters? Currently I think of returning query as hashref, that is fully compatible with SQL::Abstract module. Then we can search database with Class::DBI::AbstractSearch by passing that hashref.

Any ideas?


A small comment

hex on 2003-12-03T11:13:51

Will the module be parsing anything other than queries? If not, then I'd suggest changing parse_query() to just parse(). Not a big change, but saves the end user some typing.