Commit e103c8d451c80a292ab2d1f0075bde843d47db69
1 parent
bcaff68d
Exists in
master
and in
2 other branches
refactoring subroutines
Showing
1 changed file
with
12 additions
and
11 deletions
Show diff stats
lib/CoprStatus.pm
@@ -111,16 +111,7 @@ sub info2html { | @@ -111,16 +111,7 @@ sub info2html { | ||
111 | } | 111 | } |
112 | 112 | ||
113 | sub build_html { | 113 | sub build_html { |
114 | - my $data = { | ||
115 | - title => "SPB Copr Status", | ||
116 | - table_entries => info2html() | ||
117 | - }; | ||
118 | - | ||
119 | - my $template = Text::Template->new( | ||
120 | - TYPE => 'FILE', | ||
121 | - SOURCE => 'template.html.tt' | ||
122 | - ); | ||
123 | - | 114 | + my ( $data, $template ) = @_; |
124 | return $template->fill_in(HASH => $data); | 115 | return $template->fill_in(HASH => $data); |
125 | } | 116 | } |
126 | 117 | ||
@@ -131,10 +122,20 @@ our %ROUTING = ( | @@ -131,10 +122,20 @@ our %ROUTING = ( | ||
131 | ); | 122 | ); |
132 | 123 | ||
133 | sub serve_html { | 124 | sub serve_html { |
125 | + my $data = { | ||
126 | + title => "SPB Copr Status", | ||
127 | + table_entries => info2html() | ||
128 | + }; | ||
129 | + | ||
130 | + my $template = Text::Template->new( | ||
131 | + TYPE => 'FILE', | ||
132 | + SOURCE => 'template.html.tt' | ||
133 | + ); | ||
134 | + | ||
134 | return [ | 135 | return [ |
135 | '200', | 136 | '200', |
136 | [ 'Content-Type' => 'text/html'], | 137 | [ 'Content-Type' => 'text/html'], |
137 | - [ build_html() ], | 138 | + [ build_html($data, $template) ], |
138 | ]; | 139 | ]; |
139 | }; | 140 | }; |
140 | 141 |