Skip Menu |

This queue is for tickets about the Object-Tiny CPAN distribution.

Report information
The Basics
Id: 133705
Status: open
Priority: 0/
Queue: Object-Tiny

People
Owner: Nobody in particular
Requestors: spamaway0 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in Object::Tiny
Date: Sun, 8 Nov 2020 14:43:34 -0800
To: bug-Object-Tiny [...] rt.cpan.org
From: Eric Borduas <spamaway0 [...] gmail.com>
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.
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;"
Subject: Re: [rt.cpan.org #133705] Bug in Object::Tiny
Date: Mon, 9 Nov 2020 09:03:30 -0800
To: bug-Object-Tiny [...] rt.cpan.org
From: Eric Borduas <spamaway0 [...] gmail.com>
Got it, thanks! On Sun, Nov 8, 2020 at 10:03 PM Graham Knop via RT < bug-Object-Tiny@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=133705 > > > On Sun Nov 08 17:43:49 2020, spamaway0@gmail.com wrote:
> > 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;" >