On Wed, 06 Oct 2010 23:03:10 +0200, Grzegorz Dzięgielewski <jab...@jabbas.pl> 
wrote:
> Do you have any ideas why abspath attribute is not coercing in the code
> below (via code block in Path subtype is never used)?

> subtype 'Path' => as 'Str';
> coerce 'Path' => from 'Str' => via { abs_path $_ };

Nothing will ever run this coercion, since every valid Str is already a valid
Path.  You need to narrow down the definition of Path, maybe e.g.

  subtype 'Path', as 'Str', where { ! m{/..?(/|$)} }

In other words, "a Path is a Str that does not contain /./ or /../ or end with
/. or /..".

hdp.

Reply via email to