1use Sub::Install qw(install_sub);
2use Test::More 'no_plan';
3
4use strict;
5use warnings;
6
7sub source_method {
8  my ($package) = @_;
9  return $package;
10}
11
12{ # install named method and let the name be the same
13  install_sub({ code => "source_method", into => "By::Name" });
14
15  is(
16    By::Name->source_method,
17    'By::Name',
18    "method installed by name"
19  );
20}
21
22{ # install via a coderef and let name be looked up
23  install_sub({ code => \&source_method, into => "By::Ref" });
24
25  is(
26    By::Ref->source_method,
27    'By::Ref',
28    "method installed by ref, without name"
29  );
30}
31