dancer

utf8 on in dancer but not script

倖福魔咒の 提交于 2019-12-11 14:28:55
问题 This is a follow up to my previous question on showing unicode string differences. As it turns out the strings appear to be the same, however in one of them the UTF8 flag is on. SV = PVMG(0x4cca750) at 0x4b3fc90 REFCNT = 1 FLAGS = (PADMY,POK,pPOK,UTF8) IV = 0 NV = 0 PV = 0x1eda410 "flurbe"\0 [UTF8 "flurbe"] CUR = 6 LEN = 16 vs SV = PV(0xf28090) at 0xf4b6a0 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) PV = 0xf37b90 "flurbe"\0 CUR = 6 LEN = 16 This appears to make a difference between the resulting

Multilingual PSGI-web deployment

天涯浪子 提交于 2019-12-09 11:17:32
问题 I plan develop one web application with PSGI/Plack. (probaly with Dancer, but not decided yet). The applicatiion should be utf8, multilingual (with Locale::Maketext) and (ofc) will contain some statical pages in the given language. My idea is deploy it in different language domains like en.example.com , de.example.com etc. The application itself is simple, mostly will only fill templates with localized texts and some other (light) functionality. What is the best solution to deploying one

How can I use Dancer2::Plugin::Database when my code is split into multiple files?

感情迁移 提交于 2019-12-08 00:59:41
问题 All code examples I have seen related to Dancer2 and database connections put all Dancer2 code directly in the anonymous subroutines attached to the various 'get' and 'put' requests. I would like to organize my code in a way that myServices.pm file is essentially just a router to the other code files that contain the meat of what is executing. I can successfully use the params keyword in the MyServices::Submission module. However, I can't seem to use the database keyword from Dancer2::Plugin:

A Simple Login/Authorization system using Dancer and Postgres

依然范特西╮ 提交于 2019-12-07 12:50:13
问题 As a newbie to Perl I'm struggling to find a simple way to do this. I've created a very simple table in my database: CREATE TABLE users ( id SERIAL NOT NULL PRIMARY KEY, username TEXT NOT NULL, password TEXT NOT NULL); So far I used a simple login system that has a hard coded username and password that I found online: package Example; use Dancer ':syntax'; our $VERSION = '0.1'; set session => "Simple"; get '/' => sub { # template 'index',{},{layout => 0}; template 'index'; }; before sub { if

How can I use Dancer2::Plugin::Database when my code is split into multiple files?

a 夏天 提交于 2019-12-06 07:22:49
All code examples I have seen related to Dancer2 and database connections put all Dancer2 code directly in the anonymous subroutines attached to the various 'get' and 'put' requests. I would like to organize my code in a way that myServices.pm file is essentially just a router to the other code files that contain the meat of what is executing. I can successfully use the params keyword in the MyServices::Submission module. However, I can't seem to use the database keyword from Dancer2::Plugin::Database in this context. myServices.pm: package myServices; use Dancer2; use Dancer2::Plugin::REST;

A Simple Login/Authorization system using Dancer and Postgres

…衆ロ難τιáo~ 提交于 2019-12-06 02:34:51
As a newbie to Perl I'm struggling to find a simple way to do this. I've created a very simple table in my database: CREATE TABLE users ( id SERIAL NOT NULL PRIMARY KEY, username TEXT NOT NULL, password TEXT NOT NULL); So far I used a simple login system that has a hard coded username and password that I found online: package Example; use Dancer ':syntax'; our $VERSION = '0.1'; set session => "Simple"; get '/' => sub { # template 'index',{},{layout => 0}; template 'index'; }; before sub { if (! session('user') && request->path_info !~ m{^/login}) { var requested_path => request->path_info;

What exactly triggers jQuery ajax success?

萝らか妹 提交于 2019-12-05 08:05:22
I am building some ajax in a Perl web framework Dancer I am not sure it is responding with proper http headers as I cannot trigger jQuery's ajax success handlers from what appear to be otherwise successful requests. Using the ajax snippet below I get the following output in a browser console. The complete callback gets called successfully and gives what looks like successful output. Status:200 StatusText:"OK" However the success handlers never get called. $.ajax({type: "GET", url: "/learn/faq", success: function(data){console.log('omg got it');}, complete: function(data){console.log("complete"

perl: correct `content type` formatting for returning `image data uri`

十年热恋 提交于 2019-12-04 07:08:27
问题 I have a template in angularjs expecting the image data uri returned by a server call invoked through the src attribute of the img element of the template: <img width="200px" height="200px" src="http://localhost:3000/returnimage" /> On the server side, written in Perl with Dancer I have: any ['get', 'post'] => '/returnimage' => sub { content_type 'image/jpeg;base64;'; 'data:image/jpeg;base64,/9j/4gIcSUNDX1B....N5f2hqE//Z'; }; The result on template render is a broken image tag: But the call

Dancer vs Catalyst [Perl Web Frameworks] [closed]

你。 提交于 2019-12-03 04:50:27
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . What do you think about both? I began reading a book about Catalyst, and found it pretty complex as compared to Dancer. so now I'm

Dancer vs Catalyst [Perl Web Frameworks] [closed]

女生的网名这么多〃 提交于 2019-12-02 18:02:06
What do you think about both? I began reading a book about Catalyst, and found it pretty complex as compared to Dancer. so now I'm giving Dancer a try, and it looks easier to learn and more "human friendly". This is a somewhat subjective question, but I'll try to give you an answer in an objective way. First things first, a disclaimer : I'm part of the Dancer development team, so my opinion should of course be considered somewhat biased :) Catalyst is more widely used than Dancer, and so there's more community support behind it - if you were to look for contractors with experience working with