dancer

Does Devel::Peek exist as a standalone Perl module?

家住魔仙堡 提交于 2021-01-05 07:04:49
问题 I have a clean install of perl 5.26.3, and I am trying to install Dancer2. Dancer2 depends on App::Cmd::Setup, which depends on Getopt::Long::Descriptive, which depends on Params::Validate, which depends on Devel::Peek. Looking at Devel::Peek on MetaCPAN, it is part of the perl 5.30.2 distribution, and I can not find the Devel::Peek package by itself. The "Jump to version" list on the Devel::Peek page lists previous version of perl, not of Devel::Peek. Installing Dancer2 on perl 5.26.3

Perl::Dancer how to include a file path as a parameter in the URI

社会主义新天地 提交于 2019-12-24 16:01:58
问题 I'm new to the Dancer framework and web apps in general. I have a Dancer project in which I have a route that accepts multiple parameters. So far, no sweat. However, if one of the parameters has a file path as its value then the route is not found. I have tried encoding the parameter string as follows to eliminate the forward slashes: $paramString =~ s/\//%2F/g; and this does encode the slashes as expected (I print it out in the log to make sure). However, after the parameter string is

How to make a page-specific title in Dancer templates?

一笑奈何 提交于 2019-12-24 00:59:30
问题 I have a standard Perl Dancer app, using Template::Toolkit as rendering engine, with two routes: get '/' => sub { template 'index'; }; get '/foo' => sub { template 'foo'; }; My views/templates/main.tt contains the line: <title><%= title %></title> I want the value of title var be "My Site" on page '/', and "Foo - My Site" on page '/foo'. I know I can put these values in the controller file, like this: template 'index', { title => 'My Site' }; but I want to specify them in the corresponding

What exactly triggers jQuery ajax success?

孤者浪人 提交于 2019-12-22 05:48:15
问题 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

An explanation of the nginx/starman/dancer web stack

别来无恙 提交于 2019-12-18 10:07:47
问题 I've been doing web-programming for a while now and am quite familiar with the LAMP stack. I've decided to try playing around with the nginx/starman/dancer stack and I'm a bit confused about how to understand, from a high-level, how all the pieces relate to each other. Setting up the stack doesn't seem as straight forward as setting up the LAMP stack, but that's probably because I don't really understand how the pieces relate. I understand the role nginx is playing - a lightweight webserver

An explanation of the nginx/starman/dancer web stack

蹲街弑〆低调 提交于 2019-12-18 10:07:08
问题 I've been doing web-programming for a while now and am quite familiar with the LAMP stack. I've decided to try playing around with the nginx/starman/dancer stack and I'm a bit confused about how to understand, from a high-level, how all the pieces relate to each other. Setting up the stack doesn't seem as straight forward as setting up the LAMP stack, but that's probably because I don't really understand how the pieces relate. I understand the role nginx is playing - a lightweight webserver

Generate unique random strings

这一生的挚爱 提交于 2019-12-14 03:47:38
问题 I am writing a very small URL shortener with Dancer. It uses the REST plugin to store a posted URL in a database with a six character string which is used by the user to access the shorted URL. Now I am a bit unsure about my random string generation method. sub generate_random_string{ my $length_of_randomstring = shift; # the length of # the random string to generate my @chars=('a'..'z','A'..'Z','0'..'9','_'); my $random_string; for(1..$length_of_randomstring){ # rand @chars will generate a

unable to connect to multiple database using Dancer::Plugin::Database

雨燕双飞 提交于 2019-12-13 16:47:49
问题 I am using Dancer::Plugin::Database to connect with database from my dancer application. It works fine for single connection. When i tried for multiple connection i got error. How can i add multiple connection. I added the following code in my config.yml file: plugins: Database: connections: one: driver: 'mysql' database: 'employeedetails' host: 'localhost' port: 3306 username: 'remya' password: 'remy@' connection_check_threshold: 10 dbi_params: RaiseError: 1 AutoCommit: 1 on_connect_do: [

Installing Perl Dancer2 on Windows

霸气de小男生 提交于 2019-12-12 06:27:17
问题 I'm new in Perl and would like to install Dancer2 on a Windows 7 machine. I have checked [this][1] but there is nothing about Windows. Update: As ThisSuitIsBlackNot suggested I've tried: cpan Dancer2 and I've got the following message: I've also checked the metacpan tutotial and I've tried this: cpanm Dancer2::Test but then I've got the following message: logfile: -> FAIL Installing the dependencies failed: Module 'MooX::Types::MooseLike' is not installed -> FAIL Bailing out the installation

How to allow multiple connections to Dancer2

泪湿孤枕 提交于 2019-12-12 02:36:37
问题 I am using Perl Dancer2 as the RESTful service framework with the basic setting (using command dancer2 -a MyWeb::App to generate template files and add "get" routes in the auto-generated MyWeb-App/lib/MyWeb/App.pm file). Recently I found out that when one request needs a long period of time to finish, the server is locked to only serve that request. For example get '/' => sub {# simple request to redirect to a static page template 'index'; #template directive Templates all go into the views/