[Kiev-pm] Задание конфигурации Dancer с помощью set

TheAthlete theathlet at yandex.ru
Mon Nov 4 05:04:41 PST 2013


У меня тоже устанавливается, но при выводе в лог (если, например, нужно  
доработать модуль Dancer::Template::), заметил следующее поведение:

app.pl
#!/usr/bin/env perl

use FindBin;
use lib '/path/to/custom/Dancer-Template-Haml/lib';

use feature 'say';

use Dancer;

use Plack::Builder;
use Data::Section::Simple qw/get_data_section/;
use Data::Dumper;

my $vpath = get_data_section;

# Develop settings
set strict_config   => 1;
set global_warnings => 1;
set warnings        => 1;
set traces          => 1;
set show_errors     => 1;
set auto_reload     => 1;

set log_path  => './logs';
set log_file  => 'dev.log';
set logger    => 'file';
set log       => 'core';

set apphandler  => 'Debug';
set charset     => 'UTF-8';
set template    => 'haml';
set serializer  => 'JSON';

set engines => { haml => { cache => 1 } };

get '/' => sub { 'hello' };

dance;

-----------------------
Dancer/Template/Haml.pm:

...

sub init {
   my $self = shift;
   Dancer::Logger::info( "Self init: ". Dumper($self));
}

...

-----------------------
./logs/dev.log

[6653]  info @0.000010> Self init: $VAR1 = bless( {
                  'name' => 'haml',
                  'config' => {},
                  'type' => 'template'
                }, 'Dancer::Template::Haml' ); in  
/path/to/custom/lib/Dancer/Template/Haml.pm l. 23

А если поместить

set engines => { haml => { cache => 1 } };

выше

set log_path  => './logs';
set log_file  => 'dev.log';
set logger    => 'file';
set log       => 'core';

то все выводится:

set engines => { haml => { cache => 1 } };

set log_path  => './logs';
set log_file  => 'dev.log';
set logger    => 'file';
set log       => 'core';

-----------------------
./logs/dev.log

[6663]  info @0.000010> Self init: $VAR1 = bless( {
                  'name' => 'haml',
                  'config' => {
                                'cache' => 1
                              },
                  'type' => 'template'
        	       }, 'Dancer::Template::Haml' ); in  
/path/to/custom/lib/Dancer/Template/Haml.pm l. 23


More information about the Kiev-pm mailing list