[Dancer-users] How to un-prettify JSON?

Mr. Puneet Kishor punk.kish at gmail.com
Sun Mar 13 20:26:57 CET 2011


On Mar 13, 2011, at 12:40 PM, sawyer x wrote:

> Hi,
> 
> I've checked the code and apparently pretty printing is only on if you're in the "development" dancefloor. :)
> 
> 

Ok. I am "supposedly" on the development dancefloor, so perhaps that is why I am getting prettified JSON, although I would like to make it more compact, and now I can.

But, see my email from Mar 5. I reproduce it below. As the following email details, I have been under the impression that I just can't get the development environment to kick in under Apache. One of the results of this effect is that I don't get anything in my development.log.

If I use the Dancer built-in server, I am able to see messages in development.log, however, if I were to use the built-in server, the built-in server doesn't allow me to set aliases to directories (another query that I posted on Mar 5 was on this issue -- no resolution of that as yet).

----
I can't figure out how to tell Dancer that my app should use development.yml under Apache.

I have the following in vhosts.conf

SetEnv DANCER_ENVIRONMENT "development"

When I put the following fragment in config.yml, everything works

db_name: "mydb"
db_user: "dev"
db_pass: "dev"

When I take the above fragment out of config.yml, and put it in development.yml, all the config->{} values are empty. For example, I get the following error in my Apache log

DBI connect('dbname=','',...) failed: FATAL:

because, my code is

my $dbh = DBI->connect(
	"dbi:Pg:dbname=" . config->{db_name}, 
	config->{db_user}, 
	config->{db_pass}, 
	{AutoCommit => 0}
);

If I put the above in development.yml, and put the following in production.yml, it fails because it can't find the prod databases

db_name: "mydb"
db_user: "prod"
db_pass: "prod"

It is almost as if development.yml is not being seen at all. It is being bypassed. Maybe that also explains why I am not getting any development.log.

Any ideas? I am using Dancer 1.3011.

Puneet,


More information about the Dancer-users mailing list