NAME

Marlin::Struct - quickly create struct-like classes

SYNOPSIS

use v5.20.0;
use Types::Common 'Num';

use Marlin::Struct
  Point    => [ 'x!' => Num, 'y!' => Num ],
  Point3D  => [ 'z!' => Num, -parent => \'Point' ];


my $point   = Point->new( x => 1, y => 2 );
my $point3d = Point3D[ 1, 2, 3 ];

is_Point( $point3d ) or die;
assert_Point( $point3d );

use Marlin::Struct
  Rectangle => [ 'corner1!' => Point, 'corner2! => Point ]; 

DESCRIPTION

This module quickly creates "anonymous-like" classes and gives you a lexical function to construct instances.

BUGS

Please report any bugs to https://github.com/tobyink/p5-marlin/issues.

SEE ALSO

Marlin.

AUTHOR

Toby Inkster <tobyink@cpan.org>.

COPYRIGHT AND LICENCE

This software is copyright (c) 2025 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.