summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/NEXT/t/stringify.t
blob: a3813d312eaeb81e3a4fdbcb8f104cfed642e030 (plain) (blame)
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
use warnings;
use strict;
use Test::More tests => 2;

BEGIN { use_ok('NEXT') };


package Foo;

use overload '""' => 'stringify';

use constant BAR => (1..5);

sub new { bless {}, shift }

sub stringify {
    my $self = shift;
    my %result = $self->EVERY::LAST::BAR;
    join '-' => @{ $result{'Foo::BAR'} };
}



package main;

my $foo = Foo->new;
is("$foo", '1-2-3-4-5', 'overloading stringification');