Petal-Utils-0.06/ 0000755 0001750 0001750 00000000000 10111374072 014714 5 ustar william william 0000000 0000000 Petal-Utils-0.06/t/ 0000755 0001750 0001750 00000000000 10111374072 015157 5 ustar william william 0000000 0000000 Petal-Utils-0.06/t/data/ 0000755 0001750 0001750 00000000000 10111374072 016070 5 ustar william william 0000000 0000000 Petal-Utils-0.06/t/data/22__limitr.html 0000444 0001750 0001750 00000000547 10107462626 020734 0 ustar william william 0000000 0000000
nolimit: limit1 limitr1: limit1 limitr2: limit2
Petal-Utils-0.06/t/data/23__create_href.html 0000444 0001750 0001750 00000000600 10107502007 021656 0 ustar william william 0000000 0000000create_href1: Link create_href2: Link create_href3: FTP Link create_href4: FTP Link
Petal-Utils-0.06/t/data/date.html 0000444 0001750 0001750 00000000656 10053116364 017703 0 ustar william william 0000000 0000000date = date date1 = 2003-09-05 date2 = 2003/09/05 date3 = 20030905 date4 = 20030905
Petal-Utils-0.06/t/data/logic.html 0000444 0001750 0001750 00000001454 10053116364 020060 0 ustar william william 0000000 0000000first = first second = second first_name = first_name first or second = or first and second = and first eq second = equal first_name like regex = like if first then first else second = if if second then first else second = if
Petal-Utils-0.06/t/data/21__limit.html 0000444 0001750 0001750 00000000542 10107462610 020535 0 ustar william william 0000000 0000000nolimit: limit1 limit1: limit1 limit2: limit2
Petal-Utils-0.06/t/data/uri.html 0000444 0001750 0001750 00000000465 10053116364 017563 0 ustar william william 0000000 0000000& ${uri_escape: $and} ' ' ${uri_escape: space} , ${uri_escape: comma} ; ${uri_escape: scolon} / ${uri_escape: slash} ? ${uri_escape: qmark} . ${uri_escape: dot}
Petal-Utils-0.06/t/data/26__printf.html 0000444 0001750 0001750 00000001332 10110430424 020714 0 ustar william william 0000000 0000000name of dog
printf2:# of children
printf3:bank acct
printf4:bank acct
printf5:bank acct
printf6:love
dump: dump
Petal-Utils-0.06/t/data/25__decode.html 0000444 0001750 0001750 00000003776 10110026457 020661 0 ustar william william 0000000 0000000decode1: this appears to do nothing; should we catch it and throw an error? decode2: false decode2a: false decode2b: false decode3: true decode4: return false decode5: false decode6: true decode7: false decode8: true decode9: true decode10: true decode11: true decode12: false decode13: true decode14: true decode15: true
Petal-Utils-0.06/t/data/list.html 0000444 0001750 0001750 00000000271 10053116364 017732 0 ustar william william 0000000 0000000sort: $key,
Petal-Utils-0.06/t/data/text.html 0000444 0001750 0001750 00000000455 10053116364 017747 0 ustar william william 0000000 0000000lc: lc uc: uc uc_first: uc_first
Petal-Utils-0.06/t/data/24__substr.html 0000444 0001750 0001750 00000000716 10107507416 020753 0 ustar william william 0000000 0000000substr1: string substr2: string substr3: string substr4: string with ellipsis substr5: string with ellipsis
Petal-Utils-0.06/t/08__uri.t 0000444 0001750 0001750 00000001356 10053116345 016616 0 ustar william william 0000000 0000000 #!/usr/bin/perl ## ## Tests for Petal::Utils :uri modifiers ## use blib; use strict; #use warnings; use Test::More qw( no_plan ); use Carp; use t::LoadPetal; use Petal::Utils qw( :uri ); my $hash = { and => 'this&that', space => 'this that', comma => 'this,that', scolon => 'this;that', slash => 'this/that', qmark => 'this?that', dot => 'this.that', }; my $template = Petal->new('uri.html'); my $out = $template->process( $hash ); # UriEscape like($out, qr/this\%26that/, '&'); like($out, qr/this\%20that/, "' '"); like($out, qr/this\%2Cthat/, ','); like($out, qr/this\%3Bthat/, ';'); like($out, qr/this\%2Fthat/, '/'); like($out, qr/this\%3Fthat/, '?'); like($out, qr/this\.that/, '.'); # that's enough proof for me. Petal-Utils-0.06/t/01__import.t 0000444 0001750 0001750 00000001311 10053117473 017314 0 ustar william william 0000000 0000000 #!/usr/bin/perl ## ## Tests for Petal::Utils->import ## use blib; use strict; #use warnings; use Test::More qw(no_plan); use Carp; # use_ok() doesn't let us avoid calling import() so: eval 'use Petal::Utils qw();'; is( $@, '', 'use Petal::Utils' ); eval 'use Petal::Utils qw( :none );'; is( $@, '', 'use set :none' ); eval 'use Petal::Utils qw( :default );'; is( $@, '', 'use set :default' ); eval 'use Petal::Utils qw( UpperCase );'; is( $@, '', 'use plugin UpperCase' ); { no warnings; eval 'use Petal::Utils qw( :non_existent );'; isnt( $@, '', 'error loading non-existent set' ); eval 'use Petal::Utils qw( non_existent );'; isnt( $@, '', 'error loading non-existent plugin' ); } Petal-Utils-0.06/t/25__Decode.t 0000444 0001750 0001750 00000002207 10110026416 017166 0 ustar william william 0000000 0000000 #!/usr/bin/perl ## ## Tests for Petal::Utils::Decode module ## use blib; use strict; use Test::More qw(no_plan); use Carp; use t::LoadPetal; use Petal::Utils qw( :logic :text ); my $str = "Flipper"; my $str2 = "Dipper"; my $template = Petal->new('25__decode.html'); my $out = $template->process( { str => $str, str2 => $str2, } ); like($out, qr/decode1:\s*\n/, 'decode1'); like($out, qr/decode2:\s*\n/, 'decode2'); like($out, qr/decode2a: Flipper\n/, 'decode2a'); like($out, qr/decode2b: Flip\n/, 'decode2b'); like($out, qr/decode3: true\n/, 'decode3 - true (1)'); like($out, qr/decode4:\s*\n/, 'decode4 - false (0)'); like($out, qr/decode5:\ false_string\n/, 'decode5 - false (false)'); like($out, qr/decode6: Metal\n/, 'decode6'); like($out, qr/decode7:\s*\n/, 'decode7'); like($out, qr/decode8: true\n/, 'decode8'); like($out, qr/decode9: true\n/, 'decode9'); like($out, qr/decode10: 100\n/, 'decode10'); like($out, qr/decode11: 250\n/, 'decode11'); like($out, qr/decode12:\s\n/, 'decode12'); like($out, qr/decode13: true\n/, 'decode13'); like($out, qr/decode14: 1.\n/, 'decode14'); like($out, qr/decode15: .1\n/, 'decode15'); Petal-Utils-0.06/t/LoadPetal.pm 0000444 0001750 0001750 00000000567 10053116345 017372 0 ustar william william 0000000 0000000 # Common code for loading Petal with default dir # load things into the caller's package use Petal; use File::Spec; my $base_dir = File::Spec->catdir(qw( t data )); # Petal's global settings $Petal::DISK_CACHE = 0; $Petal::MEMORY_CACHE = 0; $Petal::TAINT = 1; $Petal::BASE_DIR = $base_dir; $Petal::INPUT = "XHTML"; $Petal::OUTPUT = "XHTML"; 1; Petal-Utils-0.06/t/26__Printf.t 0000444 0001750 0001750 00000001415 10110426737 017260 0 ustar william william 0000000 0000000 #!/usr/bin/perl ## ## Tests for Petal::Utils::Printf module ## use blib; use strict; use Test::More qw(no_plan); use Carp; use Data::Dumper; use t::LoadPetal; use Petal::Utils qw( :logic :text ); my $children = [ qw(Elroy Judi) ]; my $template = Petal->new('26__printf.html'); my $out = $template->process( { dad => 'George', mom => 'Jane', dog => 'Astro', children => $children, children_count => scalar @$children, bank_balance => '201.5', } ); like($out, qr/printf1: Astro\n/, 'printf1'); like($out, qr/printf2: 02\n/, 'printf2'); like($out, qr/printf3: 201.50\n/, 'printf3'); like($out, qr/printf4: \$201.50\n/, 'printf4'); like($out, qr/printf5: Balance = \$201.50\n/, 'printf5'); like($out, qr/printf6: George and Jane\n/, 'printf6'); Petal-Utils-0.06/t/05__date.t 0000444 0001750 0001750 00000001276 10053116345 016732 0 ustar william william 0000000 0000000 #!/usr/bin/perl ## ## Tests for Petal::Utils :date modifiers ## use blib; use strict; #use warnings; use Test::More qw( no_plan ); use Carp; use t::LoadPetal; use Petal::Utils qw( :date ); my $hash = { date => 1, date1 => '2003-09-05', date2 => '2003/09/05', date3 => '20030905', }; my $template = Petal->new('date.html'); my $out = $template->process( $hash ); # Dates: like($out, qr|date = \w+\s+\d+ \d+ (?:\d+\:?)+|, 'date'); like($out, qr|date1 = 09/05/2003|, 'us_date'); like($out, qr|date2 = 09/05/2003|, 'us_date'); like($out, qr|date3 = 09/05/2003|, 'us_date'); TODO: { local $TODO = 'dynamically set date separator'; like($out, qr|date4 = 09-05-2003|, 'us_date'); } Petal-Utils-0.06/t/06__list.t 0000444 0001750 0001750 00000000561 10053116345 016765 0 ustar william william 0000000 0000000 #!/usr/bin/perl ## ## Tests for Petal::Utils :list modifiers ## use blib; use strict; #use warnings; use Test::More qw( no_plan ); use Carp; use t::LoadPetal; use Petal::Utils qw( :list ); my $hash = { array_ref => [ 1..3 ], }; my $template = Petal->new('list.html'); my $out = $template->process( $hash ); # Sort like($out, qr/sort:.+?1.+2.+3/, 'sort'); Petal-Utils-0.06/t/23__Create_Href.t 0000444 0001750 0001750 00000001277 10107502447 020167 0 ustar william william 0000000 0000000 #!/usr/bin/perl ## ## Tests for Petal::Utils::CreateHref module ## use blib; use strict; use Test::More qw(no_plan); use Carp; use t::LoadPetal; use Petal::Utils qw( :uri ); my $url1 = 'http://www.foo.com'; my $url2 = 'www.foo.com'; my $url3 = 'ftp://ftp.foo.com'; my $url4 = 'ftp.foo.com'; my $template = Petal->new('23__create_href.html'); my $out = $template->process( { url1 => $url1, url2 => $url2, url3 => $url3, url4 => $url4, } ); like($out, qr!create_href1: