Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Perl by Sewi ( 13 years ago )
my @items = ();
print $regexp;
eval { while ( $text =~ /$regexp/gim ) { 
push @items, { text => $1 || '<no text>', 'pos' => pos($text) };
}
};
$self->main->error("foo");
while ( $text =~ /#s*(Ticket #d+.*?)$/gim ) {
push @items, { text => $1, 'pos' => pos($text) };
}

if ( @items == 0 ) {
$list->Clear;
$self->{model} = [];
return;
}

# Update the model and rerender
$self->{model} = @items;
$self->render;
}

# Populate the list with search results
sub render {
my $self = shift;
my $model = $self->{model};
my $search = $self->{search};
my $list = $self->{list};

# Quote the search string to make it safer
my $string = $search->GetValue;
if ( $string eq '' ) {
$string = '.*';

 

Revise this Paste

Your Name: Code Language: