Some Perl 5 programs take a regex (in string form) as input, and simply
interpolate it into a regex.
In Perl 6, you'd do that as
my $re = rx/ <$input> /;
But since $input can contain closures, arbitrary code can be executed.
I'd like to propose a way to compile a string to a regex which doesn't
Author: moritz
Date: 2010-01-04 11:49:21 +0100 (Mon, 04 Jan 2010)
New Revision: 29454
Modified:
docs/Perl6/Spec/S05-regex.pod
Log:
[S05] small clarification for .match and .subst
Modified: docs/Perl6/Spec/S05-regex.pod
===
--- doc
On Sun, Jan 3, 2010 at 8:30 PM, Moritz Lenz wrote:
>
> But since $input can contain closures, arbitrary code can be executed.
> I'd like to propose a way to compile a string to a regex which doesn't
> allow code execution.
>
So would I.
I would also like it to be the default behaviour, since th
Given this code:
subset Filename of Str where { $_ ~~ :f };
sub foo (Filename $name) {
say "Houston, we have a filename: $name";
}
my Filename $foo = $*EXECUTABLE_NAME;
foo($foo);
foo($*EXECUTABLE_NAME);
foo('no_such_file');
We get this output:
Houston,
On Mon, Jan 4, 2010 at 5:15 AM, Ovid
wrote:
> Given this code:
>
>subset Filename of Str where { $_ ~~ :f };
>
>sub foo (Filename $name) {
>say "Houston, we have a filename: $name";
>}
...
> Obviously the error message can use some work, but how would I customize that
> error
# New Ticket Created by na...@khemir.net
# Please include the string: [perl #71810]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=71810 >
rakudo commit: db84bc06990c37b93fe987dcffab4ed9bf31de92
build/PARROT_REVISION: 43076
# New Ticket Created by na...@khemir.net
# Please include the string: [perl #71814]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=71814 >
rakudo commit: db84bc06990c37b93fe987dcffab4ed9bf31de92
build/PARROT_REVISION: 43076
# New Ticket Created by na...@khemir.net
# Please include the string: [perl #71812]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=71812 >
rakudo commit: db84bc06990c37b93fe987dcffab4ed9bf31de92
build/PARROT_REVISION: 43076
# New Ticket Created by na...@khemir.net
# Please include the string: [perl #71808]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=71808 >
rakudo commit: db84bc06990c37b93fe987dcffab4ed9bf31de92
build/PARROT_REVISION: 43076
# New Ticket Created by na...@khemir.net
# Please include the string: [perl #71816]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=71816 >
rakudo commit: db84bc06990c37b93fe987dcffab4ed9bf31de92
build/PARROT_REVISION: 43076
# New Ticket Created by publiustemp-perl6interna...@yahoo.com
# Please include the string: [perl #71820]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=71820 >
For this code:
use v6;
class Foo {
subset Filename
--- On Mon, 4/1/10, yary wrote:
> From: yary
> How about
> multi sub foo(Any $name) { die "Houston, we have a major
> malfunction."}
Looks like tha would work, but it forces the developer to remember to write
this extra code every time they may have a constraint failure, if they forget,
we'r
12 matches
Mail list logo