CondBlock.pm 599B

12345678910111213141516171819202122232425262728293031323334353637
  1. package SugarTrail::Template::CondBlock;
  2. # condition block
  3. # init()
  4. # parse(string)
  5. # matches(data)
  6. use strict;
  7. use warnings;
  8. use SugarTrail::Template::Condition;
  9. use Data::Dumper;
  10. sub init {
  11. my $class = shift;
  12. my $self = {};
  13. return bless $self, $class;
  14. }
  15. sub parse {
  16. my $self = shift;
  17. my $string = shift;
  18. my @parts = split ";", $string;
  19. foreach (@parts) {
  20. my $c = SugarTrail::Template::Condition->new($_);
  21. push @{$self->{conds}}, $c;
  22. }
  23. return scalar @{ $self->{conds} };
  24. }
  25. sub match {
  26. my $self = shift;
  27. my $args = shift;
  28. }
  29. 1;