Acme-Lvalue
view release on metacpan or search on metacpan
lib/Acme/Lvalue.pm view on Meta::CPAN
[cos => sub { acos $_[0] }],
[defined =>
sub {
$_[0]
? defined $_[1]
? $_[1]
: 1
: undef
}
],
[exp => sub { log $_[0] }],
[hex => sub { sprintf '%x', $_[0] }],
[length =>
sub {
my ($n, $x) = @_;
my $l = length $x;
$n <= $l
? substr $x, 0, $n
: $x . "\0" x ($n - $l)
}
],
[log => sub { exp $_[0] }],
[oct => sub { sprintf '%o', $_[0] }],
[ord => sub { chr $_[0] }],
[quotemeta => sub { $_[0] =~ s/\\(.)/$1/sgr }],
[reverse => sub { scalar reverse $_[0] }],
[sin => sub { asin $_[0] }],
[sqrt => sub { my $x = shift; $x * $x }],
;
sub import {
my $class = shift;
lib/Acme/Lvalue.pm view on Meta::CPAN
=item * The string C<:builtins>.
This overrides the following builtins:
L<C<chr>|perlfunc/chr>,
L<C<cos>|perlfunc/cos>,
L<C<defined>|perlfunc/defined>,
L<C<exp>|perlfunc/exp>,
L<C<hex>|perlfunc/hex>,
L<C<length>|perlfunc/length>,
L<C<log>|perlfunc/log>,
L<C<oct>|perlfunc/oct>,
L<C<ord>|perlfunc/ord>,
L<C<quotemeta>|perlfunc/quotemeta>,
L<C<reverse>|perlfunc/reverse>,
L<C<sin>|perlfunc/sin>,
L<C<sqrt>|perlfunc/sqrt>.
=item * Any of the builtins listed above.
This lets you pick and choose which builtins to override.
( run in 0.632 second using v1.01-cache-2.11-cpan-49f99fa48dc )