my $self = shift;
my $value = shift // 'true';
unless ($value ~~ ['true', 'none', 'condition'])
{
if ($value == TRUE)
{
my $self = shift;
my $value = $self->get_attribute('display');
given ($value)
{
when (undef) { return TRUE }
elf = shift;
my $type = shift or return undef;
unless ($type ~~ [ 'standard', 'lines', 'line', 'curve' ])
{
alert "Not allowed con
my $v;
# Originally this code used the being-discontinued given/when construct
# given ($opt{$k}) {
# when(TRUE) { $v = 'true' } # TRUE is 1
# when(FALSE) { $v = 'none' }
}
sub is_numeric_family
{
my $self = shift;
my $f = shift or return undef;
return ($f ~~ @NUMERIC_FAMILIES) ? TRUE : FALSE;
}
#---------------------------------------------------------
{
my $family = $1;
if ($family ~~ [@FAMILIES])
{
return __PACKAGE__;
'eq' => sub{ &_op_overload( @_, 'IS' ) },
# Full Text Search operator
'~~' => sub{ &_op_overload( @_, '@@' ) },
fallback => 1,
);
use Want;
our $VERS
are overloaded:
+, -, *, /, %, <, <=, >, >=, !=, <<, >>, lt, gt, le, ge, ne, &, |, ^, ==, eq, ~~
Thus a field named "dummy" could be used like:
$f + 10
which would become:
dummy + 10
ceholder in:
$f == "'JPY'"
Simply provide:
$f == '?'
You can use the search operator C<~~> for SQL Full Text Search and it would be converted into C<@@>:
Let's imagine a table C<articles>
p { not $_->tag ~~ [qw(001 009 039 917 930 955)] } @{$record->fields}
]);
# Clean some subfields
for my $field ( @{$record->fields} ) {
next unless $field->tag ~~ [qw(410 461 60
{
my $cell = $table->get_cell($i, $j);
if ($cell->get_type ~~ $filter) {
$count++;
$amount += $cell->get_value;
my $cell = $row->get_cell($j) or last CELL;
if ($cell->get_type ~~ $filter) {
$count++;
$amount += $cell->get_value;
{
my $v;
given ($opt{$k})
{
when
ype} || 'number';
$e = ODF::lpOD::ListLevelStyle->create($type) or return FALSE;
given ($type)
{
when (['number', 'outline'])
{
{
my $caller = shift;
my $type = shift;
my $tag;
given ($type)
{
when (undef)
{
set_type
{
my $self = shift;
my $type = shift;
given ($type)
{
when (undef)
{
my $self = shift;
my $type = $self->get_type();
my $value;
given ($type)
{
when ('string')
{
my $type = $self->get_type();
my $v = check_odf_value($value, $type);
given ($type)
{
when ('string')
{
my $param = shift // "";
$param = shift if $param eq lpod;
given ($param)
{
when (undef) {}
when (TRUE
my $arg = shift;
return FALSE unless $arg;
my $v = lc $arg;
return $v ~~ ["false", "off", "no"] ? FALSE : TRUE;
}
sub is_false
{
return is_tru
= shift;
return undef unless defined $value;
my $type = shift;
given ($type)
{
when (['float', 'currency', 'percentage'])
{
my $cell = $table->get_cell($i, $j);
if ($cell->get_type ~~ $filter) {
$count++;
$amount += $cell->get_value;
my $cell = $row->get_cell($j) or last CELL;
if ($cell->get_type ~~ $filter) {
$count++;
$amount += $cell->get_value;
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
$role_reqs
.
format INHERIT_POD =
=head1 NAME
@*
$myclass
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
$handles
.
format ATTR_NARROW
$handles
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
$handles
.
format ATTRHEAD_POD =
=head1 ATTRIBUTES
.
format ATTR_POD =
=he
must be provided with more context data.
=head2 C<Pointer[ ... ]>
Pointer[Int] ~~ int *
Pointer[Void] ~~ void *
Create pointers to (almost) all other defined types including C<Struct> and
struct {
year => Int, int year;
month => Int, ~~ int month;
day => Int int day;
],
ned.
The argument list and return value must be defined. For example,
C<CodeRef[[Int, Int]=>Int]> ~~ C<typedef int (*fuc)(int a, int b);>; that is to
say our function accepts two integers and returns
_tags = map { sprintf("%03d", $_) } ( 1..999 );
for my $tag (@all_tags) {
next if $tag ~~ @tags || $tag == '410'; # On passe, déjà traité plus haut
my @fields = $sudoc->field($t
sub {
my ($self, $record) = @_;
# Suppression des champs SUDOC dont on ne veut pas dans le catalogue
$record->fields( [ grep { not $_->tag ~~ @todelete } @{$record->fields} ] );
};
1;
Smart Matching';
1;
__DATA__
=encoding utf-8
=head1 Smart matching
Basically, smart matching(C<~~>) look at both his operators and decides what to do with them.
=head3 Table for smart match opera
%x ~~ %y hash keys identical
%x ~~ @y or @x ~~ %y at least one key in %x is in @y
%x ~~ /text/ or /text/ ~~ %y at least one key matches pattern
'text' ~~ %x
@x ~~ @y arrays are the same
@x ~~ /text/ at least one element in @x matches pattern
$name ~~ undef $name is not defined
$name ~~ /text
) # THIS STRIPS AWAY THE PARAMETERS THAT ARE NOT CONTAINED IN @pars_tocheck.
{
unless ( $elt ~~ @{ $pars_tocheck[$countcase] } )
{
delete ${ $tempvarnumbers[$countcase] }{$elt};
}
}
eq "")
{
my $elmo = $elem;
$elmo =~ s/(.*)-(.*)/$1/;
if ($elmo ~~ @integralslice)
{
;
}
else
{
if ($countblk
match (`~~`) operator can already match against a list of strings
or regexes, this function is currently basically equivalent to:
if (ref($haystack) eq 'ARRAY') {
return $needle ~~ @$hays
rtmatch (C<~~>) operator can already match against a list of strings
or regexes, this function is currently basically equivalent to:
if (ref($haystack) eq 'ARRAY') {
return $needle ~~ @$haystac
goto &$old_warn_handler if $old_warn_handler;
warn( @_ );
}
};
use overload '~~' => \&over_go;
#use overload '>>' => \&over_go_assign;
sub over_go_assign {
$_[0]->{assign};
: $ret ~~ $_go_self->{rest};
}
else {
return $_go_self->{ by }
? $_go_self->{rest}->{code}->( @$ret )
: $ret ~~ $_go_self->{rest}
1, 2, 3 ] ~~ go { say $_ };
# 1
# 2
# 3
# hashes with $a and $b
%h ~~ go { say "key $a, value $b" };
undef ~~ go {
# never gets called...
};
'' ~~ go {
t
=head2 |>
a |> b
Returns the
=cut
=head2 ||
a || b
Returns the
=cut
=head2 ~~
a ~~ b
Returns the
Aliases: I<smartmatch>
=cut
=head2 ⫶
a ⫶ b
Returns the
=cut
=he
ned, @results ];
}
elsif ( SMARTMATCH_ALLOWED ) {
$match = q[ @results ~~ $hints->{list} ];
warnings::warnif('deprecated', sprintf(WARNING_SMARTMATCH_DEPRECATED
!defined $retval ];
}
elsif (SMARTMATCH_ALLOWED) {
$match = q[ $retval ~~ $hints->{scalar} ];
warnings::warnif('deprecated', sprintf(WARNING_SMARTMATCH_DEPRECAT
----------------------------
~~ Same as SQL "LIKE" operator 'scrappy,marc' ~~ '%scrappy%'
!~~ Same as SQL "NOT LIKE" operator 'bruce' !~~ '%al%'
~ Match (regex),
"0\n\0",
"\0\n\0",
);
my %exp;
for @pat -> $pat {
my $x = $pat;
$x ~~ s:g/\0/\\0/;
$x ~~ s:g/\n/\\n/;
%exp{$pat} = $x;
}
my Str @line = ("", Str, "0\n", "", "\0\0\n0")