Liquid/Tag/Break.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 2 totaltotal 82.0% 32 / 39 CC 4 SCAR 8.7
CC
4
Cov
87%
new
4.5
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
« Liquid/Tag/Comment.pm ↑ Summary Liquid/Utility.pm »
1 package Template::Liquid::Tag::Break;
2 25 our $VERSION = '1.0.23';
3 25 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 25 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 25 require Template::Liquid::Error;
6 25 require Template::Liquid::Utility;
7 25 ▶BEGIN { use base 'Template::Liquid::Tag'; }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
8 25 ▶sub import { Template::Liquid::register_tag('break') }
Subroutine import: called CC=1 SCAR=0.0
9  
10 14 ▶sub new {
Subroutine new: called CC=4 SCAR=15.0
Pod undocumented
11 14 my ($class, $args) = @_;
12 raise Template::Liquid::Error {type => 'Context',
13 template => $args->{template},
14 message => 'Missing template argument',
15 fatal => 1
16 }
17 14 ▶ if !defined $args->{'template'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args->{"template"} 0 14 14
18 raise Template::Liquid::Error {type => 'Context',
19 template => $args->{template},
20 message => 'Missing parent argument',
21 fatal => 1
22 }
23 14 ▶ if !defined $args->{'parent'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $args->{"parent"} 0 14 14
24 14 ▶ if ($args->{'attrs'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"attrs"}) 0 14 14
25 raise Template::Liquid::Error {
26 template => $args->{template},
27 type => 'Syntax',
28 0 message => 'Bad argument list in ' . $args->{'markup'},
29 fatal => 1
30 };
31 }
32 my $s = bless {name => '#-' . $1,
33 nodelist => [],
34 tag_name => $args->{'tag_name'},
35 template => $args->{'template'},
36 parent => $args->{'parent'},
37 14 markup => $args->{'markup'}
38 }, $class;
39 14 return $s;
40 }
41  
42 4 ▶sub render {
Subroutine render: called CC=1 SCAR=0.0
Pod undocumented
43 4 my $s = shift;
44 4 $s->{template}->{break} = 1;
45 4 return '';
46 }
47 25 1;
48  
49 =pod
50  
51 =encoding UTF-8
52  
53 =begin stopwords
54  
55 Lütke jadedPixel
56  
57 =end stopwords
58  
59 =head1 NAME
60  
61 Template::Liquid::Tag::Break - For-block killing construct
62  
63 =head1 Synopsis
64  
65 {% for item in collection %}
66 {% if item.condition %}
67 {% break %}
68 {% endif %}
69 {% endfor %}
70  
71 =head1 Description
72  
73 You can use the C<{% break %}> tag to break out of the enclosing
74 L<for|Template::Liquid::Tag::For> block. Every for block is implicitly ended
75 with a break.
76  
77 =head1 See Also
78  
79 Liquid for Designers: http://wiki.github.com/tobi/liquid/liquid-for-designers
80  
81 L<Template::Liquid|Template::Liquid/"Create your own filters">'s docs on custom
82 filter creation
83  
84 =head1 Author
85  
86 Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
87  
88 The original Liquid template system was developed by jadedPixel
89 (http://jadedpixel.com/) and Tobias Lütke (http://blog.leetsoft.com/).
90  
91 =head1 License and Legal
92  
93 Copyright (C) 2009-2022 by Sanko Robinson E<lt>sanko@cpan.orgE<gt>
94  
95 This program is free software; you can redistribute it and/or modify it under
96 the terms of The Artistic License 2.0. See the F<LICENSE> file included with
97 this distribution or http://www.perlfoundation.org/artistic_license_2_0. For
98 clarification, see http://www.perlfoundation.org/artistic_2_0_notes.
99  
100 When separated from the distribution, all original POD documentation is covered
101 by the Creative Commons Attribution-Share Alike 3.0 License. See
102 http://creativecommons.org/licenses/by-sa/3.0/us/legalcode. For clarification,
103 see http://creativecommons.org/licenses/by-sa/3.0/us/.
104  
105 =cut
« Liquid/Tag/Comment.pm ↑ Summary Liquid/Utility.pm »