On Sun Nov 08 17:43:49 2020, spamaway0@gmail.com wrote:
Show quoted text> use strict;
> package Foo::Bar;
> use Object::Tiny qw{ };
>
> sub new {
> my $class = shift;
> my $self = $class->SUPER::new( @_ );
> return $self;
> }
> package main;
>
> my $object = Foo::Bar->new();
>
> perl bug.pl
> Can't locate object method "new" via package "Foo::Bar" at bug.pl line 7.
> The above error is caused by having an empty accessor list.
This is not an issue with Object::Tiny, but just how use works. Specifying qw{ } is the same as (), an empty list, which skips calling Object::Tiny's import method. If you don't want any accessors, the correct code would be "use Object::Tiny;"