[Dancer-users] Stand Alone applications using Dancer

Gabor Szabo szabgab at gmail.com
Fri Apr 2 22:36:55 UTC 2010


On Sat, Apr 3, 2010 at 1:11 AM, sawyer x <xsawyerx at gmail.com> wrote:
>
> On Sat, Apr 3, 2010 at 1:05 AM, Gabor Szabo <szabgab at gmail.com> wrote:
>>
>> How can I launch the browser from the script and how can
>> I do it *after* I called dance()
>
> KiokuDB::Navigator uses Browser::Open to accomplish that. I can honestly say
> I found it nifty. :)
>
> http://search.cpan.org/perldoc?Browser::Open

Hmm, I missed that one.
Someone needs to improve search.cpan.org so it will find modules even
if the user does not know how to search for the obvious name...

> You can view the usage of it in the "run" method of KiokuDB::Navigator.

Nice.

I have now this code:

# TODO should be in the other way around
Browser::Open::open_browser("http://localhost:3000/");
dance;

and it works but could be improved.


How could I launch dance in the background the easy way?
(I guess --daemon is not the answer for me).

Maybe a    dance_on_backstage();   ?
and a wait_for_dance_to_finish() so I don't need to implement
the ctrl-c handling myself.

dance_on_backstage();
Browser::Open::open_browser("http://localhost:3000/");
wait_for_dance_to_finish();

or maybe an even better integration in case the user launched the script
with --port=4000


dance_with_the_fox()

That would load  Browser::Open and call Browser::Open::open_browser.

I guess I am looking for suggestions how to implement these.
Gabor


More information about the Dancer-users mailing list