| 3 |
# $Id$ |
# $Id$ |
| 4 |
# |
# |
| 5 |
# $Log$ |
# $Log$ |
| 6 |
|
# Revision 1.3 2002/07/19 18:13:50 cvsjoko |
| 7 |
|
# no message |
| 8 |
|
# |
| 9 |
# Revision 1.2 2002/06/27 02:14:22 cvsjoko |
# Revision 1.2 2002/06/27 02:14:22 cvsjoko |
| 10 |
# + stripHtml stripSpaces stripNewLines toReal |
# + stripHtml stripSpaces stripNewLines toReal |
| 11 |
# |
# |
| 20 |
require Exporter; |
require Exporter; |
| 21 |
@ISA = qw( Exporter ); |
@ISA = qw( Exporter ); |
| 22 |
@EXPORT = qw( |
@EXPORT = qw( |
| 23 |
Dumper |
Dumper |
| 24 |
md5 md5_hex md5_base64 |
md5 md5_hex md5_base64 |
| 25 |
ParseDate UnixDate |
ParseDate UnixDate |
| 26 |
|
strftime |
| 27 |
stripHtml stripSpaces stripNewLines toReal |
stripHtml stripSpaces stripNewLines toReal trim |
| 28 |
|
croak |
| 29 |
|
array_getDifference |
| 30 |
); |
); |
| 31 |
|
|
| 32 |
use strict; |
use strict; |
| 41 |
require LWP::UserAgent; |
require LWP::UserAgent; |
| 42 |
use HTML::PullParser; |
use HTML::PullParser; |
| 43 |
|
|
| 44 |
|
# $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime; |
| 45 |
|
# see "perldoc -f localtime" |
| 46 |
|
use POSIX qw(strftime); |
| 47 |
|
|
| 48 |
|
use Carp; |
| 49 |
|
|
| 50 |
|
|
| 51 |
######################################## |
######################################## |
| 52 |
|
|
| 59 |
return $text; |
return $text; |
| 60 |
} |
} |
| 61 |
|
|
| 62 |
|
sub trim { |
| 63 |
|
my $string = shift; |
| 64 |
|
return stripSpaces($string); |
| 65 |
|
} |
| 66 |
|
|
| 67 |
sub stripNewLines { |
sub stripNewLines { |
| 68 |
my $text = shift; |
my $text = shift; |
| 69 |
#print "text: $text", "\n"; |
#print "text: $text", "\n"; |
| 97 |
return $result; |
return $result; |
| 98 |
} |
} |
| 99 |
|
|
| 100 |
|
sub array_getRelations { |
| 101 |
|
my $a_ref = shift; |
| 102 |
|
my $b_ref = shift; |
| 103 |
|
my @a = @{$a_ref}; |
| 104 |
|
my @b = @{$b_ref}; |
| 105 |
|
|
| 106 |
|
my @isect = my @diff = my @union = (); |
| 107 |
|
my $e; |
| 108 |
|
my %count; |
| 109 |
|
|
| 110 |
|
foreach $e (@a, @b) { $count{$e}++ } |
| 111 |
|
|
| 112 |
|
foreach $e (keys %count) { |
| 113 |
|
push(@union, $e); |
| 114 |
|
push @{ $count{$e} == 2 ? \@isect : \@diff }, $e; |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
my $result = { |
| 118 |
|
union => \@union, |
| 119 |
|
isect => \@isect, |
| 120 |
|
diff => \@diff, |
| 121 |
|
}; |
| 122 |
|
|
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
sub array_getDifference { |
| 126 |
|
my $res = array_getRelations(shift, shift); |
| 127 |
|
return $res->{diff}; |
| 128 |
|
} |
| 129 |
|
|
| 130 |
1; |
1; |