package RSSFeedsPlugin;
use strict;
-use warnings; no warnings qw(experimental::signatures);
+use warnings;
+no warnings qw(experimental::signatures);
use feature qw(signatures);
use Scalar::Util qw(looks_like_number);
use Syntax::Keyword::Try;
use Benchmark;
-use constant VERSION => '1.0';
+use constant VERSION => '1.1';
# require CNFNode;
# require CNFDateTime;
return bless $settings, $class
}
+
+
###
# Process config data to contain expected fields.
###
my $table = $parser->data()->{$property};
if(!$table){
- $parser->error("RSSFeedsPlugin\@Error Table property not foun -> $property"); return
+ $parser->error("RSSFeedsPlugin\@Error Table property not found -> $property"); return
}
my $cgi = $parser->const('CGI');
$self->{date} = now();
my @col = @{$data[$idx]};
my $name = $col[$hdr{Name}];
next if($feed && $feed ne $name);
- my $tree = fetchFeed($self, $name, $col[$hdr{URL}], $col[$hdr{Description}]);
+ my $tree = fetchFeed($self, $name, $col[$hdr{URL}], $col[$hdr{Expires}], $col[$hdr{Description}]);
$parser->log("Fetched feed:".$name);
if($tree && ref($$tree) eq 'CNFNode'){
if(not isCNFTrue($self->{CNF_TREE_LOADED}) && isCNFTrue($self->{CNF_TREE_STORE})){
return $output_local
}
-sub fetchFeed($self,$name,$url,$description){
+sub fetchFeed($self, $name, $url, $expires, $description){
my ($MD, $tree, $brew,$bench);
my $console = isCNFTrue($self->{OUTPUT_TO_CONSOLE});
if(-e $fname) {
my $now = new Date::Manip::Date -> new_date(); $now->parse("today");
my $fdate = new Date::Manip::Date;
- my $fsepoch = (stat($fname))[9]; $fdate->parse("epoch $fsepoch"); $fdate->parse("3 business days");
+ $expires = "3 business days" if not $expires;
+ my $fsepoch = (stat($fname))[9]; $fdate->parse("epoch $fsepoch"); $fdate->parse($expires);
my $delta = $fdate->calc($now);
$self->{CNF_TREE_LOADED} = 0;
if($now->cmp($fdate)>0){
));
my $central = $cnf->property('DB_CENTRAL');
my $db = CNFSQL::_connectDB('test','test',$central->{DBI_SQL_SOURCE},$central->{DB}.'.db');
- my $sql = $cnf->SQL();
+ $sql = $cnf->SQL();
$sql -> {data } = $sql->{parser}->data();
#$sql -> initDatabase($db,0,{'TBL_A' => ['TBL_A_DATA','name','ID']});
$sql -> initDatabase($db,0);