1=pod 2 3=encoding utf-8 4 5=head1 PURPOSE 6 7Test Exporter::Tiny exporting non-code symbols. 8 9=head1 AUTHOR 10 11Toby Inkster E<lt>tobyink@cpan.orgE<gt>. 12 13=head1 COPYRIGHT AND LICENCE 14 15This software is copyright (c) 2018 by Toby Inkster. 16 17This is free software; you can redistribute it and/or modify it under 18the same terms as the Perl 5 programming language system itself. 19 20=cut 21 22use strict; 23use warnings; 24use Test::More tests => 7; 25 26BEGIN { 27 package My::Exporter; 28 use Exporter::Shiny qw( $Foo @Bar %Baz ); 29 our $Foo = 42; 30 our @Bar = (1, 2, 3); 31 our %Baz = (quux => 'xyzzy'); 32}; 33 34BEGIN { 35 package My::Importer; 36 use My::Exporter -all; 37}; 38 39is($My::Importer::Foo, 42, 'importing scalar'); 40is_deeply(\@My::Importer::Bar, [1,2,3], 'importing array'); 41is_deeply(\%My::Importer::Baz, { quux => 'xyzzy' }, 'importing hash'); 42 43$My::Importer::Foo /= 2; 44push @My::Importer::Bar, 4; 45$My::Importer::Baz{quuux} = 'blarg'; 46 47is($My::Exporter::Foo, 21, 'importing scalar does not copy'); 48is_deeply(\@My::Exporter::Bar, [1,2,3,4], 'importing array does not copy'); 49is_deeply(\%My::Exporter::Baz, { quux => 'xyzzy', quuux => 'blarg' }, 'importing hash does not copy'); 50 51my $into = {}; 52My::Exporter->import({ into => $into }, qw( $Foo @Bar %Baz )); 53is_deeply($into, { '$Foo' => \21, '@Bar' => [1..4], '%Baz' => {qw/quux xyzzy quuux blarg/} }, 'importing non-code symbols into hashrefs'); 54