Article.pm
#!/usr/bin/perl
package Article;
use strict;
use warnings;
#
# konstruktor
#
sub new {
my $self = {
title => undef,
content => undef,
category => undef,
url => undef
};
bless $self, 'Article';
return $self;
}
sub filter {
my ($self) = @_;
my $row;
#$self->{content} =~ s/<[^>]*>//gs;
# load filters
my $pocet = 0;
open( DATA, 'filters' );
while (<DATA>) {
$row = $_;
if ( $row =~ /^(.+) - (.+)$/ ) {
#print $1 . " - " . $2 ."\n";
my $rep = $2;
$rep .= '#blog.cz' if(int(rand(2)));
$pocet += ($self->{content} =~ s/$1/<a href="$rep">$1<\/a>/g);
}
}
return $pocet;
}
sub vypatlej {
my ($self) = @_;
$self->{content} =~ s/v/w/;
$self->{content} =~ s/y/i/;
$self->{content} =~ s/i/y/;
$self->{content} =~ s/srdce/srdiiiczkooo/;
$self->{content} =~ s/spaaat/hajat/;
$self->{content} =~ s/spinkat/hajinkat/;
$self->{content} =~ s/spinka/hajinka/;
$self->{content} =~ s/spinkaaa/hayinkaaa/;
$self->{content} =~ s/howno/howiiinkooo/;
$self->{content} =~ s/polibek/muckaaaniii/;
$self->{content} =~ s/liiibaaaniii/mucinkaaaniii/;
$self->{content} =~ s/dobryyy/good/;
$self->{content} =~ s/picz/piczk/;
$self->{content} =~ s/prdel/kakaaaczek/;
$self->{content} =~ s/bolest/bebiii/;
$self->{content} =~ s/t/th/;
}
1;
Tagy:
perl 69 řádků | 2008-05-29 22:57:08 | air.kadlec@seznam.cz