Reputation: 1617
Probably a silly question, but how do I get the path to the /public
folder in Dancer?
I want to store/read csv files under the public folder, but don't know if Dancer offers any convenience methods to get the base path to the public folder.
The error I get when trying to create a file by saying:
open(FILE, ">>", "myapp/public/file.csv") or die "$!";
is:
No such file or directory in /ur/share/perl5/Dancer/Handler.pm l. 98
I'm not sure why it's going to Handler.pm?
Upvotes: 0
Views: 462
Reputation: 1569
My first answer is, don't do it that way...for two reasons:
That being said, if you really still want to do this, the public dir lives in config->{public}:
print "Public dir:".config->{public}."\n";
Source: http://search.cpan.org/~xsawyerx/Dancer-1.3110/lib/Dancer/Config.pm#public_%28directory%29
Upvotes: 2