From yanick at babyl.dyndns.org Mon Jul 1 18:18:12 2013 From: yanick at babyl.dyndns.org (Yanick Champoux) Date: Mon, 01 Jul 2013 13:18:12 -0400 Subject: [dancer-users] setting mime type In-Reply-To: <24D81E55-601B-42BE-97D8-0078D6E94E90@gmail.com> References: <24D81E55-601B-42BE-97D8-0078D6E94E90@gmail.com> Message-ID: <51D1B9D4.2060707@babyl.dyndns.org> On 13-06-30 02:51 AM, Mr. Puneet Kishor wrote: > but I need to set the correct mime type for the video. How do I do that with Dancer? if you use 'send_file', Dancer will try to guess a decent miem type based on the file's extension. If not, you can manipulate the content type via 'response->content_type( 'some/type' )' Joy, `/anick From punk.kish at gmail.com Mon Jul 1 18:53:17 2013 From: punk.kish at gmail.com (Puneet Kishor) Date: Mon, 1 Jul 2013 10:53:17 -0700 Subject: [dancer-users] setting mime type In-Reply-To: <51D1B9D4.2060707@babyl.dyndns.org> References: <24D81E55-601B-42BE-97D8-0078D6E94E90@gmail.com> <51D1B9D4.2060707@babyl.dyndns.org> Message-ID: On Jul 1, 2013, at 10:18 AM, Yanick Champoux wrote: > On 13-06-30 02:51 AM, Mr. Puneet Kishor wrote: >> but I need to set the correct mime type for the video. How do I do that with Dancer? > > if you use 'send_file', Dancer will try to guess a decent miem type based on the file's extension. > > If not, you can manipulate the content type via 'response->content_type( 'some/type' )' > I am going to reformulate my question. I have the following code -- In my browser
var tmpl = Handlebars.compile( $("#tmpl").html() ); $.ajax({ url : "/v/" + page, type : "GET", dataType: "json", error : function() { alert("Error loading html document"); }, success : function(res) { if (res == null) { return; } document.title = res.title; $("#content").html( tmpl( {text: res.text} ); ); } }); On my server get '/v/:page' => sub { my $page = param('page'); my ($title, $modified_on) = get_page($page); debug "sending back $uri"; my %tmpl_opts = ( title => $title, text => qq{ }, modified_on => $modified_on ); return to_json \%tmpl_opts; }; The above code works fine on all browsers on the desktop. However, on Safari on iPad the video is disabled. Dancer is running on Starman behind an Apache proxy. A static test page with the video code (no ajax, no JavaScript templates) served directly by Apache works fine even on Safari on iPad. What am I doing wrong, and how can I correct this? -- Puneet Kishor From kvmsanand at gmail.com Tue Jul 2 22:56:37 2013 From: kvmsanand at gmail.com (Anand Meher) Date: Tue, 2 Jul 2013 23:56:37 +0200 Subject: [dancer-users] Refresh a Route periodically Message-ID: Dear Perl Dancer Experts, I am new to perl dancer. Thank you for the dancer framework. I could ramp-up quickly w.r.t using dancer framework to develop simple web-pages. I am trying to develop a webpage where I would like to have contents of a webpage refreshed (say after every x seconds). I briefly went through the mailing lists and other sites and I figured out that AnyEvent from Twiggy might be one solution to do it. I wanted to solve the problem by redirecting a route to itself after every x seconds. something like : get '/' => sub { $w = AnyEvent->timer(after => 1, interval => 15, cb => sub { # do some database retrievals redirect "/"; }); template 'index'; }; Could you please suggest if this will work , or if there is any other better and easier way to do it. Also : When I try installing Twiggy by using cpanm Twiggy, the installation gets stuck at the point "Building and testing Test-SharedFork-0.21 ...". I am using a windows 64 bit machine with strawberry perl, with version - 5.10.1. could you please help with a solution for this? Thank you in advance Best Regards Ajay MK -------------- next part -------------- An HTML attachment was scrubbed... URL: From yanick at babyl.dyndns.org Wed Jul 3 03:14:31 2013 From: yanick at babyl.dyndns.org (Yanick Champoux) Date: Tue, 02 Jul 2013 22:14:31 -0400 Subject: [dancer-users] Refresh a Route periodically In-Reply-To: References: Message-ID: <51D38907.9060903@babyl.dyndns.org> On 13-07-02 05:56 PM, Anand Meher wrote: > I am trying to develop a webpage where I would like to have contents of > a webpage refreshed (say after every x seconds). Dancer::Plugin::Cache::CHI, perhaps ? get '/' => sub { # only recomputed every 5 minutes cache_page template( 'index' ), 300; }; Joy, `/anick From punk.kish at gmail.com Wed Jul 3 03:18:59 2013 From: punk.kish at gmail.com (Puneet Kishor) Date: Tue, 2 Jul 2013 19:18:59 -0700 Subject: [dancer-users] Refresh a Route periodically In-Reply-To: <51D38907.9060903@babyl.dyndns.org> References: <51D38907.9060903@babyl.dyndns.org> Message-ID: <1027B2A8-B093-42F2-8A63-FCB04C35D853@gmail.com> On Jul 2, 2013, at 7:14 PM, Yanick Champoux wrote: > On 13-07-02 05:56 PM, Anand Meher wrote: >> I am trying to develop a webpage where I would like to have contents of >> a webpage refreshed (say after every x seconds). > > Dancer::Plugin::Cache::CHI, perhaps ? > > > get '/' => sub { > # only recomputed every 5 minutes > cache_page template( 'index' ), 300; > }; Client-side pull perhaps? In other words, nothing to do with Dancer... Just use JS to poll every five mins for new results. -- Puneet Kishor From msouth at gmail.com Wed Jul 3 07:28:51 2013 From: msouth at gmail.com (Mike South) Date: Wed, 3 Jul 2013 01:28:51 -0500 Subject: [dancer-users] Refresh a Route periodically In-Reply-To: References: Message-ID: On Tue, Jul 2, 2013 at 4:56 PM, Anand Meher wrote: > Dear Perl Dancer Experts, > I am new to perl dancer. Thank you > for the dancer framework. I could ramp-up quickly w.r.t using dancer > framework to develop simple web-pages. > > I am trying to develop a webpage where I would like to have contents of a > webpage refreshed (say after every x seconds). > > I briefly went through the mailing lists and other sites and I figured out > that AnyEvent from Twiggy might be one solution to do it. > > I wanted to solve the problem by redirecting a route to itself after every > x seconds. > > something like : > > get '/' => sub { > > $w = AnyEvent->timer(after => 1, interval => 15, cb => sub { > > # do some database retrievals > > redirect "/"; > > }); > > template 'index'; > > }; > > > Could you please suggest if this will work , or if there is any other > better and easier way to do it. > > Also : When I try installing Twiggy by using cpanm Twiggy, the > installation gets stuck at the point "Building and testing > Test-SharedFork-0.21 ...". I am using a windows 64 bit machine with > strawberry perl, with version - 5.10.1. > I have virtually no experience with Perl on Windows. So it's probably safest to ignore me. But it's possible that the problem is only with the test module having some kind of problem on Windows--the module you're trying to install might actually work ok if you skip the tests or force the install. (cpanm --help). mike > could you please help with a solution for this? > > Thank you in advance > > Best Regards > Ajay MK > > > > > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From melo at simplicidade.org Wed Jul 3 09:17:34 2013 From: melo at simplicidade.org (Pedro Melo) Date: Wed, 3 Jul 2013 09:17:34 +0100 Subject: [dancer-users] Refresh a Route periodically In-Reply-To: References: Message-ID: Hi, On Tue, Jul 2, 2013 at 10:56 PM, Anand Meher wrote: > Dear Perl Dancer Experts, > I am new to perl dancer. Thank you > for the dancer framework. I could ramp-up quickly w.r.t using dancer > framework to develop simple web-pages. > > I am trying to develop a webpage where I would like to have contents of a > webpage refreshed (say after every x seconds). > Maybe I'm misunderstanding but why do you need server side support for this? The basic way of doing this is to add a tag to your HTML like this: The 60 above is the number of seconds until refresh. Replace it with the proper place. An alternative solution is a bit of Javascript that sets a timer and forces the refresh when it expires. You can even just refresh the parts of the page you need, with an AJAX request. Maybe I misunderstood what you want to do, but I see no reason to do this server side on your explanation. Bye. -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo at simplicidade.org mailto:melo at simplicidade.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From fenghe at nsbeta.info Thu Jul 4 02:37:20 2013 From: fenghe at nsbeta.info (Feng He) Date: Thu, 04 Jul 2013 09:37:20 +0800 Subject: [dancer-users] Just another dancer Message-ID: <51D4D1D0.1030009@nsbeta.info> We game.yy.com have been using dancer to provide the RESTful API for our DNS service. It is simple enough to write the API methods along with the great Perl modules on CPAN, special to the DNS related modules like Net::DNS, Data::Validate::Domain etc. Once the API was running with CGI under Apache, but I swithed them to dancer within just one day. Thanks for the great project. From xsawyerx at gmail.com Thu Jul 4 06:58:20 2013 From: xsawyerx at gmail.com (sawyer x) Date: Thu, 4 Jul 2013 08:58:20 +0300 Subject: [dancer-users] Just another dancer In-Reply-To: <51D4D1D0.1030009@nsbeta.info> References: <51D4D1D0.1030009@nsbeta.info> Message-ID: If you could write a few words on what the site is about (I realize "games" are a major part of it :) - we could add it to the dancefloor. :) On Thu, Jul 4, 2013 at 4:37 AM, Feng He wrote: > We game.yy.com have been using dancer to provide the RESTful API for our > DNS service. It is simple enough to write the API methods along with the > great Perl modules on CPAN, special to the DNS related modules like > Net::DNS, Data::Validate::Domain etc. Once the API was running with CGI > under Apache, but I swithed them to dancer within just one day. > Thanks for the great project. > ______________________________**_________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/**mailman/listinfo/dancer-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fenghe at nsbeta.info Thu Jul 4 07:24:41 2013 From: fenghe at nsbeta.info (Feng He) Date: Thu, 04 Jul 2013 14:24:41 +0800 Subject: [dancer-users] Just another dancer In-Reply-To: References: <51D4D1D0.1030009@nsbeta.info> Message-ID: <51D51529.3040106@nsbeta.info> I didn't get an english introduction to the company. But you may find the info here: http://www.nasdaq.com/symbol/yy Cheers. ? 2013-7-4 13:58, sawyer x ??: > If you could write a few words on what the site is about (I realize > "games" are a major part of it :) - we could add it to the dancefloor. :) > > > On Thu, Jul 4, 2013 at 4:37 AM, Feng He > wrote: > > We game.yy.com have been using dancer to > provide the RESTful API for our DNS service. It is simple enough to > write the API methods along with the great Perl modules on CPAN, > special to the DNS related modules like Net::DNS, > Data::Validate::Domain etc. Once the API was running with CGI under > Apache, but I swithed them to dancer within just one day. > Thanks for the great project. > _________________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/__mailman/listinfo/dancer-users > > > > > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > From yanick at babyl.dyndns.org Thu Jul 4 12:53:37 2013 From: yanick at babyl.dyndns.org (Yanick Champoux) Date: Thu, 04 Jul 2013 07:53:37 -0400 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN Message-ID: <51D56241.6040400@babyl.dyndns.org> Hi all, Just to say that a new, minor release of Dancer is on its way to CPAN. Here's the changelog: [ ENHANCEMENTS ] * GH #767: forwarded_for_address() now looks for HTTP_X_FORWARDED_FOR if X_FORWARDED_FOR is not there. (Jakob Voss) * GH #936: Add file locking to file logger. (David Golden) * GH #937: Add details to tutorial. (Craig Treptow) Joy, `/anick From sukria at gmail.com Thu Jul 4 13:08:44 2013 From: sukria at gmail.com (Alexis Sukrieh) Date: Thu, 4 Jul 2013 14:08:44 +0200 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN In-Reply-To: <51D56241.6040400@babyl.dyndns.org> References: <51D56241.6040400@babyl.dyndns.org> Message-ID: Great! Kudos! 2013/7/4 Yanick Champoux > Hi all, > > Just to say that a new, minor release of Dancer is on its way to > CPAN. Here's the changelog: > > [ ENHANCEMENTS ] > > * GH #767: forwarded_for_address() now looks for HTTP_X_FORWARDED_FOR > if X_FORWARDED_FOR is not there. (Jakob Voss) > > * GH #936: Add file locking to file logger. (David Golden) > > * GH #937: Add details to tutorial. (Craig Treptow) > > > Joy, > `/anick > ______________________________**_________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/**mailman/listinfo/dancer-users > > -- Alexis Sukrieh -------------- next part -------------- An HTML attachment was scrubbed... URL: From melo at simplicidade.org Thu Jul 4 14:28:44 2013 From: melo at simplicidade.org (Pedro Melo) Date: Thu, 4 Jul 2013 14:28:44 +0100 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN In-Reply-To: <51D56241.6040400@babyl.dyndns.org> References: <51D56241.6040400@babyl.dyndns.org> Message-ID: Hi, I've been a bit out of touch, I'm using Dancer2 in production but I was wondering what is the current status of development. Where do you need help on Dancer2? Bye, On Thu, Jul 4, 2013 at 12:53 PM, Yanick Champoux wrote: > Hi all, > > Just to say that a new, minor release of Dancer is on its way to > CPAN. Here's the changelog: > > [ ENHANCEMENTS ] > > * GH #767: forwarded_for_address() now looks for HTTP_X_FORWARDED_FOR > if X_FORWARDED_FOR is not there. (Jakob Voss) > > * GH #936: Add file locking to file logger. (David Golden) > > * GH #937: Add details to tutorial. (Craig Treptow) > > > Joy, > `/anick > ______________________________**_________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/**mailman/listinfo/dancer-users > -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo at simplicidade.org mailto:melo at simplicidade.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From huguesmax at gmail.com Thu Jul 4 15:18:52 2013 From: huguesmax at gmail.com (Hugues Max) Date: Thu, 04 Jul 2013 16:18:52 +0200 Subject: [dancer-users] unable to install Dancer::Session::Cookie Message-ID: <51D5844C.4040705@gmail.com> Hello I try to install Dancer::Session::Cookie (Centos 6.4, Dancer 1.3116, perl v5.10.1 ) and I've got a error cpanm Dancer::Session::Cookie --> Working on Dancer::Session::Cookie Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Dancer-Session-Cookie-0.22.tar.gz ... OK Configuring Dancer-Session-Cookie-0.22 ... OK Building and testing Dancer-Session-Cookie-0.22 ... FAIL if I see end of /root/.cpanm/build.log, there a error with autoflush method from FileHandle cpanm FileHandle FileHandle is up to date. (2.02) someone has a idea ? t/00-report-prereqs.t ........ ok t/01-session.t ............... ok Can't locate object method "autoflush" via package "FileHandle" at /usr/local/share/perl5/Dancer/Logger/File.pm line 59. # Looks like you planned 3 tests but ran 2. # Looks like your test exited with 25 just after 2. t/02-configfile.t ............ Dubious, test returned 25 (wstat 6400, 0x1900) Failed 1/3 subtests t/03-path.t .................. ok t/04-session_name.t .......... ok t/05-session_secure.t ........ ok >> Dancer 1.3116 server 29694 listening on http://0.0.0.0:50940 t/06-redirect.t .............. ok >> Dancer 1.3116 server 29696 listening on http://0.0.0.0:50657 t/redirect-session-dancer.t .. ok >> Dancer 1.3116 server 29698 listening on http://0.0.0.0:50336 >> Dancer 1.3116 server 29699 listening on http://0.0.0.0:50807 >> Dancer 1.3116 server 29700 listening on http://0.0.0.0:50244 >> Dancer 1.3116 server 29701 listening on http://0.0.0.0:50603 t/server.t ................... ok >> Dancer 1.3116 server 29703 listening on http://0.0.0.0:50585 t/session-stealing.t ......... ok Test Summary Report ------------------- t/02-configfile.t (Wstat: 6400 Tests: 2 Failed: 0) Non-zero exit status: 25 Parse errors: Bad plan. You planned 3 tests but ran 2. Files=11, Tests=33, 3 wallclock secs ( 0.03 usr 0.04 sys + 2.32 cusr 0.41 csys = 2.80 CPU) Result: FAIL Failed 1/11 test programs. 0/33 subtests failed. make: *** [test_dynamic] Erreur 255 -> FAIL Installing Dancer::Session::Cookie failed. See /root/.cpanm/build.log for details ------------------- t/02-configfile.t (Wstat: 6400 Tests: 2 Failed: 0) -------------- next part -------------- An HTML attachment was scrubbed... URL: From yanick at babyl.dyndns.org Thu Jul 4 15:35:25 2013 From: yanick at babyl.dyndns.org (Yanick Champoux) Date: Thu, 4 Jul 2013 10:35:25 -0400 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN In-Reply-To: References: <51D56241.6040400@babyl.dyndns.org> Message-ID: <20130704143525.GA11138@gilgamesh.babyl.dyndns.org> On Thu, Jul 04, 2013 at 02:28:44PM +0100, Pedro Melo wrote: > I've been a bit out of touch, I'm using Dancer2 in production but I was > wondering what is the current status of development. Sukria will likely be able to answer more comprehensively, but I think the short of it is: Dancer2 is production-ready, but has a few kinks (and lots of documentation) yet to be ironed out (which is where...). > Where do you need help on Dancer2? (..this comes in :-) ). Again, I don't think with any official voice, but I'd say we need help for: (a) documentation and (b) Pull Request triage and writing patches. When we get down to it, what we are truly lacking is tuits - and since things have hit a point where they are functional, that's a reason why things got a little sluggish lately. Personally, for the last few months I consciously decided to focus entierely on Dancer 1, as most of the other peeps were focusing on Dancer2 and, well, my tuits bank is also permanently in the red. But now that the bug queue of D1 is shrinking to a decent size, I might begin to jump back and forth between the Dancers. :-) Joy, `/anick -- From yanick at babyl.dyndns.org Thu Jul 4 15:39:40 2013 From: yanick at babyl.dyndns.org (Yanick Champoux) Date: Thu, 4 Jul 2013 10:39:40 -0400 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN In-Reply-To: References: <51D56241.6040400@babyl.dyndns.org> Message-ID: <20130704143940.GA11275@gilgamesh.babyl.dyndns.org> On Thu, Jul 04, 2013 at 02:08:44PM +0200, Alexis Sukrieh wrote: > Great! Kudos! It must be said, all kudos go to Jakob, David and Craig. I'm only the dude that put the strawberry on the cake before rolling it out of the kitchen. ... and maybe steal a slice of it while no-one is looking. ;-) Joy, `/anick > > > 2013/7/4 Yanick Champoux > > > Hi all, > > > > Just to say that a new, minor release of Dancer is on its way to > > CPAN. Here's the changelog: > > > > [ ENHANCEMENTS ] > > > > * GH #767: forwarded_for_address() now looks for HTTP_X_FORWARDED_FOR > > if X_FORWARDED_FOR is not there. (Jakob Voss) > > > > * GH #936: Add file locking to file logger. (David Golden) > > > > * GH #937: Add details to tutorial. (Craig Treptow) > > > > > > Joy, > > `/anick > > ______________________________**_________________ > > dancer-users mailing list > > dancer-users at dancer.pm > > http://lists.preshweb.co.uk/**mailman/listinfo/dancer-users > > > > > > > -- > Alexis Sukrieh > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users -- From kaiwang.chen at gmail.com Thu Jul 4 16:11:42 2013 From: kaiwang.chen at gmail.com (Kaiwang Chen) Date: Thu, 4 Jul 2013 23:11:42 +0800 Subject: [dancer-users] Just another dancer In-Reply-To: <51D4D1D0.1030009@nsbeta.info> References: <51D4D1D0.1030009@nsbeta.info> Message-ID: <1621BA57-8704-46B2-A6EC-0A26CC0C84D2@gmail.com> Hey, I heard of this site which introduces many web games. Glad to know it's dancing now. Would you please share your deployment? Thanks, kc ? 2013-7-4?9:37?Feng He ??? > We game.yy.com have been using dancer to provide the RESTful API for our DNS service. It is simple enough to write the API methods along with the great Perl modules on CPAN, special to the DNS related modules like Net::DNS, Data::Validate::Domain etc. Once the API was running with CGI under Apache, but I swithed them to dancer within just one day. > Thanks for the great project. > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users From fenghe at nsbeta.info Fri Jul 5 01:58:50 2013 From: fenghe at nsbeta.info (Feng He) Date: Fri, 05 Jul 2013 08:58:50 +0800 Subject: [dancer-users] Just another dancer In-Reply-To: <51D51529.3040106@nsbeta.info> References: <51D4D1D0.1030009@nsbeta.info> <51D51529.3040106@nsbeta.info> Message-ID: <51D61A4A.1040009@nsbeta.info> Have another question that, how to make dancer listen on localhost only? Coz I have a nginx as the front proxy before it. Thanks. ? 2013-7-4 14:24, Feng He ??: > I didn't get an english introduction to the company. > But you may find the info here: > http://www.nasdaq.com/symbol/yy > > Cheers. > > > ? 2013-7-4 13:58, sawyer x ??: >> If you could write a few words on what the site is about (I realize >> "games" are a major part of it :) - we could add it to the dancefloor. :) From xdg at xdg.me Fri Jul 5 03:11:47 2013 From: xdg at xdg.me (David Golden) Date: Thu, 4 Jul 2013 22:11:47 -0400 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN In-Reply-To: <20130704143940.GA11275@gilgamesh.babyl.dyndns.org> References: <51D56241.6040400@babyl.dyndns.org> <20130704143940.GA11275@gilgamesh.babyl.dyndns.org> Message-ID: On Thu, Jul 4, 2013 at 10:39 AM, Yanick Champoux wrote: > It must be said, all kudos go to Jakob, David and Craig. I'm only > the dude that put the strawberry on the cake before rolling it > out of the kitchen. ... and maybe steal a slice of it while no-one > is looking. ;-) Well, it's still nice to have regular releases compared to Dancer2. David -- David Golden Take back your inbox! ? http://www.bunchmail.com/ Twitter/IRC: @xdg From xdg at xdg.me Fri Jul 5 04:22:53 2013 From: xdg at xdg.me (David Golden) Date: Thu, 4 Jul 2013 23:22:53 -0400 Subject: [dancer-users] unable to install Dancer::Session::Cookie In-Reply-To: <51D5844C.4040705@gmail.com> References: <51D5844C.4040705@gmail.com> Message-ID: On Thu, Jul 4, 2013 at 10:18 AM, Hugues Max wrote: > if I see end of /root/.cpanm/build.log, there a error with autoflush method > from FileHandle I suspect Dancer should be explicitly creating IO::File objects rather than relying on open, which prior to v5.12 might create FileHandle objects or IO::Handle objects depending on what's loaded. That said, I don't see what in that Dancer::Session::Cookie test would be setting a file logger to trigger that error in the first place. David -- David Golden Take back your inbox! ? http://www.bunchmail.com/ Twitter/IRC: @xdg From orasnita at gmail.com Fri Jul 5 06:39:09 2013 From: orasnita at gmail.com (Octavian Rasnita) Date: Fri, 5 Jul 2013 08:39:09 +0300 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN References: <51D56241.6040400@babyl.dyndns.org><20130704143940.GA11275@gilgamesh.babyl.dyndns.org> Message-ID: From: "David Golden" > On Thu, Jul 4, 2013 at 10:39 AM, Yanick Champoux > wrote: >> It must be said, all kudos go to Jakob, David and Craig. I'm only >> the dude that put the strawberry on the cake before rolling it >> out of the kitchen. ... and maybe steal a slice of it while no-one >> is looking. ;-) > > Well, it's still nice to have regular releases compared to Dancer2. > > David If it continues this way, someday we will need to upgrade from Dancer2 to Dancer1. :-) Octavian From sukria at gmail.com Fri Jul 5 08:23:11 2013 From: sukria at gmail.com (Alexis Sukrieh) Date: Fri, 5 Jul 2013 09:23:11 +0200 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN In-Reply-To: References: <51D56241.6040400@babyl.dyndns.org> <20130704143940.GA11275@gilgamesh.babyl.dyndns.org> Message-ID: Le 5 juil. 2013 04:12, "David Golden" a ?crit : > > On Thu, Jul 4, 2013 at 10:39 AM, Yanick Champoux > wrote: > > It must be said, all kudos go to Jakob, David and Craig. I'm only > > the dude that put the strawberry on the cake before rolling it > > out of the kitchen. ... and maybe steal a slice of it while no-one > > is looking. ;-) > > Well, it's still nice to have regular releases compared to Dancer2. Indeed. Releases are important, and I was very out of the game recently. A side project took me lot of time, but it's over now. And I'm going to be back and hopefully, D2 releases are going to go out soon as well. Thanks again Yanick for the D1 revival :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From huguesmax at gmail.com Fri Jul 5 08:34:43 2013 From: huguesmax at gmail.com (Hugues Max) Date: Fri, 05 Jul 2013 09:34:43 +0200 Subject: [dancer-users] Dancer v1.3116 on its way to CPAN In-Reply-To: References: <51D56241.6040400@babyl.dyndns.org> <20130704143940.GA11275@gilgamesh.babyl.dyndns.org> Message-ID: <51D67713.9090501@gmail.com> Hello Alexis and Yanick "Bravo" and thanks for you good job about Dancer(1&2) did you plan to write a roadmap ? to explain what will be the Dancer futur ? or I can read that somewhere ? bye Hugues Le 05/07/2013 09:23, Alexis Sukrieh a ?crit : > > > Le 5 juil. 2013 04:12, "David Golden" > > a ?crit : > > > > On Thu, Jul 4, 2013 at 10:39 AM, Yanick Champoux > > > wrote: > > > It must be said, all kudos go to Jakob, David and Craig. I'm only > > > the dude that put the strawberry on the cake before rolling it > > > out of the kitchen. ... and maybe steal a slice of it while no-one > > > is looking. ;-) > > > > Well, it's still nice to have regular releases compared to Dancer2. > > Indeed. Releases are important, and I was very out of the game > recently. A side project took me lot of time, but it's over now. And > I'm going to be back and hopefully, D2 releases are going to go out > soon as well. > > Thanks again Yanick for the D1 revival :) > > > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From xsawyerx at gmail.com Fri Jul 5 09:27:11 2013 From: xsawyerx at gmail.com (sawyer x) Date: Fri, 5 Jul 2013 10:27:11 +0200 Subject: [dancer-users] Just another dancer In-Reply-To: <51D61A4A.1040009@nsbeta.info> References: <51D4D1D0.1030009@nsbeta.info> <51D51529.3040106@nsbeta.info> <51D61A4A.1040009@nsbeta.info> Message-ID: How are you connecting Dancer to Nginx? On Fri, Jul 5, 2013 at 2:58 AM, Feng He wrote: > Have another question that, how to make dancer listen on localhost only? > Coz I have a nginx as the front proxy before it. > > Thanks. > > ? 2013-7-4 14:24, Feng He ??: > > I didn't get an english introduction to the company. >> But you may find the info here: >> http://www.nasdaq.com/symbol/**yy >> >> Cheers. >> >> >> ? 2013-7-4 13:58, sawyer x ??: >> >>> If you could write a few words on what the site is about (I realize >>> "games" are a major part of it :) - we could add it to the dancefloor. :) >>> >> > ______________________________**_________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/**mailman/listinfo/dancer-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fenghe at nsbeta.info Fri Jul 5 09:46:58 2013 From: fenghe at nsbeta.info (Feng He) Date: Fri, 05 Jul 2013 16:46:58 +0800 Subject: [dancer-users] Just another dancer In-Reply-To: References: <51D4D1D0.1030009@nsbeta.info> <51D51529.3040106@nsbeta.info> <51D61A4A.1040009@nsbeta.info> Message-ID: <51D68802.4080208@nsbeta.info> ? 2013-7-5 16:27, sawyer x ??: > How are you connecting Dancer to Nginx? for nginx the upstream server is 127.0.0.1:3000 it's by a tcp socket. From xsawyerx at gmail.com Fri Jul 5 10:20:10 2013 From: xsawyerx at gmail.com (sawyer x) Date: Fri, 5 Jul 2013 11:20:10 +0200 Subject: [dancer-users] Just another dancer In-Reply-To: <51D68802.4080208@nsbeta.info> References: <51D4D1D0.1030009@nsbeta.info> <51D51529.3040106@nsbeta.info> <51D61A4A.1040009@nsbeta.info> <51D68802.4080208@nsbeta.info> Message-ID: Are you using the default Dancer "built-in" web server? That should only be used for development. It's not performant at all. You should use something like Starman. On Fri, Jul 5, 2013 at 10:46 AM, Feng He wrote: > ? 2013-7-5 16:27, sawyer x ??: > > How are you connecting Dancer to Nginx? >> > > for nginx the upstream server is 127.0.0.1:3000 > it's by a tcp socket. > > ______________________________**_________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/**mailman/listinfo/dancer-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From melo at simplicidade.org Fri Jul 5 17:19:37 2013 From: melo at simplicidade.org (Pedro Melo) Date: Fri, 5 Jul 2013 17:19:37 +0100 Subject: [dancer-users] Set interface language via URL path Message-ID: Hi, I'm being asked to write a webapp for a site that will have three versions for, one for each language. The current idea is to use http://site.tld/en/, http://site.tld/de/ and http://site.tld/fr/. I'll need to think this over on how to do this with Dancer2, but I want to reuse as much as possible of the routes between the three sites. Does anybody did this before and can share a strategy? My current best solution for this would be to had a hook as soon as possible and remove the first level path if it matches one of the languages we support and set a var for it. Any other suggestions? Bye, -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo at simplicidade.org mailto:melo at simplicidade.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From yanick at babyl.dyndns.org Fri Jul 5 17:39:08 2013 From: yanick at babyl.dyndns.org (Yanick Champoux) Date: Fri, 5 Jul 2013 12:39:08 -0400 Subject: [dancer-users] Set interface language via URL path In-Reply-To: References: Message-ID: <20130705163908.GA15724@gilgamesh.babyl.dyndns.org> On Fri, Jul 05, 2013 at 05:19:37PM +0100, Pedro Melo wrote: > Hi, > > I'm being asked to write a webapp for a site that will have three versions > for, one for each language. > > The current idea is to use http://site.tld/en/, http://site.tld/de/ and > http://site.tld/fr/. > > I'll need to think this over on how to do this with Dancer2, but I want to > reuse as much as possible of the routes between the three sites. > > Does anybody did this before and can share a strategy? My current best > solution for this would be to had a hook as soon as possible and remove the > first level path if it matches one of the languages we support and set a > var for it. > > Any other suggestions? In the same vein: use Dancer2; get '/*/**' => sub { var lang => (splat)[0]; pass; }; prefix '/*'; my %greeting = ( en => 'howdie', fr => 'bonjour', de => 'hallo', ); get '/welcome' => sub { return $greeting{ var 'lang' }; }; Another idea (and I'm just thinking out loud, so take all here with a grain of salt) could be to have a nginx or apache reverse proxy taking in the urls /de/*, /fr/*, /en/*, rewrite them as the prefix-less '*', and pass the language as an environment variable. In the same vein, you could have en.site.tld, fr.site.tld, etc. HTHAWB, (Hope That Helps A Wee Bit), `/anick -- From hvo.pm at xs4all.nl Fri Jul 5 17:54:24 2013 From: hvo.pm at xs4all.nl (Henk van Oers) Date: Fri, 5 Jul 2013 18:54:24 +0200 (CEST) Subject: [dancer-users] Set interface language via URL path In-Reply-To: References: Message-ID: On Fri, 5 Jul 2013, Pedro Melo wrote: > I'm being asked to write a webapp for a site that will have three versions for, one for each language. > > The current idea is to use http://site.tld/en/,?http://site.tld/de/ and http://site.tld/fr/. > > I'll need to think this over on how to do this with Dancer2, but I want to reuse as much as possible of the routes between the three sites. > > Does anybody did this before and can share a strategy? My current best solution for this would be to had a hook as soon as possible and remove the first level path if it matches one of the languages we > support and set a var for it. ? > > Any other suggestions? For static pages I use http://site.tld/name/of/document/ and than 'index' . $lang . 'html' For dynamic pages I use request->request_language() For loged-in users I use the language in there profile. There is no need for $lang in the route IMHO. How big will get ':lang' => sub { ... } be? -- Henk van Oers From xdg at xdg.me Fri Jul 5 18:51:19 2013 From: xdg at xdg.me (David Golden) Date: Fri, 5 Jul 2013 13:51:19 -0400 Subject: [dancer-users] Set interface language via URL path In-Reply-To: References: Message-ID: On Fri, Jul 5, 2013 at 12:19 PM, Pedro Melo wrote: > I'll need to think this over on how to do this with Dancer2, but I want to > reuse as much as possible of the routes between the three sites. That is sort of the crux of the question. Are the templates different? Or is the logic different? The various suggestions for getting language information out of the request path would be my inclination if I had to do this. David -- David Golden Take back your inbox! ? http://www.bunchmail.com/ Twitter/IRC: @xdg From xdg at xdg.me Fri Jul 5 18:51:19 2013 From: xdg at xdg.me (David Golden) Date: Fri, 5 Jul 2013 13:51:19 -0400 Subject: [dancer-users] Set interface language via URL path In-Reply-To: References: Message-ID: On Fri, Jul 5, 2013 at 12:19 PM, Pedro Melo wrote: > I'll need to think this over on how to do this with Dancer2, but I want to > reuse as much as possible of the routes between the three sites. That is sort of the crux of the question. Are the templates different? Or is the logic different? The various suggestions for getting language information out of the request path would be my inclination if I had to do this. David -- David Golden Take back your inbox! ? http://www.bunchmail.com/ Twitter/IRC: @xdg From cymon.ML at gmail.com Fri Jul 5 19:44:22 2013 From: cymon.ML at gmail.com (Cymon) Date: Fri, 5 Jul 2013 20:44:22 +0200 Subject: [dancer-users] Set interface language via URL path In-Reply-To: References: Message-ID: <20130705204422.256abfe7@chrome> > Hi, > > I'm being asked to write a webapp for a site that will have three > versions for, one for each language. > > The current idea is to use http://site.tld/en/, http://site.tld/de/ > and http://site.tld/fr/. > I'll need to think this over on how to do this with Dancer2, but I > want to reuse as much as possible of the routes between the three > sites. Hi, i know that this could sound like a bizarre coincidence, but i released just this evening on github a little plugin to manage multilanguage sites: https://github.com/cym0n/Dancer2-Plugin-Multilang I want to use it on a site I'm working on, but it's still under testing so feel free to use it as you wish. I'd be glad to receive any feedback about it so to improve it as much as possibile. I want also to put it on CPAN, but for now I think i'll take some time to try it a bit.. -- Cymon Coniglio domina, http://www.therabbit.it From naveedm9 at gmail.com Fri Jul 5 19:48:59 2013 From: naveedm9 at gmail.com (Naveed Massjouni) Date: Fri, 5 Jul 2013 14:48:59 -0400 Subject: [dancer-users] unable to install Dancer::Session::Cookie In-Reply-To: References: <51D5844C.4040705@gmail.com> Message-ID: On Thu, Jul 4, 2013 at 11:22 PM, David Golden wrote: > On Thu, Jul 4, 2013 at 10:18 AM, Hugues Max wrote: >> if I see end of /root/.cpanm/build.log, there a error with autoflush method >> from FileHandle > > I suspect Dancer should be explicitly creating IO::File objects rather > than relying on open, which prior to v5.12 might create FileHandle > objects or IO::Handle objects depending on what's loaded. Can you explain what you mean when you say open creates objects? I am running 5.14 and when I run: perl -E 'open $x, "foo"; say ref $x' It prints "GLOB". -Naveed > > That said, I don't see what in that Dancer::Session::Cookie test would > be setting a file logger to trigger that error in the first place. > > David > > > > -- > David Golden > Take back your inbox! ? http://www.bunchmail.com/ > Twitter/IRC: @xdg > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users From xdg at xdg.me Fri Jul 5 21:37:07 2013 From: xdg at xdg.me (David Golden) Date: Fri, 5 Jul 2013 16:37:07 -0400 Subject: [dancer-users] unable to install Dancer::Session::Cookie In-Reply-To: References: <51D5844C.4040705@gmail.com> Message-ID: On Fri, Jul 5, 2013 at 2:48 PM, Naveed Massjouni wrote: > Can you explain what you mean when you say open creates objects? I am > running 5.14 and when I run: > > perl -E 'open $x, "foo"; say ref $x' > > It prints "GLOB". The IO slot of the GLOB holds an IO::File object: $ perl -wE 'open my $fh, ">", "foo.txt"; say ref( *{$fh}{IO} )' IO::File At least as of Perl v5.12, anyway -- before that the IO slot could be a FileHandle or an IO::Handle, IIRC. However, even now Perl doesn't actually load IO::File, it merely blesses. In Perl v5.14, I added a feature to automatically load IO::File on demand if you try to call a method on a file handle. Previously, it just died. David -- David Golden Take back your inbox! ? http://www.bunchmail.com/ Twitter/IRC: @xdg From kvmsanand at gmail.com Sun Jul 7 00:28:48 2013 From: kvmsanand at gmail.com (Anand Meher) Date: Sun, 7 Jul 2013 01:28:48 +0200 Subject: [dancer-users] ajax plugin, serialize a 1D perl array to JSON Message-ID: Dear dancer experts, I have a 1D Perl array which I would like to encode using JSON and send it as a response to an ajax request. I have implemented the following steps so far in my dancer app: *use Dancer::Plugin::Ajax;* *set serializer => 'JSON';* * * *ajax '/getarray' => sub {* * * * my @sendArray;* * ........... * * {* * @sendArray; # this is the array I intend to send to the client Java Script* * }* * * *};* The sendArray is not a (key, value) pair based structure, but a simple 1D array. Can anyone let me know if * "@sendArray"* statement at the end of ajax routine above will correctly encode to JSON? Also is there any way to print (to console) the final encoded JSON object from the ajax routine at the server end? thanks in advance \amk -------------- next part -------------- An HTML attachment was scrubbed... URL: From rik at rikbrown.co.uk Sun Jul 7 01:59:21 2013 From: rik at rikbrown.co.uk (Rik Brown) Date: Sat, 6 Jul 2013 17:59:21 -0700 Subject: [dancer-users] ajax plugin, serialize a 1D perl array to JSON In-Reply-To: References: Message-ID: <146B2B2547C543298E0614A7EDA7B523@rikbrown.co.uk> { @sendArray } won't do what you want because you're putting the array inside a hash reference. You either want to put it inside an array ref, or reference it, e.g. [ @sendArray ] or just \@sendArray. Of course you could also do: { results => \@sendArray } if you want your output to be a hash at the top level. Hope this helps! -- Rik Brown http://www.rikbrown.co.uk/ On Saturday, 6 July 2013 at 16:28, Anand Meher wrote: > Dear dancer experts, > I have a 1D Perl array which I would like to encode using JSON and send it as a response to an ajax request. > > I have implemented the following steps so far in my dancer app: > > use Dancer::Plugin::Ajax; > set serializer => 'JSON'; > > ajax '/getarray' => sub { > > my @sendArray; > ........... > { > @sendArray; # this is the array I intend to send to the client Java Script > } > > }; > > > The sendArray is not a (key, value) pair based structure, but a simple 1D array. > Can anyone let me know if "@sendArray" statement at the end of ajax routine above will correctly encode to JSON? > > Also is there any way to print (to console) the final encoded JSON object from the ajax routine at the server end? > > thanks in advance > \amk > > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm (mailto:dancer-users at dancer.pm) > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidp at preshweb.co.uk Sun Jul 7 11:38:29 2013 From: davidp at preshweb.co.uk (David Precious) Date: Sun, 7 Jul 2013 11:38:29 +0100 Subject: [dancer-users] ajax plugin, serialize a 1D perl array to JSON In-Reply-To: <146B2B2547C543298E0614A7EDA7B523@rikbrown.co.uk> References: <146B2B2547C543298E0614A7EDA7B523@rikbrown.co.uk> Message-ID: <20130707113829.09f14e6c@columbia> On Sat, 6 Jul 2013 17:59:21 -0700 Rik Brown wrote: > Of course you could also do: > > { > results => \@sendArray > } > > if you want your output to be a hash at the top level. > > Hope this helps! Rik's answer above is the course of action I'd typically recommend - because even if you just want the array for now, in future you may well decide you want to provide other information from that call, too (perhaps be able to return an error message as a key named 'error', or return the number of results found as a key named 'count', or return the average of all the values... etc) - so returning a hashref as Rik illustrates helps with future-proofing, as you could easily add more information to the response without breaking existing code. -- David Precious ("bigpresh") http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github From kvmsanand at gmail.com Sun Jul 7 18:06:55 2013 From: kvmsanand at gmail.com (Anand Meher) Date: Sun, 7 Jul 2013 19:06:55 +0200 Subject: [dancer-users] ajax plugin, serialize a 1D perl array to JSON In-Reply-To: <20130707113829.09f14e6c@columbia> References: <146B2B2547C543298E0614A7EDA7B523@rikbrown.co.uk> <20130707113829.09f14e6c@columbia> Message-ID: Thank you David and Rik for your answers, I have one more question, I tried executing some perl code from a ajax routine : something like : *sub get_stats {* *# some perl code goes here * * ## open a file using perl file open* * ## use dancer logger to output to console* * ## execute shell commands using system call of perl* *}* * * *ajax '/killprocess' => sub {* * get_stats;* * * *};* * * But it seems that the perl code is not getting executed, I do not have anything shown in my logger (console), am I doing something wrong over here ? Thank You \amk On Sun, Jul 7, 2013 at 12:38 PM, David Precious wrote: > On Sat, 6 Jul 2013 17:59:21 -0700 > Rik Brown wrote: > > > Of course you could also do: > > > > { > > results => \@sendArray > > } > > > > if you want your output to be a hash at the top level. > > > > Hope this helps! > > Rik's answer above is the course of action I'd typically recommend > - because even if you just want the array for now, in future you may > well decide you want to provide other information from that call, too > (perhaps be able to return an error message as a key named 'error', or > return the number of results found as a key named 'count', or return > the average of all the values... etc) - so returning a hashref as Rik > illustrates helps with future-proofing, as you could easily add more > information to the response without breaking existing code. > > > > -- > David Precious ("bigpresh") > http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter > www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook > www.preshweb.co.uk/cpan www.preshweb.co.uk/github > > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rik at rikbrown.co.uk Sun Jul 7 18:12:34 2013 From: rik at rikbrown.co.uk (Rik Brown) Date: Sun, 7 Jul 2013 18:12:34 +0100 Subject: [dancer-users] ajax plugin, serialize a 1D perl array to JSON In-Reply-To: References: <146B2B2547C543298E0614A7EDA7B523@rikbrown.co.uk> <20130707113829.09f14e6c@columbia> Message-ID: The Ajax plugin only fires if your X-Requested-With header equals XMLHttpRequest - which will happen if you're using JS to do an Ajax request. If you just need to test this I'd suggest a browser extension like Postman which can be configured to send arbitrary HTTP headers. If you in fact just want a generic endpoint that works regardless of headers, just use a normal 'get' route and set 'serializer' in your config to be JSON. Away from my computer so can't dig up the docs, but it's all discussed in the Dancer manuals. Cheers Sent from my phone. On 7 Jul 2013 10:07, "Anand Meher" wrote: > Thank you David and Rik for your answers, > I have one > more question, I tried executing some perl code from a ajax routine : > something like : > > *sub get_stats {* > *# some perl code goes here * > * ## open a file using perl file open* > * ## use dancer logger to output to console* > * ## execute shell commands using system call of perl* > *}* > * > * > *ajax '/killprocess' => sub {* > * get_stats;* > * > * > *};* > * > * > But it seems that the perl code is not getting executed, I do not have > anything shown in my logger (console), > am I doing something wrong over here ? > > Thank You > \amk > > > On Sun, Jul 7, 2013 at 12:38 PM, David Precious wrote: > >> On Sat, 6 Jul 2013 17:59:21 -0700 >> Rik Brown wrote: >> >> > Of course you could also do: >> > >> > { >> > results => \@sendArray >> > } >> > >> > if you want your output to be a hash at the top level. >> > >> > Hope this helps! >> >> Rik's answer above is the course of action I'd typically recommend >> - because even if you just want the array for now, in future you may >> well decide you want to provide other information from that call, too >> (perhaps be able to return an error message as a key named 'error', or >> return the number of results found as a key named 'count', or return >> the average of all the values... etc) - so returning a hashref as Rik >> illustrates helps with future-proofing, as you could easily add more >> information to the response without breaking existing code. >> >> >> >> -- >> David Precious ("bigpresh") >> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter >> www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook >> www.preshweb.co.uk/cpan www.preshweb.co.uk/github >> >> >> _______________________________________________ >> dancer-users mailing list >> dancer-users at dancer.pm >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> > > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fenghe at nsbeta.info Mon Jul 8 02:59:55 2013 From: fenghe at nsbeta.info (Feng He) Date: Mon, 08 Jul 2013 09:59:55 +0800 Subject: [dancer-users] Just another dancer In-Reply-To: References: <51D4D1D0.1030009@nsbeta.info> <51D51529.3040106@nsbeta.info> <51D61A4A.1040009@nsbeta.info> <51D68802.4080208@nsbeta.info> Message-ID: <51DA1D1B.6010802@nsbeta.info> On 2013-7-5 17:20, sawyer x wrote: > Are you using the default Dancer "built-in" web server? > That should only be used for development. It's not performant at all. > > You should use something like Starman. Thanks. I have switched to Starman for webserver. $ plackup -E deployment -s Starman --workers=10 -l 127.0.0.1:3000 -D -a bin/app.pl It looks work fine. From melo at simplicidade.org Mon Jul 8 12:39:23 2013 From: melo at simplicidade.org (Pedro Melo) Date: Mon, 8 Jul 2013 12:39:23 +0100 Subject: [dancer-users] Set interface language via URL path In-Reply-To: <20130705163908.GA15724@gilgamesh.babyl.dyndns.org> References: <20130705163908.GA15724@gilgamesh.babyl.dyndns.org> Message-ID: Hi, On Fri, Jul 5, 2013 at 5:39 PM, Yanick Champoux wrote: > On Fri, Jul 05, 2013 at 05:19:37PM +0100, Pedro Melo wrote: > > Hi, > > > > I'm being asked to write a webapp for a site that will have three > versions > > for, one for each language. > > > > The current idea is to use http://site.tld/en/, http://site.tld/de/ and > > http://site.tld/fr/. > > > > I'll need to think this over on how to do this with Dancer2, but I want > to > > reuse as much as possible of the routes between the three sites. > > > > Does anybody did this before and can share a strategy? My current best > > solution for this would be to had a hook as soon as possible and remove > the > > first level path if it matches one of the languages we support and set a > > var for it. > > > > Any other suggestions? > > In the same vein: > > use Dancer2; > > > get '/*/**' => sub { > var lang => (splat)[0]; > pass; > }; > > prefix '/*'; > > my %greeting = ( > en => 'howdie', > fr => 'bonjour', > de => 'hallo', > ); > > get '/welcome' => sub { > return $greeting{ var 'lang' }; > }; > > Yeah, this is similar to what I was playing with... > Another idea (and I'm just thinking out loud, so take all > here with a grain of salt) could be to have a nginx or apache > reverse proxy taking in the urls /de/*, /fr/*, /en/*, rewrite > them as the prefix-less '*', and pass the language as an > environment variable. > Also though of that, and I might be going this route. The big disadvantage is that url_for doesn't work properly anymore. In the same vein, you could have en.site.tld, fr.site.tld, etc. > This the client doesn't want. I tried. Thanks, -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo at simplicidade.org mailto:melo at simplicidade.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From melo at simplicidade.org Mon Jul 8 13:34:38 2013 From: melo at simplicidade.org (Pedro Melo) Date: Mon, 8 Jul 2013 13:34:38 +0100 Subject: [dancer-users] Set interface language via URL path In-Reply-To: References: Message-ID: Hi, On Fri, Jul 5, 2013 at 5:54 PM, Henk van Oers wrote: > On Fri, 5 Jul 2013, Pedro Melo wrote: > > I'm being asked to write a webapp for a site that will have three >> versions for, one for each language. >> >> The current idea is to use http://site.tld/en/, http://**site.tld/de/and >> http://site.tld/fr/. >> >> I'll need to think this over on how to do this with Dancer2, but I want >> to reuse as much as possible of the routes between the three sites. >> >> Does anybody did this before and can share a strategy? My current best >> solution for this would be to had a hook as soon as possible and remove the >> first level path if it matches one of the languages we >> support and set a var for it. >> >> Any other suggestions? >> > > For static pages I use http://site.tld/name/of/**document/ > and than 'index' . $lang . 'html' > > For dynamic pages I use request->request_language() > > For loged-in users I use the language in there profile. > > There is no need for $lang in the route IMHO. > /LANG/ prefix should not be needed if you can trust language negotiation, sure. But I'm tired of fighting proxys that cache pages ignoring those headers to go this route. How big will get ':lang' => sub { ... } be? I don't understand this. I don't have a route like that. Bye, -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo at simplicidade.org mailto:melo at simplicidade.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From melo at simplicidade.org Mon Jul 8 13:35:33 2013 From: melo at simplicidade.org (Pedro Melo) Date: Mon, 8 Jul 2013 13:35:33 +0100 Subject: [dancer-users] Set interface language via URL path In-Reply-To: References: Message-ID: Hi, On Fri, Jul 5, 2013 at 6:51 PM, David Golden wrote: > On Fri, Jul 5, 2013 at 12:19 PM, Pedro Melo wrote: > > I'll need to think this over on how to do this with Dancer2, but I want > to > > reuse as much as possible of the routes between the three sites. > > That is sort of the crux of the question. Are the templates > different? Or is the logic different? > Only the templates are different, the logic is the same. The various suggestions for getting language information out of the > request path would be my inclination if I had to do this. > Yeah, getting to that conclusion myself... Thanks, -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo at simplicidade.org mailto:melo at simplicidade.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From melo at simplicidade.org Mon Jul 8 13:35:33 2013 From: melo at simplicidade.org (Pedro Melo) Date: Mon, 8 Jul 2013 13:35:33 +0100 Subject: [dancer-users] Set interface language via URL path In-Reply-To: References: Message-ID: Hi, On Fri, Jul 5, 2013 at 6:51 PM, David Golden wrote: > On Fri, Jul 5, 2013 at 12:19 PM, Pedro Melo wrote: > > I'll need to think this over on how to do this with Dancer2, but I want > to > > reuse as much as possible of the routes between the three sites. > > That is sort of the crux of the question. Are the templates > different? Or is the logic different? > Only the templates are different, the logic is the same. The various suggestions for getting language information out of the > request path would be my inclination if I had to do this. > Yeah, getting to that conclusion myself... Thanks, -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo at simplicidade.org mailto:melo at simplicidade.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From melo at simplicidade.org Mon Jul 8 13:36:26 2013 From: melo at simplicidade.org (Pedro Melo) Date: Mon, 8 Jul 2013 13:36:26 +0100 Subject: [dancer-users] Set interface language via URL path In-Reply-To: <20130705204422.256abfe7@chrome> References: <20130705204422.256abfe7@chrome> Message-ID: Hi, On Fri, Jul 5, 2013 at 7:44 PM, Cymon wrote: > > I'm being asked to write a webapp for a site that will have three > > versions for, one for each language. > > > > The current idea is to use http://site.tld/en/, http://site.tld/de/ > > and http://site.tld/fr/. > > > I'll need to think this over on how to do this with Dancer2, but I > > want to reuse as much as possible of the routes between the three > > sites. > > Hi, > i know that this could sound like a bizarre coincidence, but i released > just this evening on github a little plugin to manage multilanguage > sites: > > https://github.com/cym0n/Dancer2-Plugin-Multilang > > I want to use it on a site I'm working on, but it's still under testing > so feel free to use it as you wish. I'd be glad to receive any feedback > about it so to improve it as much as possibile. > hmms.. The code looks sane. I'll give it a try, it seems to be exactly what I'm looking for. Thanks, -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:melo at simplicidade.org mailto:melo at simplicidade.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From gabor at szabgab.com Wed Jul 10 09:05:51 2013 From: gabor at szabgab.com (Gabor Szabo) Date: Wed, 10 Jul 2013 11:05:51 +0300 Subject: [dancer-users] =?utf-8?q?BreakDancer_=E2=80=93_a_framework_for_st?= =?utf-8?q?atic_webpages!?= Message-ID: Hi, I just saw this announcement: http://filip.sergot.pl/english/programming/perl-6/breakdancer-a-framework-for-static-webpages/ What do you think about it? Gabor From fenghe at nsbeta.info Wed Jul 10 09:11:54 2013 From: fenghe at nsbeta.info (Feng He) Date: Wed, 10 Jul 2013 16:11:54 +0800 Subject: [dancer-users] =?windows-1252?q?BreakDancer_=96_a_framework_for_s?= =?windows-1252?q?tatic_webpages!?= In-Reply-To: References: Message-ID: <51DD174A.3000305@nsbeta.info> On 2013-7-10 16:05, Gabor Szabo wrote: > I just saw this announcement: > > http://filip.sergot.pl/english/programming/perl-6/breakdancer-a-framework-for-static-webpages/ > > What do you think about it? I am not sure, but will a staic webpage need a framework? maybe a CMS is better? From xsawyerx at gmail.com Wed Jul 10 09:17:42 2013 From: xsawyerx at gmail.com (sawyer x) Date: Wed, 10 Jul 2013 10:17:42 +0200 Subject: [dancer-users] =?windows-1252?q?BreakDancer_=96_a_framework_for_s?= =?windows-1252?q?tatic_webpages!?= In-Reply-To: References: Message-ID: On Wed, Jul 10, 2013 at 10:05 AM, Gabor Szabo wrote: > > > http://filip.sergot.pl/english/programming/perl-6/breakdancer-a-framework-for-static-webpages/ > > What do you think about it? > I usually don't go for static web content, but it seems to work for some. I like how short and simple the implementation code is. Naming-wise, it's a nice homage. :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From rao.chenlin at gmail.com Wed Jul 10 12:58:15 2013 From: rao.chenlin at gmail.com (chenlin rao) Date: Wed, 10 Jul 2013 19:58:15 +0800 Subject: [dancer-users] dancer-users Digest, Vol 41, Issue 12 In-Reply-To: References: Message-ID: I like jekyll and use it to generate my blog. However the so short code of BreakDancer seems interesting. Anyway, why it name *dancer ^=^ 2013/7/10 > Send dancer-users mailing list submissions to > dancer-users at dancer.pm > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > or, via email, send a message with subject or body 'help' to > dancer-users-request at dancer.pm > > You can reach the person managing the list at > dancer-users-owner at dancer.pm > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of dancer-users digest..." > > > Today's Topics: > > 1. BreakDancer ? a framework for static webpages! (Gabor Szabo) > 2. Re: BreakDancer ? a framework for static webpages! (Feng He) > 3. Re: BreakDancer ? a framework for static webpages! (sawyer x) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 10 Jul 2013 11:05:51 +0300 > From: Gabor Szabo > Subject: [dancer-users] BreakDancer ? a framework for static webpages! > To: dancer-users > Message-ID: > < > CABe4FJBp9jpUPCYdpEmi1gS0tpjSEQniVTEj7kxJ+bjPLsaRNA at mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > Hi, > > I just saw this announcement: > > > http://filip.sergot.pl/english/programming/perl-6/breakdancer-a-framework-for-static-webpages/ > > What do you think about it? > > Gabor > > > ------------------------------ > > Message: 2 > Date: Wed, 10 Jul 2013 16:11:54 +0800 > From: Feng He > Subject: Re: [dancer-users] BreakDancer ? a framework for static > webpages! > To: Perl Dancer users mailing list > Message-ID: <51DD174A.3000305 at nsbeta.info> > Content-Type: text/plain; charset=windows-1252; format=flowed > > On 2013-7-10 16:05, Gabor Szabo wrote: > > I just saw this announcement: > > > > > http://filip.sergot.pl/english/programming/perl-6/breakdancer-a-framework-for-static-webpages/ > > > > What do you think about it? > > I am not sure, but will a staic webpage need a framework? maybe a CMS is > better? > > > ------------------------------ > > Message: 3 > Date: Wed, 10 Jul 2013 10:17:42 +0200 > From: sawyer x > Subject: Re: [dancer-users] BreakDancer ? a framework for static > webpages! > To: Perl Dancer users mailing list > Message-ID: > < > CAMvkq_Ry7AecLUpka4RghGxP9JPqDR7YE_ViGeBMwFfyZPm6Zw at mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > On Wed, Jul 10, 2013 at 10:05 AM, Gabor Szabo wrote: > > > > > > > > http://filip.sergot.pl/english/programming/perl-6/breakdancer-a-framework-for-static-webpages/ > > > > What do you think about it? > > > > I usually don't go for static web content, but it seems to work for some. > I like how short and simple the implementation code is. > Naming-wise, it's a nice homage. :) > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20130710/4f08838c/attachment.html > > > > ------------------------------ > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > > End of dancer-users Digest, Vol 41, Issue 12 > ******************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gabor at szabgab.com Wed Jul 10 13:12:48 2013 From: gabor at szabgab.com (Gabor Szabo) Date: Wed, 10 Jul 2013 15:12:48 +0300 Subject: [dancer-users] =?utf-8?q?BreakDancer_=E2=80=93_a_framework_for_st?= =?utf-8?q?atic_webpages!?= In-Reply-To: References: Message-ID: BTW in a recent episode of to the FOSS Weekly: http://twit.tv/show/floss-weekly/254 the Maker CMS was mentioned. It is basically a static site generator like Jekyll and like this BreakDance, but it has a desktop GUI and it is written in Python http://makercms.org/ Gabor From kvmsanand at gmail.com Sat Jul 13 22:15:28 2013 From: kvmsanand at gmail.com (Anand Meher) Date: Sat, 13 Jul 2013 23:15:28 +0200 Subject: [dancer-users] Deploying perl dancer app using Plackup and Starman Message-ID: Dear Dancer Experts, I am trying to deploy my first dancer app using Plackup and Starman. I am using the following commandline as suggested in the perl dancer deployment documentation. "*plackup -E production -s Starman --workers=10 -p 80 -a bin/app.pl*" This command seems to be working only on the same machine (only on localhost), but when I try to access from an another machine, it does not seem to work. I also tried with different ports. The same command without enabling Starman server works, i.e. the command "*plackup -E production -p 80 -a bin/app.pl*" works perfectly. Could you please let me know, if I am missing something when I enable Starman? I am using cygwin on windows machine to deploy the app. Thanks In Advance Regards AMK -------------- next part -------------- An HTML attachment was scrubbed... URL: From akalgan at gmail.com Tue Jul 23 13:59:12 2013 From: akalgan at gmail.com (Alexey Kolganov) Date: Tue, 23 Jul 2013 16:59:12 +0400 Subject: [dancer-users] Deploying perl dancer app using Plackup and Starman In-Reply-To: References: Message-ID: Use --listen option to set IP address: --listen :80 2013/7/14 Anand Meher > Dear Dancer Experts, > > I am trying to deploy my first dancer app using Plackup and > Starman. > > I am using the following commandline as suggested in the perl dancer > deployment documentation. > > "*plackup -E production -s Starman --workers=10 -p 80 -a bin/app.pl*" > > This command seems to be working only on the same machine (only on > localhost), but when I try to access from an another machine, it does not > seem to work. > I also tried with different ports. > > The same command without enabling Starman server works, i.e. the command " > *plackup -E production -p 80 -a bin/app.pl*" works perfectly. > > Could you please let me know, if I am missing something when I enable > Starman? I am using cygwin on windows machine to deploy the app. > > Thanks In Advance > > Regards > AMK > > > > > > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kvmsanand at gmail.com Tue Jul 23 17:34:12 2013 From: kvmsanand at gmail.com (Anand Meher) Date: Tue, 23 Jul 2013 18:34:12 +0200 Subject: [dancer-users] Deploying perl dancer app using Plackup and Starman In-Reply-To: References: Message-ID: Thank you Alexey, It works.with the --listen option. On Tue, Jul 23, 2013 at 2:59 PM, Alexey Kolganov wrote: > Use --listen option to set IP address: > > --listen :80 > > > 2013/7/14 Anand Meher > >> Dear Dancer Experts, >> >> I am trying to deploy my first dancer app using Plackup and >> Starman. >> >> I am using the following commandline as suggested in the perl dancer >> deployment documentation. >> >> "*plackup -E production -s Starman --workers=10 -p 80 -a bin/app.pl*" >> >> This command seems to be working only on the same machine (only on >> localhost), but when I try to access from an another machine, it does not >> seem to work. >> I also tried with different ports. >> >> The same command without enabling Starman server works, i.e. the command " >> *plackup -E production -p 80 -a bin/app.pl*" works perfectly. >> >> Could you please let me know, if I am missing something when I enable >> Starman? I am using cygwin on windows machine to deploy the app. >> >> Thanks In Advance >> >> Regards >> AMK >> >> >> >> >> >> >> _______________________________________________ >> dancer-users mailing list >> dancer-users at dancer.pm >> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >> >> > > _______________________________________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave at dave.org.uk Wed Jul 24 10:45:45 2013 From: dave at dave.org.uk (Dave Cross) Date: Wed, 24 Jul 2013 09:45:45 +0000 Subject: [dancer-users] New Site: The Political Web Message-ID: <20130724094545.Horde.3VOxt10pLRyswQ7npEg1fA9@webmail.mag-sol.com> Hi, I thought people on the Dancer mailing list would be interested in this. Yesterday I blogged about a new web site I have created. It is, of course, developed using Dancer. It's a web site that tries to make it easier for people in the UK to get information about their MP's. It's called "The Political Web". The blog post: http://perlhacks.com/2013/07/just-build-something/ The web site: http://politicalweb.org.uk/ Cheers, Dave... From xsawyerx at gmail.com Wed Jul 24 10:47:32 2013 From: xsawyerx at gmail.com (sawyer x) Date: Wed, 24 Jul 2013 11:47:32 +0200 Subject: [dancer-users] New Site: The Political Web In-Reply-To: <20130724094545.Horde.3VOxt10pLRyswQ7npEg1fA9@webmail.mag-sol.com> References: <20130724094545.Horde.3VOxt10pLRyswQ7npEg1fA9@webmail.mag-sol.com> Message-ID: I actually saw your tweet about it. I was twice as happy that it was done and that you used Dancer for it. :) I think it should be added to the Dancefloor. On Wed, Jul 24, 2013 at 11:45 AM, Dave Cross wrote: > Hi, > > I thought people on the Dancer mailing list would be interested in this. > > Yesterday I blogged about a new web site I have created. It is, of course, > developed using Dancer. It's a web site that tries to make it easier for > people in the UK to get information about their MP's. It's called "The > Political Web". > > The blog post: http://perlhacks.com/2013/07/**just-build-something/ > The web site: http://politicalweb.org.uk/ > > Cheers, > > Dave... > > ______________________________**_________________ > dancer-users mailing list > dancer-users at dancer.pm > http://lists.preshweb.co.uk/**mailman/listinfo/dancer-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fpsom at issel.ee.auth.gr Tue Jul 30 17:27:03 2013 From: fpsom at issel.ee.auth.gr (Fotis E. Psomopoulos) Date: Tue, 30 Jul 2013 19:27:03 +0300 Subject: [dancer-users] Trouble in uploading file Message-ID: <51F7E957.7030608@issel.ee.auth.gr> Dear all, I am quite new to Dancer but I am really amazed on how few lines of code I have to write for the same functionality (still exploring though). However, I have hit the following issue: I am trying to upload a file using the following code: put '/upload/:file' => sub { my $upload_dir = "MyApp/UPLOADS"; my $filename = params->{file}; my $uploadedFile = request->upload($filename); debug "My Log 1: " . params->{file}; debug "My Log 2: " . ref($uploadedFile); open ( UPLOADFILE, "$upload_dir/$filename" ) or die "$!"; while ( ) { print UPLOADFILE; } close UPLOADFILE; return "DONE"; }; The PUT command is done via cURL as follows: curl --upload-file test http://localhost:3000/upload/test DONE The output that I see in the "development dance floor" is the following: [9072] core @0.000341> request: PUT /upload/test from 127.0.0.1 in /Perl/site/lib/Dancer/Handler.pm l. 56 [9072] core @0.002434> [hit #1]Trying to match 'PUT /upload/test' against /^\/upload\/([^\/]+)$/ (generated from '/upload/:file') in /Perl/site/lib/Dancer/Route.pm l. 84 [9072] core @0.004173> [hit #1] --> got 1 in /Perl/site/lib/Dancer/Route.pm l. 102 [9072] core @0.006625> [hit #1] --> named tokens are: file in /Perl/site/lib/Dancer/Route.pm l. 130 [9072] debug @0.009443> [hit #1]My Log 1: test in MyApp\lib/MyApp.pm l. 20 [9072] debug @0.010818> [hit #1]*My Log 2: in MyApp\lib/MyApp.pm l. 21* [9072] core @0.015854> [hit #1]response: 200 in /Perl/site/lib/Dancer/Handler.pm l. 179 The problem is that the file is created with the correct name in the correct folder (MyApp/UPLOADS/test) but it is always empty (0 size). No other warnings or errors, but I do see an issue in the output (marked in bold - 2nd custom debug line). Any ideas? Thank you in advance for your time! Regards, Fotis -- Fotis E. Psomopoulos PhD, Software Engineer Intelligent Systems and Software Engineering Lab Department of Electrical and Computer Engineering Aristotle University of Thessaloniki Thessaloniki 54124, Greece Phone: +30 2310 99 6349 Fax : +30 2310 99 6398 Email: fpsom at issel.ee.auth.gr Site : http://fotis.ee.auth.gr -------------- next part -------------- An HTML attachment was scrubbed... URL: From racke at linuxia.de Tue Jul 30 17:39:07 2013 From: racke at linuxia.de (Stefan Hornburg (Racke)) Date: Tue, 30 Jul 2013 18:39:07 +0200 Subject: [dancer-users] Trouble in uploading file In-Reply-To: <51F7E957.7030608@issel.ee.auth.gr> References: <51F7E957.7030608@issel.ee.auth.gr> Message-ID: <51F7EC2B.2040507@linuxia.de> On 07/30/2013 06:27 PM, Fotis E. Psomopoulos wrote: > Dear all, > > I am quite new to Dancer but I am really amazed on how few lines of code I have to write for the same functionality (still exploring though). > > However, I have hit the following issue: I am trying to upload a file using the following code: > > put '/upload/:file' => sub { > my $upload_dir = "MyApp/UPLOADS"; > my $filename = params->{file}; > my $uploadedFile = request->upload($filename); > > debug "My Log 1: " . params->{file}; > debug "My Log 2: " . ref($uploadedFile); > > open ( UPLOADFILE, "$upload_dir/$filename" ) or die "$!"; > > while ( ) > { > print UPLOADFILE; > } > > close UPLOADFILE; > > return "DONE"; > }; > > The PUT command is done via cURL as follows: > > curl --upload-file test http://localhost:3000/upload/test > DONE > > The output that I see in the "development dance floor" is the following: > > [9072] core @0.000341> request: PUT /upload/test from 127.0.0.1 in /Perl/site/lib/Dancer/Handler.pm l. 56 > [9072] core @0.002434> [hit #1]Trying to match 'PUT /upload/test' against /^\/upload\/([^\/]+)$/ (generated from '/upload/:file') in /Perl/site/lib/Dancer/Route.pm l. 84 > [9072] core @0.004173> [hit #1] --> got 1 in /Perl/site/lib/Dancer/Route.pm l. 102 > [9072] core @0.006625> [hit #1] --> named tokens are: file in /Perl/site/lib/Dancer/Route.pm l. 130 > [9072] debug @0.009443> [hit #1]My Log 1: test in MyApp\lib/MyApp.pm l. 20 > [9072] debug @0.010818> [hit #1]*My Log 2: in MyApp\lib/MyApp.pm l. 21* > [9072] core @0.015854> [hit #1]response: 200 in /Perl/site/lib/Dancer/Handler.pm l. 179 > > The problem is that the file is created with the correct name in the correct folder (MyApp/UPLOADS/test) but it is always empty (0 size). No other warnings or errors, but I do see an issue in the output (marked in bold - 2nd custom debug line). Any ideas? > Why don't you use the functions of the upload object to store the uploaded file? Also you open the file for reading, not for writing. Regards Racke -- LinuXia Systems => http://www.linuxia.de/ Expert Interchange Consulting and System Administration ICDEVGROUP => http://www.icdevgroup.org/ Interchange Development Team From fpsom at issel.ee.auth.gr Tue Jul 30 18:17:58 2013 From: fpsom at issel.ee.auth.gr (Fotis E. Psomopoulos) Date: Tue, 30 Jul 2013 20:17:58 +0300 Subject: [dancer-users] Trouble in uploading file In-Reply-To: <51F7EC2B.2040507@linuxia.de> References: <51F7EC2B.2040507@linuxia.de> Message-ID: <51F7F546.602@issel.ee.auth.gr> Dear Racke, thank you for your response. > On 07/30/2013 06:27 PM, Fotis E. Psomopoulos wrote: >>/ Dear all, />>/ />>/ I am quite new to Dancer but I am really amazed on how few lines of code I have to write for the same functionality (still exploring though). />>/ />>/ However, I have hit the following issue: I am trying to upload a file using the following code: />>/ />>/ put '/upload/:file' => sub { />>/ my $upload_dir = "MyApp/UPLOADS"; />>/ my $filename = params->{file}; />>/ my $uploadedFile = request->upload($filename); />>/ />>/ debug "My Log 1: " . params->{file}; />>/ debug "My Log 2: " . ref($uploadedFile); />>/ />>/ open ( UPLOADFILE, "$upload_dir/$filename" ) or die "$!"; />>/ />>/ while ( ) />>/ { />>/ print UPLOADFILE; />>/ } />>/ />>/ close UPLOADFILE; />>/ />>/ return "DONE"; />>/ }; />>/ />>/ The PUT command is done via cURL as follows: />>/ />>/ curl --upload-file testhttp://localhost:3000/upload/test />>/ DONE />>/ />>/ The output that I see in the "development dance floor" is the following: />>/ />>/ [9072] core @0.000341> request: PUT /upload/test from 127.0.0.1 in /Perl/site/lib/Dancer/Handler.pm l. 56 />>/ [9072] core @0.002434> [hit #1]Trying to match 'PUT /upload/test' against /^\/upload\/([^\/]+)$/ (generated from '/upload/:file') in /Perl/site/lib/Dancer/Route.pm l. 84 />>/ [9072] core @0.004173> [hit #1] --> got 1 in /Perl/site/lib/Dancer/Route.pm l. 102 />>/ [9072] core @0.006625> [hit #1] --> named tokens are: file in /Perl/site/lib/Dancer/Route.pm l. 130 />/> [9072] debug @0.009443> [hit #1]My Log 1: test in MyApp\lib/MyApp.pm l. 20 />/> [9072] debug @0.010818> [hit #1]*My Log 2: in MyApp\lib/MyApp.pm l. 21* />/> [9072] core @0.015854> [hit #1]response: 200 in /Perl/site/lib/Dancer/Handler.pm l. 179 />/> />/> The problem is that the file is created with the correct name in the correct folder (MyApp/UPLOADS/test) but it is always empty (0 size). No other warnings or errors, but I do see an issue in the output (marked in bold - 2nd custom debug line). Any ideas? />/> /> > Why don't you use the functions of the upload object to store the uploaded file? I have tried the following code: put '/upload/:file' => sub { my $upload_dir = "c:/Fotis/INA-CERTH/Microme/PathTrace/WebApp/PathTraceWS/UPLOADS"; my $filename = params->{file}; my $uploadedFile = request->upload($filename); $uploadedFile->copy_to('$upload_dir'); debug "My Log 1: " . params->{file}; debug "My Log 2: " . ref($uploadedFile); return "DONE"; }; However, the problem is probably the same as before: / //request to PUT /upload/test crashed: Can't call method "copy_to" on an undefined value/ What I really cannot understand is why the second debug line returns empty (...ref($uploadedFile)...). > Also you open the file for reading, not for writing. Well that's embarrassing... However, I corrected it and the problem remains (for some reason, it doesn't get the file). Thank you very much for your time! Regards, Fotis -------------- next part -------------- An HTML attachment was scrubbed... URL: From yanick at babyl.dyndns.org Wed Jul 31 23:46:15 2013 From: yanick at babyl.dyndns.org (Yanick Champoux) Date: Wed, 31 Jul 2013 18:46:15 -0400 Subject: [dancer-users] Dancer1 v1.3117 on its way to CPAN Message-ID: <51F993B7.6070701@babyl.dyndns.org> It's my great pleasure to announce that a new version of Dancer 1 is percolating to CPAN as we speak. The changelog is pasted below for your convenience. As usual, a huge "thank you" to all who contributed bug reports and patches, you all rock *big* time. :-) Enjoy! `/anick 1.3117 31.07.2013 [ ENHANCEMENTS ] * GH #836: Provide more information when an engine fails to load. (Yanick Champoux, reported by Daniel Perrett) [ BUG FIXES ] * GH #794: Upload data was not kept for forwarded requests. (reported by William Wolf) * GH #898: calling halt() doesn't discard set headers anymore. (Yanick Champoux, reported by Nicolas Franck) * GH #842: embedded 'prefix' now properly localized. (Yanick Champoux, reported by Jashank Jeremy) [ DOCUMENTATION ] * GH #938: fix doc typos in Dancer::Serializer. (Fabrice Gabolde) * GH #712: add all status codes known to Dancer to Dancer::HTTP. (Yanick Champoux, reported by Brian J Miller) * Add warning that 'forward' doesn't preserver the session. (Alberto Sim?es) * GH #941: minor correction to code snippets in documentation. (Grzegorz Ro?niecki) * GH #929: add warning on the use of Corona as underlying web server. (issue reported by berekuk) * GH #943: remove mention to 'Dancer::Plugin::Validation', clean 'dancer -a' sample output. (Grzegorz Ro?niecki) From perl at csjewell.fastmail.us Tue Jul 30 18:25:20 2013 From: perl at csjewell.fastmail.us (Curtis Jewell) Date: Tue, 30 Jul 2013 11:25:20 -0600 Subject: [dancer-users] Trouble in uploading file In-Reply-To: <51F7E957.7030608@issel.ee.auth.gr> References: <51F7E957.7030608@issel.ee.auth.gr> Message-ID: <1375205120.6460.3348027.561A10BC@webmail.messagingengine.com> On Tue, Jul 30, 2013, at 10:27, Fotis E. Psomopoulos wrote: > Dear all, > > I am quite new to Dancer but I am really amazed on how few lines of code > I have to write for the same functionality (still exploring though). > > However, I have hit the following issue: I am trying to upload a file > using the following code: > > put '/upload/:file' => sub { > my $upload_dir = "MyApp/UPLOADS"; > my $filename = params->{file}; > my $uploadedFile = request->upload($filename); Are you sure you don't mean my ($uploadedFile) = request->upload('file'); (because the uploads are keyed by the parameter name, not the filename - but I could be wrong, I'm not very familiar with Dancer, myself.) > debug "My Log 1: " . params->{file}; > debug "My Log 2: " . ref($uploadedFile); > > open ( UPLOADFILE, "$upload_dir/$filename" ) or die "$!"; > > while ( ) > { > print UPLOADFILE; > } > > close UPLOADFILE; > > return "DONE"; > }; > > The PUT command is done via cURL as follows: > > curl --upload-file test http://localhost:3000/upload/test > DONE > > The output that I see in the "development dance floor" is the following: > > [9072] core @0.000341> request: PUT /upload/test from 127.0.0.1 in > /Perl/site/lib/Dancer/Handler.pm l. 56 > [9072] core @0.002434> [hit #1]Trying to match 'PUT /upload/test' > against /^\/upload\/([^\/]+)$/ (generated from '/upload/:file') in > /Perl/site/lib/Dancer/Route.pm l. 84 > [9072] core @0.004173> [hit #1] --> got 1 in > /Perl/site/lib/Dancer/Route.pm l. 102 > [9072] core @0.006625> [hit #1] --> named tokens are: file in > /Perl/site/lib/Dancer/Route.pm l. 130 > [9072] debug @0.009443> [hit #1]My Log 1: test in MyApp\lib/MyApp.pm l. > 20 > [9072] debug @0.010818> [hit #1]*My Log 2: in MyApp\lib/MyApp.pm l. 21* > [9072] core @0.015854> [hit #1]response: 200 in > /Perl/site/lib/Dancer/Handler.pm l. 179 > > The problem is that the file is created with the correct name in the > correct folder (MyApp/UPLOADS/test) but it is always empty (0 size). No > other warnings or errors, but I do see an issue in the output (marked in > bold - 2nd custom debug line). Any ideas? > > Thank you in advance for your time! > > Regards, > > Fotis -- Curtis Jewell csjewell at cpan.org http://csjewell.dreamwidth.org/ perl at csjewell.fastmail.us http://csjewell.comyr.org/perl/ "Your random numbers are not that random" -- perl-5.10.1.tar.gz/util.c Strawberry Perl for Windows betas: http://strawberryperl.com/beta/