Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permit IO::Path given as path to
use lib
Fixes RT#131540: https://rt.perl.org/Ticket/Display.html?id=131540
- Loading branch information
1 parent
f0c3bf7
commit 3ff29d4
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3ff29d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first thought is I'm not sure this is the right way to handle this. Coercing to a string, maybe. But the interface takes strings because it's intended to accept things that can be passed on the command line or in env. Additionally different CURs can/could be used for absolute and relative paths, but the user cannot choose like this.
3ff29d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So would you suggest moving the coersion to Actions that handle
use lib
instead?3ff29d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I don't entirely understand the concern. The IO::Path objects, even ones made from relative paths, will have CWD baked into them, so
.absolute
ing them even from another dir would still give the original path back. And theStr
multi is still there for strings passed from the command line and env.3ff29d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the fact the paths are technically the same does not matter; what matters is the representation of it. We have a CUR::AbsolutePath and a CUR::FileSystem for instance. And now any third party CUR now must accept absolute paths if they want to work with IO::Path objects. absolutifying actually loses information (we no longer know the un-prefixed path).
Coercing to a string, assuming it coerces to the original string supplied by the user, avoids such issues. e.g.
sub foo(Str(Cool) $bar) { say $bar }; foo(IO::Path.new("/xxx")); foo(IO::Path.new("xxx/"))
3ff29d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made changes in 326faed6c5