From 0fb7944c058712bf47a5e428c063550b18dffabb Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 1 Oct 2008 14:37:48 +0000 Subject: some uniqs git-svn-id: svn://luxion/repos/WebCoso/trunk@384 fcb26f47-9200-0410-b104-b98ab5b095f3 --- lib/WebCoso/Common.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/WebCoso/Common.pm') diff --git a/lib/WebCoso/Common.pm b/lib/WebCoso/Common.pm index 14b85c8..f36e924 100644 --- a/lib/WebCoso/Common.pm +++ b/lib/WebCoso/Common.pm @@ -7,6 +7,7 @@ use XML::LibXML::XPathContext; use DateTime; use DateTime::Format::DateParse; use Log::Log4perl ':easy'; +use List::MoreUtils 'uniq'; our $SRCPATH='src'; our $DSTPATH='dst'; @@ -122,7 +123,7 @@ sub getDates { my ($fc,@docs)=@_; my %dates; - for my $doc_name (@docs) { + for my $doc_name (uniq(@docs)) { my $doc=$fc->get($doc_name); my ($creation_date)=map {$_->textContent} $xpath->findnodes( @@ -140,7 +141,7 @@ sub getTags { my ($fc,@docs)=@_; my %tagged; - for my $doc_name (@docs) { + for my $doc_name (uniq(@docs)) { my $doc=$fc->get($doc_name); my @tags=map {$_->textContent} $xpath->findnodes( @@ -167,7 +168,7 @@ sub fromTo { else { push @ret,$file while $file=$iter->(); } - return @ret; + return uniq(@ret); } { @@ -201,7 +202,7 @@ sub keepEarliest { push @ret,file($d,"document.$lang.$type")->stringify; } } - return @ret; + return uniq(@ret); } } -- cgit v1.2.3