hi smls

your three requirements for encapsulation, declaration and reusability, would suggest to me for an object orientated interface. I am not convinced that overloading the global symbol space would really help with remaining encapsulated.And what you describe here sounds a lot like what Export is doing when you import the register_query routine. So are you in effect calling import for each query you register? Rather than for the class interface, then calling methods from the class on each query, which would adhere to the reusability and declaritve requirements too.

As the query is in a hash format, I would look at making the register_query as a constructor, something like my $rq = RQS->new; then go on to load the query object. your module needs to do the work to define the methods you would then call to set up each specific query and the execution methods.

In summary, I think the interface is a little muddled. You start off functionally, but then create objects on top of a functional interface. The well known Module CGI is a classic as it provides both interfaces so is worth a bit of study. I think you would be best to choose either functional, or object orientated. Or do something like CGI which offers either interface. I am not so sure about trying to implement both interfaces through one request though.

Others have suggetsed modules similar to yours to look at, admittedly CGI is a monolith. They may not do what you are trying to do in terms of use, but they may provide you with some implementation hints, closer to your interface model.

In terms of what you are describing, the use of this module would certainly help you, so no reason not to follow up with it, and usually if you have need for something, others may well also too.


My other OS is a gateway!

In reply to Re: RFC: API for declarative parameterized web queries by Don Coyote
in thread RFC: API for declarative parameterized web queries by smls

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.