in reply to JSON WebService Description with PERl
I've built well over a dozen protocols for various services. Over the years they have all migrated towards JSON over HTTP. I've gotten to the point where I don't really care about being able to wrap any subroutine signature under the sun. I've given myself a very simple layout.
Since I have an easy format to follow, my meta description service is easy to write to as well. If I exposed a method called "foo," I would also write an accompanying sub called "foo_meta" which returns a very simple descriptive data structure. Here is one that I wrote within the past month or two:
sub __profile_meta { return { desc => 'Return an existing domain site profile', args => { domain => { desc => 'Domain for which to fetch the profile', required => 1, type => 'domain', }, file => { desc => 'Optional - The file location' .' where this profile is installed.' .' Defaults to profile.html", required => 0, }, }, result => { file => 'The file that this profile' .' will be installed at", body_logo => "Logo for the page", body_sections => [{ type => 'Type of content', html => 'The content itself', }], body_slogan => "Slogan for the page", contacts => [{ name => "Name for this contact", email => "Email for the contact", }], meta_description => 'Meta tag description', meta_keywords => ['List of keywords'], }, }; }
I've found that I can fit pretty much anything I need to into this scheme. Of course YMMV.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: JSON WebService Description with PERl
by several (Acolyte) on May 08, 2012 at 14:09 UTC | |
by Rhandom (Curate) on May 08, 2012 at 14:45 UTC |