File: 098_multiple-attributes.t

package info (click to toggle)
libpetal-perl 2.23-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,088 kB
  • ctags: 162
  • sloc: perl: 4,738; xml: 726; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 778 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl

package thing;

sub new
{
    my $class = shift;
    $class = ref $class || $class;
    my $self = bless {}, $class;
    return $self;
}

sub method
{
   my $self = shift;
   join ':', @_;
}

package main;

use warnings;
use strict;
use lib ('lib');
use Test::More 'no_plan';
use Petal;

$|=1;

$Petal::BASE_DIR     = './t/data/';
$Petal::DISK_CACHE   = 0;
$Petal::MEMORY_CACHE = 0;
$Petal::TAINT        = 1;

my $template_file = 'multiple-attributes.xml';
my $template      = new Petal ($template_file);

sub joinme {join ':', @_}
my $object = new thing;
my %hash = ( foo => 'bar' );

my $string        = $template->process (object => $object, coderef => \&joinme, hash => \%hash);

like ($string, '/harpo:chico/');
like ($string, '/groucho:zeppo/');

__END__