MOON
Server: Apache
System: Linux server1.studioinfinity.com.br 2.6.32-954.3.5.lve1.4.90.el6.x86_64 #1 SMP Tue Feb 21 12:26:30 UTC 2023 x86_64
User: artinside (517)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/local/lib/perl5/site_perl/5.8.8/Text/Query/Advanced.pm
# Backwards-compatibility and speed stub for Text::Query

package Text::Query::Advanced;

use strict;
use vars qw(@ISA);
use Text::Query;
@ISA=qw(Text::Query);

#use base 'Text::Query';

sub new {
  my $class=shift;
  $class->SUPER::new (@_,-mode => 'advanced_text');
}

sub match {
    my($self) = shift;
    my($expr) = $self->{matchexp};

    return $expr->(shift || $_) if(@_ <= 1 && ref($_[0]) ne 'ARRAY');

    my($pa) = (@_ == 1 && ref($_[0]) eq 'ARRAY') ? shift : \@_;

    my(@ra);
    if(ref($pa->[0]) eq 'ARRAY') {
	@ra = grep { $expr->($_[0]) } @$pa;
    } else {
	@ra = grep { $expr->($_) } @$pa;
    }
    return wantarray ? @ra : \@ra;
}

sub matchscalar {
    my($self) = shift;

    return $self->{matchexp}->(shift || $_);
}

1;