since the qq:X family has recently come up, Id like to suggest another.
qq:i {} is just like qq{} except that when it interpolates variables, those which are undefined are preserved literally.
its purpose would be to support the construction of strings for subsequent eval'g, particularly where you have one or more variables to interpolate, so you cant just use q{}, but you also have lots of other vars that yould prefer not to backwhack.
its like closures on my vars, only differnt.
for $memberfn (qw( foo bar belch )) { # forgive errant? p5 syntax - I dont do this often *{__PACKAGE__}::${memberfn} = eval sub qq:i {
my $self = shift; # $self is undef when interpolated, so preserved
$self->{member}{$memberfn} = 1; # $self preserved, $memberfn interpolated
... # presumably something useful (but not in this example)
}
or die "badness happend";
}
Or maybe this is all superseded by p6 features, Im just cant keep up. (as you can tell from the p5 code)
Theres also some room for unholiness tho;
my @args = @{$template{args}}; my $body = $template{body}; eval sub qq:i{ my ($self, @args) = @_; $body; }