[dancer-users] dancer-users Digest, Vol 34, Issue 3

chenlin rao rao.chenlin at gmail.com
Mon Dec 10 14:45:39 GMT 2012


config.yml:
> ElasticSearch:
>     servers: "10.10.10.33:9200"
>     transport: "httplite"
>     max_requests: 10000
>     trace_calls: 0
>     no_refresh: 0
lib/App.pm:
>use lib "$Bin/../lib";
>use App::A;
>use App::B;
lib/App/A.pm:
>use Dancer ':syntax';
>use ElasticSearch;
>my $elsearch = ElasticSearch->new( config->{ElasticSearch} );
>prefix '/a';
>get '/config' => sub { return Dumper $elsearch };
lib/App/B.pm:
>use Dancer ':syntax';
>use ElasticSearch;
>my $elsearch = ElasticSearch->new( config->{ElasticSearch} );
>prefix '/b';
>get '/config' => sub { return Dumper $elsearch };

Then `get http://localhost:3000/a/config` show that servers: "
10.10.10.33:9200" but `get http://localhost:3000/b/config` show that
servers: "127.0.0.1:9200" which is the default setting of ElasticSearch
module.



2012/12/10 <dancer-users-request at dancer.pm>

> 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. Can I write own config in config.yml? (chenlin rao)
>    2. Re: Can I write own config in config.yml? (David Precious)
>    3. Re: Can I write own config in config.yml? (David Precious)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 10 Dec 2012 16:56:46 +0800
> From: chenlin rao <rao.chenlin at gmail.com>
> Subject: [dancer-users] Can I write own config in config.yml?
> To: dancer-users at perldancer.org
> Message-ID:
>         <CABwsoohczVCJwVxZcFUqPaS2KdxsK8-rE-V0=
> TeJEmDEPr4r5w at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> I try to write my own elasticsearch config in config.yml:
>
> ElasticSearch:
>     servers: "10.10.10.33:9200"
>     transport: "httplite"
>     max_requests: 10000
>     trace_calls: 0
>     no_refresh: 0
>
> But after I got the right `config->{ElasticSearch}` in my
> lib/DancerApp/A.pm, I got `config->{ElasticSearch}` in my
> lib/DancerApp/B.pm returns only one line as 'trace_calls:0'.
>
> I try to got config->{appdir} at multi sub and got right result everywhere.
>
> Why??
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20121210/85f94448/attachment.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Mon, 10 Dec 2012 10:46:51 +0000
> From: David Precious <davidp at preshweb.co.uk>
> Subject: Re: [dancer-users] Can I write own config in config.yml?
> To: Perl Dancer users mailing list <dancer-users at dancer.pm>,
>         dancer-users at perldancer.org
> Message-ID: <20121210104651.65d2c92f at columbia>
> Content-Type: text/plain; charset=US-ASCII
>
> On Mon, 10 Dec 2012 16:56:46 +0800
> chenlin rao <rao.chenlin at gmail.com> wrote:
>
> > I try to write my own elasticsearch config in config.yml:
> >
> > ElasticSearch:
> >     servers: "10.10.10.33:9200"
> >     transport: "httplite"
> >     max_requests: 10000
> >     trace_calls: 0
> >     no_refresh: 0
>
> That looks fine.
>
> > But after I got the right `config->{ElasticSearch}` in my
> > lib/DancerApp/A.pm, I got `config->{ElasticSearch}` in my
> > lib/DancerApp/B.pm returns only one line as 'trace_calls:0'.
> >
> > I try to got config->{appdir} at multi sub and got right result
> > everywhere.
> >
> > Why??
>
> Can you show your code?  config->{ElasticSearch} should give you the
> same in each case, unless it's being modified by something.
>
>
> --
> David Precious ("bigpresh") <davidp at preshweb.co.uk>
> 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
>
>
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 10 Dec 2012 10:46:51 +0000
> From: David Precious <davidp at preshweb.co.uk>
> Subject: Re: [dancer-users] Can I write own config in config.yml?
> To: Perl Dancer users mailing list <dancer-users at dancer.pm>,
>         dancer-users at perldancer.org
> Message-ID: <20121210104651.65d2c92f at columbia>
> Content-Type: text/plain; charset=US-ASCII
>
> On Mon, 10 Dec 2012 16:56:46 +0800
> chenlin rao <rao.chenlin at gmail.com> wrote:
>
> > I try to write my own elasticsearch config in config.yml:
> >
> > ElasticSearch:
> >     servers: "10.10.10.33:9200"
> >     transport: "httplite"
> >     max_requests: 10000
> >     trace_calls: 0
> >     no_refresh: 0
>
> That looks fine.
>
> > But after I got the right `config->{ElasticSearch}` in my
> > lib/DancerApp/A.pm, I got `config->{ElasticSearch}` in my
> > lib/DancerApp/B.pm returns only one line as 'trace_calls:0'.
> >
> > I try to got config->{appdir} at multi sub and got right result
> > everywhere.
> >
> > Why??
>
> Can you show your code?  config->{ElasticSearch} should give you the
> same in each case, unless it's being modified by something.
>
>
> --
> David Precious ("bigpresh") <davidp at preshweb.co.uk>
> 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
>
>
> End of dancer-users Digest, Vol 34, Issue 3
> *******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20121210/b9a6da59/attachment.htm>


More information about the dancer-users mailing list