develooper Front page | perl.moose | Postings from February 2012

General Moose/Perl OO question

Thread Next
From:
shtil
Date:
February 9, 2012 10:21
Subject:
General Moose/Perl OO question
Message ID:
965121627.858139.1328811670898.JavaMail.root@sz0115a.emeryville.ca.mail.comcast.net
Hi All, 


Moose provides an excellent interface with command line args via MooseX::Getopt. 
It looks like a class constructor can consume all options and once done so is ready to roll. 


This begs a question: what to put in the main program if the class knows all it needs to run? 
The usual pattern is: 


use MyMooseClass; 


my $obj = MyMooseClass->new_with_options; 


$obj->run; # Or something alike 


This looks like redundant. 


I was thinking about using 
perl -MMyMooseClass ... 


This of course assumes that MyMooseClass is a singleton. 


Any thoughts? 







Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About