Skip to content

Commit

Permalink
Add tt_lib to the template search path.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Jul 29, 2015
1 parent 85ccee4 commit 573428a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bin/invoice
Expand Up @@ -7,6 +7,7 @@ use lib '/home/dave/Dropbox/magnum/lib';

use Template;
use POSIX 'strftime';
use FindBin '$Bin';
use Magnum::Schema;

my $inv_no = shift || die "No invoice number given\n";
Expand All @@ -17,7 +18,10 @@ my $inv_rs = $sch->resultset('Invoice');
my $inv = $inv_rs->find($inv_no)
|| die "Invoice $inv_no not found\n";

my $t = Template->new({ ENCODING => 'UTF-8' });
my $t = Template->new({
ENCODING => 'UTF-8',
INCLUDE_PATH => "$Bin/../tt_lib",
});

my $vars = { inv => $inv };

Expand Down
7 changes: 6 additions & 1 deletion bin/timesheet
Expand Up @@ -9,6 +9,7 @@ use lib '/home/dave/Dropbox/magnum/lib';
use Template;
use POSIX 'strftime';
use DateTime;
use FindBin '$Bin';
use Magnum::Schema;

@ARGV == 3 or die "Usage: timesheet [contract] [year] [month]\n";
Expand All @@ -33,7 +34,11 @@ my @weeks = $contract->weeks->search({

my $fname = 'timesheet-' . $first_of_month->strftime('%Y-%m');

my $t = Template->new({ ENCODING => 'UTF-8' });
my $t = Template->new({
ENCODING => 'UTF-8',
INCLUDE_PATH => "$Bin/../tt_lib",
});

$t->process(
'timesheet.tt',
{ weeks => \@weeks },
Expand Down

0 comments on commit 573428a

Please sign in to comment.