Undocumented bug or feature
Hello! Dancer manual (pod) tells us about `path` function: "Concatenates multiple paths together, without worrying about the underlying operating system". But unfortunately this isn't true :( In reality &Dancer::path is &File::Spec::catfile wrapped by &Cwd::realpath. And &Cwd::realpath is worked with BSD realpath (3) semantic: "All but the last component of a pathname must exist when realpath() is called." Assume that '/tmp' directory is exists and empty. Then this Dancer application code: my $x = path "/tmp","nonexistent"; my $y = path "/tmp","nonexistent","foo"; will assign "/tmp/nonexistent" to $x, but undef to $y. This behavior may be slightly unexpected :) So if you create variable with nonexistence path you may get defined or undefined string depending on missing subdirectories number. I am not sure what's the best, but (imho) ones should be fixed: Dancer pod or Dancer::path :) -- Cheers, Oleg A. Mamontov mailto: oleg@mamontov.net jabber: lonerr@charla.mamontov.net icq uin: 79-521-617 cell: +7-903-798-1352
Hi Oleg! Thank you for noting this. I will hopefully push a new implementation of the entire path()s layer we have this weekend, and this will incorporate what you mentioned. On Wed, Jun 22, 2011 at 10:12 PM, Oleg A. Mamontov <oleg@mamontov.net>wrote:
Hello!
Dancer manual (pod) tells us about `path` function: "Concatenates multiple paths together, without worrying about the underlying operating system".
But unfortunately this isn't true :( In reality &Dancer::path is &File::Spec::catfile wrapped by &Cwd::realpath.
And &Cwd::realpath is worked with BSD realpath (3) semantic: "All but the last component of a pathname must exist when realpath() is called."
Assume that '/tmp' directory is exists and empty. Then this Dancer application code:
my $x = path "/tmp","nonexistent"; my $y = path "/tmp","nonexistent","foo";
will assign "/tmp/nonexistent" to $x, but undef to $y.
This behavior may be slightly unexpected :) So if you create variable with nonexistence path you may get defined or undefined string depending on missing subdirectories number.
I am not sure what's the best, but (imho) ones should be fixed: Dancer pod or Dancer::path :)
-- Cheers, Oleg A. Mamontov
mailto: oleg@mamontov.net
jabber: lonerr@charla.mamontov.net icq uin: 79-521-617 cell: +7-903-798-1352
_______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
participants (2)
-
Oleg A. Mamontov -
sawyer x