Changeset 31

Show
Ignore:
Timestamp:
02/05/06 20:13:06
Author:
miyagawa
Message:

* Publish::JavaScript? to create .js include file per feed.
* Better error handling in templates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger.pm

    r20 r31  
    6868    $module =~ s/^Plagger::Plugin:://; 
    6969    $module = "Plagger::Plugin::$module"; 
    70     $module->require or warn $@; 
     70    $module->require or die $@; 
    7171 
    7272    $self->log(info => "plugin $module loaded."); 
     
    127127sub error { 
    128128    my($self, $msg) = @_; 
    129     my $caller = caller(0); 
     129    my($caller, $filename, $line) = caller(0); 
    130130    chomp($msg); 
    131     die "$caller $msg\n"; 
     131    die "$caller [fatal] $msg at line $line\n"; 
    132132} 
    133133 
  • trunk/plagger/lib/Plagger/Plugin/Publish/Gmail.pm

    r27 r31  
    7979    my($self, $body) = @_; 
    8080    return <<HTML; 
     81<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
    8182<html> 
    8283<head> 
     
    9798        item => $item, 
    9899        cfg  => $self->conf, 
    99     }, \my $out) or die $tt->error
     100    }, \my $out) or $context->error($tt->error)
    100101    $out; 
    101102} 
  • trunk/plagger/lib/Plagger/Plugin/Publish/PSP.pm

    r27 r31  
    2727 
    2828    my $body = $self->templatize($context, $self->{__feeds}); 
    29     my $cfg  = $self->conf; 
    30     my $file = $cfg->{output_file}; 
     29    my $file = $self->conf->{output_file}; 
    3130 
    32     open(FH, ">:utf8", $file) or die $!
    33     print FH $body; 
    34     close (FH)
     31    open my $out, ">:utf8", $file or $context->error("$file: $!")
     32    print $out $body; 
     33    close $out
    3534} 
    3635 
     
    4039    $tt->process('psp.tt', { 
    4140        feeds => $feeds, 
    42     }, \my $out) or die $tt->error
     41    }, \my $out) or $context->error($tt->error)
    4342    $out; 
    4443}