Skip to content

Commit

Permalink
Merge pull request #11 from moritz/slurp-deprecated
Browse files Browse the repository at this point in the history
Get rid of deprecated $fh.slurp
  • Loading branch information
Tadeusz Sośnierz committed Jan 17, 2015
2 parents 73f68ce + a4ffa55 commit 542830e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
15 changes: 5 additions & 10 deletions lib/Template/Mojo.pm
Expand Up @@ -93,8 +93,7 @@ A templating system modeled after the Perl 5 L<https://metacpan.org/module/Mojo:
=head1 Synopsis
my $fh = open 'eg/template.tm', :r;
my $tmpl = $fh.slurp;
my $tmpl = slurp 'eg/template.tm';
my $t = Template::Mojo.new($tmpl);
$t.render()
Expand All @@ -111,8 +110,7 @@ A templating system modeled after the Perl 5 L<https://metacpan.org/module/Mojo:
=head3 Code
my $fh = open 'eg/template.tm', :r;
my $tmpl = $fh.slurp;
my $tmpl = slurp 'eg/template.tm';
my $t = Template::Mojo.new($tmpl);
$t.render()
Expand Down Expand Up @@ -141,8 +139,7 @@ See, on the first row of the template we accept a parameter as if this was a gen
The value to that subroutione can be passed in the render call:
my $fh = open 'eg/template.tm', :r;
my $tmpl = $fh.slurp;
my $tmpl = slurp 'eg/template.tm';
my $t = Template::Mojo.new($tmpl);
$t.render(5)
Expand Down Expand Up @@ -172,8 +169,7 @@ The value to that subroutione can be passed in the render call:
lname => 'Bar',
);
my $fh = open 'eg/template.tm', :r;
my $tmpl = $fh.slurp;
my $tmpl = slurp 'eg/template.tm';
my $t = Template::Mojo.new($tmpl);
$t.render(%params)
Expand Down Expand Up @@ -212,8 +208,7 @@ The value to that subroutione can be passed in the render call:
],
);
my $fh = open 'eg/template.tm', :r;
my $tmpl = $fh.slurp;
my $tmpl = slurp 'eg/template.tm';
my $t = Template::Mojo.new($tmpl);
$t.render(%params)
Expand Down
6 changes: 2 additions & 4 deletions t/01-template.t
Expand Up @@ -24,8 +24,7 @@ my @cases = (
plan @cases.elems;

for @cases -> $c {
my $fh = open "eg/$c<name>.tm", :r;
my $tmpl = $fh.slurp;
my $tmpl = slurp "eg/$c<name>.tm";
#diag $tmpl;
my $output;
if $c<params> {
Expand All @@ -43,8 +42,7 @@ for @cases -> $c {
$out.close;
}

my $fh2 = open "eg/$c<name>.out", :r;
my $expected = $fh2.slurp;
my $expected = slurp "eg/$c<name>.out";
is $output, $expected, $c<name>;
}

6 changes: 2 additions & 4 deletions t/02-complex.t
Expand Up @@ -21,8 +21,7 @@ plan 1;

#diag %params.perl;

my $fh = open "eg/complex.tm", :r;
my $tmpl = $fh.slurp;
my $tmpl = slurp "eg/complex.tm";
#diag $tmpl;
my $output = Template::Mojo.new($tmpl).render(%params);
#diag $output;
Expand All @@ -35,7 +34,6 @@ if 0 {
$out.close;
}

my $fh2 = open "eg/complex.out", :r;
my $expected = $fh2.slurp;
my $expected = slurp "eg/complex.out";
is $output, $expected, 'complex';

0 comments on commit 542830e

Please sign in to comment.