On Sat, Apr 24, 2010 at 2:34 AM, Ian <[email protected]> wrote: > > My current solution is to have a MooseX::Singleton class that defines all > constants used in my database (and perhaps elsewhere in my application). > e.g. > > sub foo_track_type_count { > return shift->tracks( { > track_type => $constant->track_type_foo, > })->count; > } >
Thanks, Ian. I like that approach as it's very clear a constant is being used and it avoids importing symbols. And another excuse to use Moose. I'll avoid the discussion that it's "slow" because I can only access the constant at 168,634.06/s compared to 6,802,721.09/s with "constant" pragma. ;) -- Bill Moseley [email protected]
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
