[Catalyst] Using URIs for my app in another program
Byron.Young at riverbed.com
Fri May 2 00:00:56 BST 2008
Ah, right, I need a HTTP request to get base. I wasn't thinking straight about that.
I think storing links in the database is what I'll do, because that leaves the responsibility of generating URIs solely with the catalyst app. If I refactor code or move things around I don't want to have to update my daemon at all.
Thanks for your feedback, Robert.
From: Robert Krimen [mailto:robertkrimen at gmail.com]
Sent: Thursday, May 01, 2008 3:34 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Using URIs for my app in another program
The most straightforward method I can think of is to factor out the URIs to a common config file.
You can have your daemon read in the config file and generate URIs from that. Your Catalyst application can either continue to use
base to generate URIs or you can generate some special URIs from the config file as well.
The problem with having your daemon load up Catalyst to generate a URI is that I'm not sure how that would work. Catalyst generates URIs
given a HTTP request. No HTTP request, no base URI.
Another safety measure is that you can have your Catalyst appl do a sanity check against the URI config file to make sure it doesn't become out of date (maybe a startup test request).
On Thu, May 1, 2008 at 2:27 PM, Byron Young <Byron.Young at riverbed.com<mailto:Byron.Young at riverbed.com>> wrote:
I've run into a situation that I can't find a good solution to and am hoping to solicit some ideas from people on the list here.
An app I've been working on consists of two main parts - a Catalyst-based web app which provides the UI, and a daemon that does the heavy lifting. They are totally separate applications that talk to one another via database. The daemon will sometimes send emails to users when it finishes certain tasks that the users are interested in, and I want to include links in the emails that would bring the user to a Results page on the web app where they can get more information about the result of the task.
So, what I would like is to be able to call $c->uri_for() from my daemon. Is there any 'sanctioned' way of doing that? If possible, I'd like to avoid loading my whole catalyst app and somehow tricking it into believing its running under the same environment as my real app.
Another option is to use the database to pass URIs around. Maybe a URI table that maps finished tasks to URIs. However, I would rather just be able to arbitrarily call $c->uri_for() whenever I decide I need to include a URI in my daemon instead of having to create a table or column whenever I decide I want to send a link to a new type of resource.
Any suggestions? Maybe I'm just going about it all wrong?
List: Catalyst at lists.scsys.co.uk<mailto:Catalyst at lists.scsys.co.uk>
Searchable archive: http://firstname.lastname@example.org/
Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Catalyst