xref: /openbsd-src/gnu/usr.bin/perl/cpan/NEXT/t/stringify.t (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1use warnings;
2use strict;
3use Test::More tests => 2;
4
5BEGIN {
6    if ($ENV{PERL_CORE}) {
7        chdir('t') if -d 't';
8        @INC = qw(../lib);
9    }
10}
11
12BEGIN { use_ok('NEXT') };
13
14
15package Foo;
16
17use overload '""' => 'stringify';
18
19use constant BAR => (1..5);
20
21sub new { bless {}, shift }
22
23sub stringify {
24    my $self = shift;
25    my %result = $self->EVERY::LAST::BAR;
26    join '-' => @{ $result{'Foo::BAR'} };
27}
28
29
30
31package main;
32
33my $foo = Foo->new;
34is("$foo", '1-2-3-4-5', 'overloading stringification');
35
36