subtype 'FilePath'
=> as 'Str'
=> where { m{^[\w/_.-]{1,80}\z} }
=> message { "I don't trust file name '$_'" };
has logfile => (
traits => [qw( Untaint )],
is => 'rw',
isa => 'FilePath',
default => '/var/log/walrus.log',
);
####
subtype 'FilePath'
=> as 'Str'
=> where { !tainted($_) || m{^[\w/_.-]{1,80}\z} }
=> message { "I don't trust file name '$_'" };
has logfile => (
traits => [qw( Untaint )],
is => 'rw',
isa => 'FilePath',
default => '/var/log/walrus.log',
);
####
subtype 'FilePath'
=> as 'Str'
=> where { m{^[\w/_.-]{1,80}\z} }
=> message { "I don't trust file name '$_'" };
coerce 'FilePath'
=> from 'Str'
=> via { /(.*)/s; $1 }; # Will be validated soon.
has logfile => (
is => 'rw',
isa => 'FilePath',
default => '/var/log/walrus.log',
coerce => 1,
);