| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package BalanceOfPower::Printer; | 
| 2 |  |  |  |  |  |  | $BalanceOfPower::Printer::VERSION = '0.400115'; | 
| 3 | 13 |  |  | 13 |  | 7052 | use Template; | 
|  | 13 |  |  |  |  | 227616 |  | 
|  | 13 |  |  |  |  | 458 |  | 
| 4 | 13 |  |  | 13 |  | 97 | use Cwd 'abs_path'; | 
|  | 13 |  |  |  |  | 19 |  | 
|  | 13 |  |  |  |  | 2815 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | sub print | 
| 7 |  |  |  |  |  |  | { | 
| 8 | 2 |  |  | 2 | 0 | 5 | my $mode = shift; | 
| 9 | 2 |  |  |  |  | 3 | my $world = shift; | 
| 10 | 2 |  |  |  |  | 6 | my $template = shift; | 
| 11 | 2 |  |  |  |  | 5 | my $vars = shift; | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 2 |  |  |  |  | 4 | my $module_file_path = __FILE__; | 
| 14 | 2 |  |  |  |  | 131 | my $root_path = abs_path($module_file_path); | 
| 15 | 2 |  |  |  |  | 16 | $root_path =~ s/Printer\.pm//; | 
| 16 | 2 |  |  |  |  | 6 | $root_path .= "templates"; | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 2 |  |  |  |  | 109 | my $tt = Template->new({INCLUDE_PATH => "$root_path/$mode", | 
| 19 |  |  |  |  |  |  | PLUGIN_BASE => 'Template::Plugin::Filter'}); | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 2 | 50 |  |  |  | 47950 | if(ref $world eq 'BalanceOfPower::World') | 
| 22 |  |  |  |  |  |  | { | 
| 23 | 2 |  |  |  |  | 7 | my %nation_codes = reverse %{$world->nation_codes}; | 
|  | 2 |  |  |  |  | 35 |  | 
| 24 | 2 |  |  |  |  | 8 | $vars->{'nation_codes'} = \%nation_codes; | 
| 25 |  |  |  |  |  |  | } | 
| 26 | 2 |  |  |  |  | 4 | my $output; | 
| 27 | 2 | 50 |  |  |  | 17 | $tt->process("$template.tt", $vars, \$output) || die $tt->error . "\n"; | 
| 28 | 0 |  |  |  |  |  | return $output; | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | 1; | 
| 32 |  |  |  |  |  |  |  |