diff options
author | Eric Wong <e@80x24.org> | 2014-04-07 20:26:42 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-04-07 20:26:42 +0000 |
commit | 7c69497a0126cd613053d881d63586bead07dd0e (patch) | |
tree | 7c9a3b7b143676da6d47b1a420d574e35df0e42c /lib/PublicInbox/Feed.pm | |
parent | bc205de3d5472c67208440d34089cc5bd6792278 (diff) | |
download | public-inbox-7c69497a0126cd613053d881d63586bead07dd0e.tar.gz |
Passing a giant argument list is to error prone and hard-to-document.
Diffstat (limited to 'lib/PublicInbox/Feed.pm')
-rw-r--r-- | lib/PublicInbox/Feed.pm | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index e282dc74..3ac77174 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -16,13 +16,13 @@ use constant DATEFMT => '%Y-%m-%dT%H:%M:%SZ'; use PublicInbox::View; # main function -# FIXME: takes too many args, cleanup sub generate { - my ($class, $git_dir, $max, $pi_config, $listname, $cgi, $top) = @_; - $max ||= 25; + my ($class, $args) = @_; + my $max = $args->{max} || 25; + my $top = $args->{top}; # bool - local $ENV{GIT_DIR} = $git_dir; - my $feed_opts = get_feedopts($pi_config, $listname, $cgi); + local $ENV{GIT_DIR} = $args->{git_dir}; + my $feed_opts = get_feedopts($args); my $feed = XML::Atom::SimpleFeed->new( title => $feed_opts->{description} || "unnamed feed", @@ -63,8 +63,12 @@ sub generate { # private functions below sub get_feedopts { - my ($pi_config, $listname, $cgi) = @_; + my ($args) = @_; + my $pi_config = $args->{pi_config}; + my $listname = $args->{listname}; + my $cgi = $args->{cgi}; my %rv; + if ($pi_config && defined $listname && length $listname) { foreach my $key (qw(description address)) { $rv{$key} = $pi_config->get($listname, $key); |