Skip Menu |

This queue is for tickets about the Class-Constructor CPAN distribution.

Report information
The Basics
Id: 4714
Status: resolved
Priority: 0/
Queue: Class-Constructor

People
Owner: Nobody in particular
Requestors: tex [...] engsoc.org
Cc:
AdminCc:

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



Subject: Required Parameters
Hi Michael, Would it be possible to have a parameter to mk_constructor that lists the required parameters to the constructor? e.g. package MyPackage; use base qw/ Class::Constructor Class::Accessor /; my @Accessors = qw( some_attribute ); my @Required = qw( floogle ); __PACKAGE__->mk_accessors(@Accessors, @Required); __PACKAGE__->mk_constructor( Auto_Init => \@Accessors, Required_Params => \@Required, ); package main; #error: floogle is a required parameter to new my $foo1 = MyPackage->new( some_attribute => 1 ); #everything will be all right my $foo2 = MyPackage->new( floogle => [ qw/fie fie foe fum/ ] ); __END__ Thanks, Clayton Scott
Show quoted text
> Would it be possible to have a parameter to mk_constructor > that lists the required parameters to the constructor?
Great idea - thanks! I've started work on it and I hope to get it done within the next couple of days. Michael