Hi All New to the group so apologies for some basic questions. I have the framework running well but am now trying to change the default session mechanism to use YAML and a specific dir. It continues to use ./sessions as the dir. Here is the config I have: # # session management # YAML stores on disk session: YAML engines: session: YAML: session_dir: /tmp/dancer-sessions Any guidance on why this is not working would be appreciated regards Zahir Lalani Head of Development & Architecture [cid:96F784CA-E917-4CC1-A9A9-96CBDA2AF2BC] 3rd Floor, Union House, 65-69 Shepherds Bush Green, London, W12 8TX t: +44 (0)20 8746 4673 m: +44 (0)7956 455168 e: zahirlalani@oliver-marketing.com<mailto:zahirlalani@oliver-marketing.com> w: www.oliver-marketing.com<http://www.oliver-marketing.com/>
On Thu, 2015-02-19 at 12:32 +0000, Zahir Lalani wrote:
I have the framework running well but am now trying to change the default session mechanism to use YAML and a specific dir. It continues to use ./sessions as the dir. Here is the config I have:
session: YAML engines: session: YAML: session_dir: /tmp/dancer-sessions
That's the exact config I have, and it works fine for me, so maybe it's not picking up that config file. Are you sure it's reading the config file that you're editing? Andy
-----Original Message----- From: dancer-users [mailto:dancer-users-bounces@dancer.pm] On Behalf Of Andrew Beverley Sent: 19 February 2015 13:00 To: Perl Dancer users mailing list Subject: Re: [dancer-users] session dir
On Thu, 2015-02-19 at 12:32 +0000, Zahir Lalani wrote:
I have the framework running well but am now trying to change the default session mechanism to use YAML and a specific dir. It continues to use ./sessions as the dir. Here is the config I have:
session: YAML engines: session: YAML: session_dir: /tmp/dancer-sessions
That's the exact config I have, and it works fine for me, so maybe it's not picking up that config file.
Are you sure it's reading the config file that you're editing?
Andy
Yes just tested by making a non-valid change and got lots of errors in the console. So it is using that config file Z
On Thu, 2015-02-19 at 13:23 +0000, Zahir Lalani wrote:
Are you sure it's reading the config file that you're editing?
Andy
Yes just tested by making a non-valid change and got lots of errors in the console. So it is using that config file
Another thing I've done wrong before is have 2 keys the same in the config file (eg. 2 "engines" keys). I assume that's not the case? Other than that, it might be worth sticking some debug statements into lib/Dancer2/Core/Role/SessionFactory/File.pm and trying to glean a bit more information.
From: dancer-users [mailto:dancer-users-bounces@dancer.pm] On Behalf Of Andrew Beverley Sent: 19 February 2015 13:41 To: Perl Dancer users mailing list Subject: Re: [dancer-users] session dir
On Thu, 2015-02-19 at 13:23 +0000, Zahir Lalani wrote:
Are you sure it's reading the config file that you're editing?
Andy
Yes just tested by making a non-valid change and got lots of errors in the console. So it is using that config file
Another thing I've done wrong before is have 2 keys the same in the config file (eg. 2 "engines" keys). I assume that's not the case?
Other than that, it might be worth sticking some debug statements into lib/Dancer2/Core/Role/SessionFactory/File.pm and trying to glean a bit more information.
Ah! Do you mean this: template: "template_toolkit" engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' encoding: 'utf8' # # session management # YAML stores on disk session: YAML engines: session: YAML: session_dir: /tmp/dancer-sessions so should I be combining the two engines entry as so? template: "template_toolkit"engines: session: YAML engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' encoding: 'utf8' session: YAML: session_dir: /tmp/dancer-sessions Z
On Thu, 2015-02-19 at 13:50 +0000, Zahir Lalani wrote:
Ah! Do you mean this:
template: "template_toolkit" engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' encoding: 'utf8'
# # session management # YAML stores on disk session: YAML engines: session: YAML: session_dir: /tmp/dancer-sessions
so should I be combining the two engines entry as so?
template: "template_toolkit"engines: session: YAML engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' encoding: 'utf8' session: YAML: session_dir: /tmp/dancer-sessions
Yes, exactly that ;-) Although make sure your "session" key is directly below the "template" key
From: dancer-users [mailto:dancer-users-bounces@dancer.pm] On Behalf Of Andrew Beverley Sent: 19 February 2015 13:59 To: Perl Dancer users mailing list Subject: Re: [dancer-users] session dir
On Thu, 2015-02-19 at 13:50 +0000, Zahir Lalani wrote:
Ah! Do you mean this:
template: "template_toolkit" engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' encoding: 'utf8'
# # session management # YAML stores on disk session: YAML engines: session: YAML: session_dir: /tmp/dancer-sessions
so should I be combining the two engines entry as so?
template: "template_toolkit"engines: session: YAML engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' encoding: 'utf8' session: YAML: session_dir: /tmp/dancer-sessions
Yes, exactly that ;-)
Although make sure your "session" key is directly below the "template" key
Perfect - amazed that its so sensitive to indentation! Very pythony :-) Thx for the help all Z
On Thu, Feb 19, 2015 at 9:05 AM, Zahir Lalani < ZahirLalani@oliver-marketing.com> wrote:
From: dancer-users [mailto:dancer-users-bounces@dancer.pm] On Behalf Of Andrew Beverley Sent: 19 February 2015 13:59 To: Perl Dancer users mailing list Subject: Re: [dancer-users] session dir
On Thu, 2015-02-19 at 13:50 +0000, Zahir Lalani wrote:
Ah! Do you mean this:
template: "template_toolkit" engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' encoding: 'utf8'
# # session management # YAML stores on disk session: YAML engines: session: YAML: session_dir: /tmp/dancer-sessions
so should I be combining the two engines entry as so?
template: "template_toolkit"engines: session: YAML engines: template: template_toolkit: start_tag: '<%' end_tag: '%>' encoding: 'utf8' session: YAML: session_dir: /tmp/dancer-sessions
Yes, exactly that ;-)
Although make sure your "session" key is directly below the "template" key
Perfect - amazed that its so sensitive to indentation! Very pythony :-)
Indeed! I believe it was the Bard that first said "Oh what tangled webs we weave, when first we labor to believe, that indentation should be syntax." A simple route that prints a Dumper of your config can be a useful thing in debugging this sort of issue. (Or just a debug line like debug Dumper(scalar config ); ) can help with debugging this sort of thing. mike
Thx for the help all
Z _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
Am 19.02.15 um 17:21 schrieb Mike South:
On Thu, Feb 19, 2015 at 9:05 AM, Zahir Lalani < ZahirLalani@oliver-marketing.com> wrote:
Perfect - amazed that its so sensitive to indentation! Very pythony :-) [...] A simple route that prints a Dumper of your config can be a useful thing in debugging this sort of issue. (Or just a debug line like
debug Dumper(scalar config );
) can help with debugging this sort of thing.
You don't need routes or debug statements to do this, "x config" in the perl debugger just before executing "dance()" is enough. Jochen
On Thu, Feb 19, 2015 at 10:30 AM, Jochen Lutz <jlu@gmx.de> wrote:
Am 19.02.15 um 17:21 schrieb Mike South:
On Thu, Feb 19, 2015 at 9:05 AM, Zahir Lalani < ZahirLalani@oliver-marketing.com> wrote:
Perfect - amazed that its so sensitive to indentation! Very pythony :-)
[...]
A simple route that prints a Dumper of your config can be a useful thing in debugging this sort of issue. (Or just a debug line like
debug Dumper(scalar config );
) can help with debugging this sort of thing.
You don't need routes or debug statements to do this, "x config" in the perl debugger just before executing "dance()" is enough.
Yes, there is more than one way to do it. If you throw a debug in somewhere or put a route in, you can just hit that route or look in the log at any point when you're doing whatever you're doing and you wonder if the config is structured the way you think or if you started it with the right config. It should be said, though, that if you put it in a route, you should make sure you only let it run when the config is development (or some other similar safeguard) so you don't expose things like database passwords when you take it live. mike
participants (4)
-
Andrew Beverley -
Jochen Lutz -
Mike South -
Zahir Lalani