Welcome! My preferred idiom or pattern looks like this,
package Widget;
use strict;
use warnings;
# generic constructor, allows for any keys to be passed like,
# my $widget = Widget->new(field1 => "value 1", field2 => "value 2", e
+tc => "etc...");
sub new {
my ($pkg, %self) = @_;
# can validate parameters here... (I like Validate::Tiny)
# technically it's a "package", also the 2nd argument to
# bless is a string, literally just the "package" name ('Widget')
return bless \%self, $pkg;
}
1; #<-- note
I highly recommend looking at the following:
My standard advice is to stay away from any OO perl systems that promise the m00n until you understand how Perl makes all this happen. Conway's, Object Orient Perl is a must peruse.