[Dancer-users] alternate routes based on where the query is coming from

franck franck at lumberjaph.net
Tue Mar 1 14:54:48 CET 2011


On Sun, Feb 27, 2011 at 11:23 AM, sawyer x <xsawyerx at gmail.com> wrote:

> Franck is putting a lot of work into the hooks right now. When those are
> done, you should be able to use a hook to do it.
>
>
>
Right, with one of the many hooks we're adding, you should be able to do
what you need. I'll keep the list informed when I've got something working
and stable enough to be used (before the end of the week, I hope)


> On Sun, Feb 27, 2011 at 5:15 AM, Puneet Kishor <punk.kish at gmail.com>wrote:
>
>> now that I have the following working (thanks Matt Vickers)
>>
>> % curl 'http://dm.local/dm.json?var=prcp&from=1980-1-1&to=1980-2-2'
>>
>> I get back
>>
>> {"prcp": [0, 1, 2, 1, 0 ... lots of elements .. ]}
>>
>> Except, these values need to be post-processed before display/use. Because
>> I get back so many values, I do the transfer as above, and then post process
>> them in the user's browser using JavaScript.
>>
>> $.ajax({
>> url : "/dm.json?var=" + v + "&from=" + from + "&to=" + to,
>> type : "GET",
>> data : "",
>> dataType: "json",
>> error : function() { alert("Error loading html document"); },
>> success : function(d) {
>> var dt = d[v];
>> var data = [];
>> for (var i = 0; i < dt.length; i++) {
>> data.push( post_process(dt[i] );
>> }
>> ..
>> display( data );
>> }
>> });
>>
>> Of course, I don't have recourse to JavaScript with curl, so I need to
>> "post process" the data *before* it gets to the user, that is, I need to do
>> it on the server side. Of course, I could do this with two different routes,
>> one for via the browser, and the other via curl. But, surely, Dancer has
>> some way more elegant pas de deux that can do this, no?
>>
>> Come to think of it, pas de deux would be a nice name for a Dancer plugin.
>>
>>
>> --
>> Puneet Kishor http://punkish.org
>> Carbon Model http://carbonmodel.org
>> Charter Member, Open Source Geospatial Foundation http://osgeo.org
>> Science Fellow http://creativecommons.org
>> Nelson Institute, UW-Madison http://nelson.wisc.edu
>> ------------------------------------------------------------------
>> Assertions are politics;
>> Backing up assertions with evidence is science
>> ==================================================================
>>
>>
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>>
>
>
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>


-- 

franck cuny

http://lumberjaph.net - http://github.com/franckcuny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110301/cc90093a/attachment.htm>


More information about the Dancer-users mailing list