X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FFeed.pm;h=6996f374e555a4f55d565fda80fe3b119369e3b0;hb=ec1d0105e6f758ced83902b92b25df0c4b75613d;hp=ad058395ce6c19294d832fc91ee1a162ebce9611;hpb=0f03ff48b643a3b04bc44d2e1af27bd7dafd56c1;p=public-inbox.git diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index ad058395..6996f374 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -9,12 +9,10 @@ use Date::Parse qw(strptime str2time); use PublicInbox::Hval; use PublicInbox::GitCatFile; use constant { - DATEFMT => '%Y-%m-%dT%H:%M:%SZ', - MAX_PER_PAGE => 25, + DATEFMT => '%Y-%m-%dT%H:%M:%SZ', # atom standard + MAX_PER_PAGE => 25, # this needs to be tunable }; -# FIXME: workaround https://rt.cpan.org/Public/Bug/Display.html?id=22817 - # main function sub generate { my ($class, $args) = @_; @@ -23,7 +21,6 @@ sub generate { require POSIX; my $max = $args->{max} || MAX_PER_PAGE; - local $ENV{GIT_DIR} = $args->{git_dir}; my $feed_opts = get_feedopts($args); my $addr = $feed_opts->{address}; $addr = $addr->[0] if ref($addr); @@ -44,15 +41,16 @@ sub generate { my ($add) = @_; add_to_feed($feed_opts, $feed, $add, $git); }); + $git = undef; # destroy pipes + Email::Address->purge_cache; $feed->as_string; } sub generate_html_index { my ($class, $args) = @_; - require Mail::Thread; + require PublicInbox::Thread; my $max = $args->{max} || MAX_PER_PAGE; - local $ENV{GIT_DIR} = $args->{git_dir}; my $feed_opts = get_feedopts($args); my $title = $feed_opts->{description} || ''; @@ -70,8 +68,9 @@ sub generate_html_index { push @messages, $mime; 1; }); + $git = undef; # destroy pipes. - my $th = Mail::Thread->new(@messages); + my $th = PublicInbox::Thread->new(@messages); $th->thread; my $html = "$title" . '
$footer
" if $footer; $html . "$footer"; @@ -130,7 +131,8 @@ sub each_recent_blob { # get recent messages # we could use git log -z, but, we already know ssoma will not # leave us with filenames with spaces in them.. - my @cmd = qw/git log --no-notes --no-color --raw -r/; + my @cmd = ('git', "--git-dir=$args->{git_dir}", + qw/log --no-notes --no-color --raw -r/); push @cmd, $range; my $pid = open(my $log, '-|', @cmd) or @@ -241,7 +243,7 @@ sub add_to_feed { defined $mid or return 0; $mid = PublicInbox::Hval->new_msgid($mid); my $href = $mid->as_href . '.html'; - my $content = PublicInbox::View->as_feed_entry($mime, $fullurl . $href); + my $content = PublicInbox::View->feed_entry($mime, $fullurl . $href); defined($content) or return 0; my $subject = mime_header($mime, 'Subject') or return 0; @@ -297,7 +299,7 @@ sub dump_html_line { sub do_cat_mail { my ($git, $path) = @_; my $str = $git->cat_file("HEAD:$path"); - Email::MIME->new($$str); + Email::MIME->new($str); } 1;