Skip to content

Commit

Permalink
Fixed regexp, added params to Container
Browse files Browse the repository at this point in the history
  • Loading branch information
Getty committed Jan 22, 2011
1 parent d5e8957 commit 4eef83f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,6 +1,8 @@
Revision history for {{$dist->name}}

{{$NEXT}}
- Added params to container
- Fixed regexp for matching

0.001 2011-01-10 06:12:42 Europe/Berlin
- Initial official release
2 changes: 1 addition & 1 deletion dist.ini
Expand Up @@ -5,7 +5,7 @@ copyright_holder = L<Raudssus Social Software|http://www.raudssus.de/>
copyright_year = 2011

[Prereqs]
Moo = 0.009002
Moo = 0.009005
perl = 5.010

[Prereqs / TestRequires]
Expand Down
9 changes: 7 additions & 2 deletions lib/Text/Keywords/Container.pm 100644 → 100755
Expand Up @@ -20,10 +20,15 @@ has use_secondary => (
default => sub { 1 },
);

has params => (
is => 'ro',
default => sub {{}},
);

sub find_keywords {
my ( $self, $primary, $secondary ) = @_;
$primary = $secondary if !$primary;
return [] if !$primary;
return () if !$primary;
my @founds;
my @keywordlists;
my $klpos = 0;
Expand All @@ -39,7 +44,7 @@ sub find_keywords {
$kl->[1]--;
my $found;
splice(@keywordlists, $idx, 1) if (!$kl->[1]);
my $rx = qr/(^|[^\w]|[^\#])($keyword)/i;
my $rx = qr/(^|[^\w#])($keyword)/i;
my @text_found;
my $primary_str = $primary;
push (@text_found, [$primary_str =~ $rx]), $primary_str =~ s{$rx}{} while $primary_str =~ $rx;
Expand Down

0 comments on commit 4eef83f

Please sign in to comment.