NAME

Nefarious - wicked or criminal objects.

VERSION

Version 0.04

SYNOPSIS

Quick summary of what the module does.

Perhaps a little code snippet.

our $make_accessor;
BEGIN {
	$make_accessor = sub {
		my ($key) = shift;
		return sub {
			$_[0]->{$key} = $_[1] if $_[1];
			$_[0]->{$key};
		};
	};
}

use Nefarious {
	Properties => {
		size => $make_accessor->('size'),			
		colour => $make_accessor->('colour'),
		material => $make_accessor->('material'),
	},
	Product => {
		new => sub {
			my $self = bless {}, shift;
			$self->set(@_);
			$self;
		},
		name => $make_accessor->('name'),
		description => $make_accessor->('description'),
		properties => sub {
			my ($self, $props) = @_;
			$self->{properties} //= Properties->new();
			if ($props) {
				$self->{properties}->$_($props->{$_}) for (keys %{$props});
			}
			$self->{properties};
		},
		set => [
			[Str, Str, HashRef, sub {
				$_[0]->name($_[1]);
				$_[0]->description($_[2]);
				$_[0]->properties($_[3]);
			}],
			[Str, Str, sub {
				$_[0]->name($_[1]);
				$_[0]->description($_[2]);
			}],
			[Str, sub {
				$_[0]->name($_[1]);
			}],
			sub {
				$_[0]->name('Set the name of the Product');
				$_[0]->description('Set the description of the Product');
			}
		],
		Hat => {
			onesize => $make_accessor->('onesize'),
			Bowler => {
				onesize => 0,
			}
		}
	}
};


my $product = Bowler->new('Nefarious Brand', 'A bowler hat made from 100% wool', { 
	size => '60cm', 
	colour => 'black',
	material => 'wool' 
});

$product->name; # Nefarious Brand
$product->description; # A bowler hat made from 100% wool
$product->properties->colour; # black
$product->onesize; # 0;

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-nefarious at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Nefarious. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Nefarious

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2023->2025 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)