Re: AttributeHelpers naming (again)

2009-07-02 Thread Jesse Luehrs
On Thu, Jul 02, 2009 at 04:36:37PM -0400, Stevan Little wrote: Very good point actually. I think we should split the categories by their intentions ... Structural - ArrayRef, HashRef, Number, etc ... Behavioral - Counter, Queue, Stack, Buffer, etc ... Now, you could easily argue all

Re: Should Moose::Meta::Method::Accessor be using inline_slot_access?

2009-07-08 Thread Jesse Luehrs
On Wed, Jul 08, 2009 at 01:28:29PM -0700, Stefan O'Rear wrote: It is very easy to implement Class::MOP::Instance's inline_[sg]et_slot_value functions in terms of inline_slot_access, but very hard to do the reverse; because of this, it seems to me that Moose::Meta::Method::Accessor should

Re: Bug with Moose::Role attributes

2009-07-15 Thread Jesse Luehrs
On Wed, Jul 15, 2009 at 11:24:11AM -0700, Ovid wrote: Consider the following code. Now that the role provides an attribute named counter and the class using the role provides a method of the same name. The methods are not semantically equivalent, so I had two expectations, possibly due to

Re: Exceptions for Moose

2009-07-25 Thread Jesse Luehrs
On Sat, Jul 25, 2009 at 11:28:02PM +0300, Shlomi Fish wrote: On Saturday 25 July 2009 11:10:03 Mike Friedman wrote: Hi, I'm working on a module to provide some syntactic sugar for creating exceptions with throw/catch semantics in a Moose-ish way. The basic idea is: Before I comment

Moose and CMOP branches

2009-08-11 Thread Jesse Luehrs
So, a few days ago, rafl++ set up a couple of sites to track the merge status of branches that currently exist for Moose and Class::MOP, at http://files.perldition.org/moose.html and http://files.perldition.org/cmop.html. A few of us in #moose-dev went through the list of branches and cleaned out

Re: topic/rename_alias_excludes - use -alias and -excludes for the default role parameter names

2009-08-13 Thread Jesse Luehrs
On Thu, Aug 13, 2009 at 08:45:04AM -0400, Stevan Little wrote: Chris, Not sure if this will conflict that much as Jesse is talking about arguments to the -import methods not regular constructor args. Jesse, correct me if I am wrong here. - Stevan Yeah, Moose doesn't do anything special

several branches needing review

2009-08-19 Thread Jesse Luehrs
I have a couple braches sitting around, and it would be great to get them reviewed and (possibly) merged. They are: topic/deprecate_alias_excludes - This builds off the previous topic/rename_alias_excludes, but actually adds a warning when using the old names. topic/immutable_subclass_warning

Re: Can't specify trait option when a role consumer modifies an attribute?

2009-08-19 Thread Jesse Luehrs
On Thu, Aug 20, 2009 at 12:53:17AM -0400, Chris Prather wrote: On Thu, Aug 20, 2009 at 12:26 AM, Elliot Shankp...@galumph.com wrote: If you uncomment the one line in the code below, you get a Illegal inherited options = (getopt_name) error.  Is there any way around this? Yes, but it isn't

Re: several branches needing review

2009-08-20 Thread Jesse Luehrs
On Thu, Aug 20, 2009 at 06:56:11AM +0100, Piers Cawley wrote: On Thu, Aug 20, 2009 at 4:40 AM, Jesse Luehrsd...@tozt.net wrote:  This failed because Child was being created and immutablized partway  through the definition of Parent, and so Child's constructor (among  other things) was

Re: More on Native Traits

2009-08-21 Thread Jesse Luehrs
On Fri, Aug 21, 2009 at 09:22:26AM -0700, Hans Dieter Pearcey wrote: As far as I know, nothing else needs to be done for this branch. Jesse, Chris, or Shawn -- anything I missed? Moose::Manual::Delegation needs updating for curries (and probably for the rest too). -doy

Re: More on Native Traits

2009-08-26 Thread Jesse Luehrs
On Fri, Aug 21, 2009 at 09:22:26AM -0700, Hans Dieter Pearcey wrote: As far as I know, nothing else needs to be done for this branch. Jesse, Chris, or Shawn -- anything I missed? Something brought up by mo on #moose a day or two ago: package Foo; use Moose; use

Re: Specifying exact type

2009-09-03 Thread Jesse Luehrs
On Thu, Sep 03, 2009 at 01:33:58PM -0700, Yuri Shtil wrote: If I say isa = 'Class', then it will include all derived classes. How do I exclude derived classes? Do I need a subtype like: subtype TopClassOnly = as 'Class' = where {blessed($_) eq 'Class'}; First of all, don't do that, and

topic/exporter_init_meta

2009-09-06 Thread Jesse Luehrs
Hey, I've got another branch ready for review. This one makes Moose::Exporter optionally generate an init_meta method for you, along with import and unimport. This should make extension writing much cleaner - what used to look like this: package My::Exporter; use Moose::Exporter; use

Re: MooseX::Types to core?

2009-09-08 Thread Jesse Luehrs
On Tue, Sep 08, 2009 at 10:32:50AM -0400, Hans Dieter Pearcey wrote: Whenever we've talked about coring MooseX modules, it's mostly been MXAH and MooseX::Types. Does anyone have any changes they'd like to see in MX::Types before it becomes, say, Moose::Types? (Moose::TypeConstraints?) The

Re: recommendations for a shortcut attribute accessor to another attribute sub-element.

2009-09-08 Thread Jesse Luehrs
On Tue, Sep 08, 2009 at 05:08:07PM +0100, Mark Blackman wrote: Hi, A quick question on recommended practice here. One of my Moose-using package attributes is a hash reference. What's the recommended accessor technique for a key in that hash if I want a dedicated accessor/mutator for that

Re: Coring Other Packages

2009-09-08 Thread Jesse Luehrs
On Tue, Sep 08, 2009 at 11:32:41AM -0400, Chris Prather wrote: These are the ones that *I* can see looking at http://cpants.perl.org/dist/used_by/Moose what else looks likely? MooseX-MethodAttributes, maybe... I've never used it, but making more core perl stuff introspectable is a reasonable

Re: testing if an object has an attribute?

2009-09-08 Thread Jesse Luehrs
On Tue, Sep 08, 2009 at 04:26:57PM -0700, Yuri Shtil wrote: What is the right way to see if an object has certain attribute? I tried if $obj-can('foo') {} but got burned when something like 'import/export' gets in a way. Do I have to maintain the list of attributes (an another attribute

Re: semantics of CMOP's load_class()

2009-09-22 Thread Jesse Luehrs
On Tue, Sep 22, 2009 at 06:16:48PM -0700, Darren Duncan wrote: Now I recognize that Class::MOP provides these, and other, utility functions: Class::MOP::is_class_loaded($class_name) Class::MOP::load_class($class_name) ... and that these ostensibly are better used instead of doing it

Re: Role methods on roles, not classes

2009-10-08 Thread Jesse Luehrs
On Thu, Oct 08, 2009 at 07:26:40AM -0700, Ovid wrote: Hi all, This problem is annoying and I'm not sure of the best approach. Let's say I have a list of roles and an object and I want to serialize the object as XML. Imagine the following (this is my actual use case): sub to_xml {

Re: Role methods on roles, not classes

2009-10-08 Thread Jesse Luehrs
On Thu, Oct 08, 2009 at 10:06:06AM -0500, Jesse Luehrs wrote: Again, if the robot was a delegate rather than a role, you'd have $thing-draw_with_arm delegated to $thing-robot_arm-draw, but $thing-robot_arm-draw would still be available to be called separately: Another thing about delegation

Re: Role methods on roles, not classes

2009-10-12 Thread Jesse Luehrs
On Mon, Oct 12, 2009 at 02:54:05AM -0700, Ovid wrote: - Original Message From: Jesse Luehrs d...@tozt.net package Thing; use Moose; with ( DoesRobot = { excludes = 'draw', aliases = { draw = 'draw_with_arm' }, 'DoesDrawable' ); Again

Re: Role methods on roles, not classes

2009-10-12 Thread Jesse Luehrs
On Mon, Oct 12, 2009 at 12:09:26PM -0400, Hans Dieter Pearcey wrote: The fact that a hammer's no good for washing clothes doesn't mean you can't still bash nails with it. package HasRobot; use Moose::Role; requires @some_methods; has robot_arm = ( is = 'ro', isa =

Re: Ease of tracking down bugs.

2009-10-29 Thread Jesse Luehrs
On Thu, Oct 29, 2009 at 10:29:37PM -0500, Evan Carroll wrote: I was getting a constraint violation that appeared to come out of nowhere.  It wasn't anywhere that was attempting to set the attribute or call a constructor.  I couldn't tell where the error was coming from because the Moose

Re: Adding to legal_options_for_inheritance

2009-11-02 Thread Jesse Luehrs
On Mon, Nov 02, 2009 at 08:54:04PM -0600, Jesse Luehrs wrote: Maybe this is another point in favor of dropping the whole legal options concept in general? perigrin on IRC pointed out that we've been thinking about replacing the legal_options_for_inheritance method

Re: Was the attribute set in the constructor?

2009-11-03 Thread Jesse Luehrs
On Tue, Nov 03, 2009 at 11:09:19AM -0600, Evan Carroll wrote: around 'attribute' = sub { my ($next, $this, $key) = @_; unless ( $this-meta-get_attribute('attribute')-has_init_arg ) { if ( $key ) { $self-has_attribute ? die 'exception' :

Re: doc bug

2009-11-03 Thread Jesse Luehrs
On Tue, Nov 03, 2009 at 05:21:12PM -0600, Evan Carroll wrote: perl -Moose -e'has q[format_feed]= ( isa = Str, is = ro ); print Class-new-meta-get_attribute(q[format_feed])-get_value()' get_value and set_value both require the instance as the first argument, as pointed out in the docs for

Re: Triggers on inherited attributes

2009-11-05 Thread Jesse Luehrs
On Thu, Nov 05, 2009 at 02:16:50PM -0500, Stevan Little wrote: I'm not entirely convinced here - at the very least, accessor names shouldn't be allowed to be overridden, since doing so doesn't actually make sense... the class would still be inheriting the superclass's accessors. This should

Re: Triggers on inherited attributes

2009-11-05 Thread Jesse Luehrs
On Thu, Nov 05, 2009 at 01:10:19PM -0500, Stevan Little wrote: At one point we felt it was sane to restrict what +foo attributes can inherit. I think time has shown that we should probably just remove this restriction and let people have enough rope to shoot themselves in the foot. There

Re: MooseX::Attribute::Delegated

2009-11-05 Thread Jesse Luehrs
On Thu, Nov 05, 2009 at 10:20:27PM +0100, Nathan Gass wrote: I had to copy-paste two methods from Moose::Meta::Method::Constructor with very little changes. Any interest in changing Moose to avoid this? Any ideas how to do this properly? Would need to know more of what it

Re: Seg fault with Moose::Meta::Attribute::Native?

2009-11-11 Thread Jesse Luehrs
On Thu, Nov 12, 2009 at 12:13:29AM +, Ian Sillitoe wrote: 2009/11/11 Stevan Little stevan.lit...@iinteractive.com I was passing a string as an argument to the 'first' delegation method and not a code ref (which is what first expects). Groan... yup this was it - you're a star,

Re: result of substr fails 'Str' validation

2009-12-20 Thread Jesse Luehrs
On Sun, Dec 20, 2009 at 01:25:22PM +0100, jira wrote: Hello, consider the code fragment below. Why does it fail on '$person-name(substr 'John', 0, 255)' ? Attribute (name) does not pass the type constraint because: Validation failed for 'Str' failed with value John Thank you, Jiri

Re: Attribute initializers - incorrect documentation

2010-02-04 Thread Jesse Luehrs
On Thu, Feb 04, 2010 at 06:46:21PM -0500, Hans Dieter Pearcey wrote: Excerpts from Karen Etheridge's message of Thu Feb 04 15:43:05 -0500 2010: I'm satisfied now: there is no usecase for an initializer that couldn't be achieved using either a trigger or by modifying the behaviour of the

Non-Moose metaclasses

2010-02-07 Thread Jesse Luehrs
So, after a discussion with mst in #moose, he pointed out that initializing a non-Moose class with a Moose metaclass is a bug, and we really shouldn't be doing it. This occurs quite a bit in code within CMOP and Moose, which does things like: for my $class ($self-linearized_isa) { my

Re: Non-Moose metaclasses

2010-02-08 Thread Jesse Luehrs
On Sun, Feb 07, 2010 at 01:37:16PM -0600, Jesse Luehrs wrote: So, after a discussion with mst in #moose, he pointed out that initializing a non-Moose class with a Moose metaclass is a bug, and we really shouldn't be doing it. This occurs quite a bit in code within CMOP and Moose, which does

Re: Maybe[Foo] type coercions

2010-02-15 Thread Jesse Luehrs
On Mon, Feb 15, 2010 at 04:25:54PM -0800, Karen Etheridge wrote: I'm having difficulty getting a type coercion to work that involves Maybes. I've looked at the deep coercion section of Moose::Manual::Types, and I'm not sure what I'm missing to get this to work? e.g. I'm running perl

Re: Attributes tracking other attributes.

2010-02-18 Thread Jesse Luehrs
On Thu, Feb 18, 2010 at 05:37:56PM +0100, Martin Kamerbeek wrote: Hi, For a project I need (slave) attributes that default to the value of another (master) attribute, and keep following their master's value until they are set with a value of their own. At first I tried using lazy

Re: Fwd: Fwd: Re: What's the best approach for translating an attribute upon creation?

2010-02-26 Thread Jesse Luehrs
On Fri, Feb 26, 2010 at 12:52:44PM -0500, Steve wrote: I've moved on to a slightly more complex situation. The same phone call record contains two different date fields. One is a string like 'Jan 21, 2010' (incidentally, this date is repeated for each record, as it represents the end

Re: Method introspection (for a newbie)

2010-03-05 Thread Jesse Luehrs
On Thu, Mar 04, 2010 at 02:17:09PM -0500, Sir Robert Burbridge wrote: Hi all, I've been searching around for a few hours, but can't find an answer to this. Perhaps someone here can help a lowly Moose calf =) If I have a class defined this way: package My::Object; use Moose; sub

Re: anonclass DEMOLISH from roles

2010-03-07 Thread Jesse Luehrs
On Sun, Mar 07, 2010 at 02:31:20PM +0800, Chia-liang Kao wrote: Hi, The following script fails due to demolish composition error. however if you remove the -make_immutable in RandomClass, it works. Seems to be a bug? I just pushed a branch topic/fallback-destructor in the Moose repo,

Re: Method introspection (for a newbie)

2010-03-10 Thread Jesse Luehrs
On Tue, Mar 09, 2010 at 02:48:14PM -0500, Sir Robert Burbridge wrote: On 3/7/10 9:52 PM, Tomas Doran wrote: On 5 Mar 2010, at 16:29, Jesse Luehrs wrote: Yes, those are for Moose attributes (has foo = (...)). To introspect methods, you want get_all_methods, and if you want to be able to see

Re: Bundling constructor validation errors

2010-04-05 Thread Jesse Luehrs
On Mon, Apr 05, 2010 at 05:08:24PM -0700, Buddy Burden wrote: Moosites, This is a request from a co-worker; I'll see if I can explain it well. Let's say I have a simple Moose class: use Company::Moose; # this module gets me MooseX::Declare, and also declares all my class types, like

Re: Extending MooseX::Types (maybe with Roles?)

2010-04-13 Thread Jesse Luehrs
On Tue, Apr 13, 2010 at 01:05:48PM -0400, Sir Robert Burbridge wrote: Hey, I've read through the MooseX::Types docs many times, but I can't quite seem to get this to work. I've never worked with MooseX::Types before. Could someone show me what I'm missing? I'm trying to extend

Re: Should Moose::Object::new happily instantiate a class whose metaclass isn't a Moose one?

2010-04-14 Thread Jesse Luehrs
On Wed, Apr 14, 2010 at 11:23:26PM +0100, Alex Francis wrote: Hi, I have a bit of a puzzle on my hands and I'm looking for some guidance. Say you have a Moose base class Thing with various subclasses. Through an oversight, one of these subclasses ('BadThing') isn't declared as a Moose class

Re: Moose::Cookbook::Meta::Recipe3 - Labels implemented via attribute traits

2010-04-28 Thread Jesse Luehrs
On Wed, Apr 28, 2010 at 12:59:21PM +0100, Zbigniew Lukasiak wrote: Hi there, The recipe in http://search.cpan.org/~flora/Moose-1.01/lib/Moose/Cookbook/Meta/Recipe3.pod uses an additional package in the Moose namespace: package Moose::Meta::Attribute::Custom::Trait::Labeled; sub

Re: method modifiers globs

2010-05-31 Thread Jesse Luehrs
On Mon, May 31, 2010 at 12:16:48PM -0700, Kate Yoak wrote: On 20/05/2010, at 1:45 PM, Kate Yoak wrote: This problem actually screams for a MooseX::ImportGlobs kind of a module. It feels like one ought to be able to dig around, find all the unnamed globs and import them into meta with

Re: Delegation via Role

2010-05-31 Thread Jesse Luehrs
On Mon, May 31, 2010 at 01:02:26PM -0700, Kate Yoak wrote: Delegation is a yet another amazing feature of Moose. While basic delegation, handles = { qw/uri host/ } is nice in that it saves some typing and provides nice self-documentation facility, but not essential. The

Re: Persistent Objects Using SQL

2010-06-02 Thread Jesse Luehrs
On Wed, Jun 02, 2010 at 10:24:12AM -0700, Darren Duncan wrote: Shawn H Corey wrote: I want to thank all those who responded. Your comments have given me a view of the state of the art as it currently exists. And from what I gather, it sucks. There is a lot of software that stores

Re: Persistent Objects Using SQL

2010-06-02 Thread Jesse Luehrs
On Wed, Jun 02, 2010 at 01:09:27PM -0400, Shawn H Corey wrote: On 10-06-02 12:14 PM, Stevan Little wrote: Primary key and foreign key are meaningless to Moose because that is not how objects connect to one another, that is how you imply relationships in a RDB. I think perhaps you're too stuck

Re: Error metaclass problems with Moose 1.07

2010-06-07 Thread Jesse Luehrs
On Mon, Jun 07, 2010 at 10:54:28PM -0500, Chris Fields wrote: I'm seeing an odd error popping up with the latest Moose that's killing most of my tests. I'm using a custom error metaclass and am seeing the following: One of the changes in version 1.05 is that error metaclasses now have to

Re: CGI::Application, MooseX::Decare and Roles

2010-06-08 Thread Jesse Luehrs
On Wed, Jun 09, 2010 at 11:43:33AM +1200, Dan Horne wrote: Hi I'm trying to figure out how to combine the combination of CGI::Application, MooseX::Decare and Roles in my CGI:App controller base class.A quick Google gave me the solution for using the first two at

Re: Error I don't understand

2010-06-14 Thread Jesse Luehrs
On Mon, Jun 14, 2010 at 11:20:15AM +0200, Emmanuel Quevillon wrote: Hi Moose people, I must confess I'm not really ease with Moose behavior, but I get a strange error from it when I start my perl script. Here it is : Couldn't load class (BiblioList::Abstract) because: Couldn't load

Re: There is something about namespaces!

2010-06-16 Thread Jesse Luehrs
On Wed, Jun 16, 2010 at 03:02:23PM -0700, Kate Yoak wrote: When I define my packages right inside a script (like for testing), Moose inheritance breaks down: #!/usr/bin/perl use strict; use Test::More tests = 2; my $one = new Foo::Child; ok($one-can('foo'), extends); #fails my

Re: inner() not an instance method

2010-06-16 Thread Jesse Luehrs
On Wed, Jun 16, 2010 at 03:28:20PM -0700, Kate Yoak wrote: Because inner, like super, has, extends, with, requires, augment, before, around, after and override, is a keyword and not a method. Well, that explains a lot. It also makes my life difficult as such a beast usually

Re: changing class's @ISA dynamically

2010-06-17 Thread Jesse Luehrs
On Thu, Jun 17, 2010 at 07:16:03AM -0700, Jonathan Swartz wrote: Is is kosher to change the inheritance of a Moose class dynamically, by manipulating @ISA? What about in conjunction with make_immutable()? This is for Mason 2, in which each template will generate to a Moose class. The

Re: Coercions

2010-06-18 Thread Jesse Luehrs
On Fri, Jun 18, 2010 at 08:14:28PM +0100, Pedro Melo wrote: Hi, On Fri, Jun 18, 2010 at 7:44 PM, Evan Carroll e...@dealermade.com wrote: Actually you can do this with MX::Types too: use MooseX::Types -declare = [qw( MyDate DateTime )]; use MooseX::Types::Moose qw( Str Int HashRef

Re: Coercions

2010-06-18 Thread Jesse Luehrs
On Fri, Jun 18, 2010 at 09:41:40PM +0100, Pedro Melo wrote: Hi, On Fri, Jun 18, 2010 at 8:35 PM, Jesse Luehrs d...@tozt.net wrote: On Fri, Jun 18, 2010 at 08:14:28PM +0100, Pedro Melo wrote: On Fri, Jun 18, 2010 at 7:44 PM, Evan Carroll e...@dealermade.com wrote: Actually you can do

Re: Defining attributes

2010-06-19 Thread Jesse Luehrs
On Sat, Jun 19, 2010 at 05:15:44PM +0300, Octavian Rasnita wrote: Hi, Just as a curiosity, why the following syntax works: has $_ = (is = 'rw', isa = 'Str') for 'a' .. 'zz'; but the following one doesn't: has $_ = (is = 'rw', isa = 'Str') for 'a' .. 'zzz'; Is the number of

Re: Defining attributes

2010-06-19 Thread Jesse Luehrs
On Sat, Jun 19, 2010 at 06:27:18PM +0300, Octavian Rasnita wrote: From: Jesse Luehrs d...@tozt.net On Sat, Jun 19, 2010 at 05:15:44PM +0300, Octavian Rasnita wrote: Hi, Just as a curiosity, why the following syntax works: has $_ = (is = 'rw', isa = 'Str') for 'a' .. 'zz

Re: Moose::NonMoose and Roles

2010-07-14 Thread Jesse Luehrs
On Wed, Jul 14, 2010 at 07:25:04PM -0700, Kate Yoak wrote: Hi everyone, Here is a stumper. I have some non-moose code, which is intended to be subclassed - it's just a framework. I'd like to create a wrapper that Moosefies it. And while I am at it, I'd like to make the framework a

Re: What constitutes a MooseX:: ?

2010-07-15 Thread Jesse Luehrs
On Thu, Jul 15, 2010 at 01:15:53PM -0400, Sir Robert Burbridge wrote: On 07/14/2010 11:27 PM, Jesse Luehrs wrote: On Thu, Jul 15, 2010 at 02:31:26PM +1200, Sam Vilain wrote: I would suggest that as a better distinction - if the *API* is fundamentally tied to Moose, then delivering

Re: Vanishing attributes

2010-07-16 Thread Jesse Luehrs
On Fri, Jul 16, 2010 at 01:45:19PM -0700, Bill Moseley wrote: I don't know where to start with this. When I have a problem this weird wisdom has shown I'm doing something stupid. So, I'm looking for a sanity check and mostly a break from staring at the code, and a gin and tonic wouldn't hurt

Re: Bizarre error with Moose, Mason, and Perl 5.12

2010-09-28 Thread Jesse Luehrs
On Tue, Sep 28, 2010 at 05:42:30PM -0700, Buddy Burden wrote: So I have apparently stumbled upon some bizarre juxtabug involving all of Perl 5.12, Mason, and MooseX::Method::Signatures, and possibly MooseX::Declare (which at least changes the behavior in that it allows the bizarre fix of

Re: Ping about Traits and List::Util stuff on Array

2010-09-30 Thread Jesse Luehrs
On Thu, Sep 30, 2010 at 05:13:28PM -0500, Evan Carroll wrote: I have two questions: * Should the Array trait using List::Util permit regexes? i.e. perl -MList::Util -wE'use List::Util qw/first/; say first {/foo/} qw/bar foo bazko bazfoo/' package Class; use Moose; has

Re: attribute (id) is required - can someone shed some light?

2010-10-05 Thread Jesse Luehrs
On Tue, Oct 05, 2010 at 04:35:46PM -0700, Alex Aalto wrote: Hello all! I'm an old but rusty Perl programmer - and a noob to the modern Perl frameworks. I'm inheriting a site that uses Catalyst and Kioku but am getting the following error when trying to instantiate an object User.pm:

Re: [TEST CASE] Constructor provided arguments and strict-default fire ordering is confusing or buggy.

2010-10-25 Thread Jesse Luehrs
On Mon, Oct 25, 2010 at 03:28:26PM -0500, Evan Carroll wrote: I've recently discovered that rather against my own intuition Moose does not set constructor provided arguments first. I've always thought that Moose did the logical thing here.. If I was to read the code here: Class-new({

Re: common build function

2010-11-08 Thread Jesse Luehrs
On Mon, Nov 08, 2010 at 10:12:16PM +, Adam Guthrie wrote: Hi, I've the following class package AG::Dirs; use Moose; use namespace::autoclean; use Path::Class::Dir; use MooseX::Types::Path::Class; has 'root_dir' = ( isa = 'Path::Class::Dir', is = 'ro', coerce = 1, required = 1

Re: 答复 : common build function

2010-11-08 Thread 'Jesse Luehrs'
On Tue, Nov 09, 2010 at 10:25:43AM +0800, jiangys wrote: Thank you. My class as follow: package Corporate::Types; use warnings; use strict; use v5.8.5; use Moose; use Moose::Util::TypeConstraints; use Cwd; use Carp; ### ..some command..

Re: Role composition and BUILD {}

2010-11-16 Thread Jesse Luehrs
On Tue, Nov 16, 2010 at 11:32:55AM -0600, Evan Carroll wrote: Because a role doesn't have a BUILD people often write `around 'BUILD' = sub {}`. If this is to continue, should BUILD be special cased such that a role wrapping it can still fire code if it isn't present in the composing class?

Re: the Moose support policy

2010-11-27 Thread Jesse Luehrs
On Sat, Nov 27, 2010 at 09:10:30PM -0800, Darren Duncan wrote: With regard to the heavily updated http://search.cpan.org/dist/Moose/lib/Moose/Manual/Support.pod as of release 1.21 a few days ago ... I see that the official plan now is to release Moose on a fixed schedule with

Re: Package::Stash has Deprecated Existing Fuctions, Resulting in noisy tests

2010-12-15 Thread Jesse Luehrs
On Wed, Dec 15, 2010 at 01:02:53PM +0200, Shlomi Fish wrote: Hi all, see: http://www.cpantesters.org/cpan/report/bb09c252-078d-11e0-bf45-fe127fc525be Apparently, http://search.cpan.org/dist/Package-Stash/ provides new functions and includes a warning for each of the existing functions,

Re: Role conflict resolution rules?

2011-01-09 Thread Jesse Luehrs
On Sun, Jan 09, 2011 at 10:53:47PM -0800, Ovid wrote: Per a suggestion from Stevan, I've taken the role tests from Moose and started applying them to Role::Basic. I came across a case I'm not familiar with. If a role consumes *one* other role and they share a method with the same name, a

Re: Inheritance not working for some weird reason.

2011-01-25 Thread Jesse Luehrs
On Tue, Jan 25, 2011 at 12:05:41PM -0600, Nick Perez wrote: Honestly, I feel this is an MXD bug. Florian might have a work around, but the real answer is for this odd behavior to be fixed. Not sure I agree... circular use/require things are just as much of a problem in normal perl: # Foo.pm

Re: MooseX::NonMoose for Roles?

2011-01-28 Thread Jesse Luehrs
On Fri, Jan 28, 2011 at 09:29:04PM +0100, Zbigniew Lukasiak wrote: Are there any sane options for building Moose::Roles out of Non Moose classes? Or maybe it is trivial? You can't just turn a class into a role - that doesn't really make sense. What you can do is use delegation instead:

Re: Subclassing non moose classes

2011-03-02 Thread Jesse Luehrs
On Wed, Mar 02, 2011 at 11:36:07AM -0600, Mark A. Stratman wrote: On Mar 2, 2011, at 9:23 AM, matthew couchman (JIC) wrote: I'd like to subclass a non moose class Math::VectorReal so that I can do this But its not working, I guess because of the first caveat on the manual page that

Re: approval requested: rfc/fix-moose-meta-role-create

2011-04-21 Thread Jesse Luehrs
On Thu, Apr 21, 2011 at 08:26:06PM -0700, Chris Weyl wrote: Hey all -- This is a request for branch approval and merge. Today I noticed that Moose::Meta::Role::create() doesn't behave the same way Moose::Meta::Class::create() does, namely that it doesn't support roles. Given the docs

Re: Possible Moose::Exporter bug?

2011-05-03 Thread Jesse Luehrs
On Tue, May 03, 2011 at 01:59:33PM -0700, Ben Tilly wrote: According to the documentation for Moose::Exporter I would expect the following two modules to be equivalent: package TestMooseExporter; use Moose (); use Moose::Exporter; Moose::Exporter-setup_import_methods(

Re: Moose Type Constraints violations to warnings?

2011-06-14 Thread Jesse Luehrs
On Tue, Jun 14, 2011 at 11:03:33AM +0200, Ævar Arnfjörð Bjarmason wrote: On Tue, Jun 14, 2011 at 01:56, Jesse Luehrs d...@tozt.net wrote: On Mon, Jun 13, 2011 at 06:45:10PM +0200, Ævar Arnfjörð Bjarmason wrote: On Mon, Jun 13, 2011 at 18:39, Ævar Arnfjörð Bjarmason ava...@gmail.com wrote

Re: Roles consumption and constant pragma

2011-07-08 Thread Jesse Luehrs
On Fri, Jul 08, 2011 at 04:50:39PM -0300, Marcos Barbeitos wrote: Howdy, New to Moose, ran into something curious. Somewhere in the application I got: package Constants; use constant TRUE = 1; use constant FALSE = 0; I know, I've read several postings of people grumbling that 1

Re: [Newb] Mangling parameters, avoiding recursions?

2011-07-08 Thread Jesse Luehrs
On Sat, Jul 09, 2011 at 12:10:00AM +0200, Ekki Plicht (DF4OR) wrote: Several attributes of my class should be a bool, but get's thrown at with values like 1, Y, Ja, On for true 0, N, No, Nein, Off. '' (empty string) for false. So I thought that an own subtype + coercion should help here:

Re: Using Moose with Expect.pm

2011-07-18 Thread Jesse Luehrs
On Mon, Jul 18, 2011 at 10:18:25PM +, Arne Romo wrote: I need help understanding how to use Moose to extend Expect.pm. It occurred to me that since Expect.pm is a non-moose module I need the use MooseX::NonMoose; but my simple test program still fails. Below I've include my simple

Re: Callback methods in a Moose object

2012-01-09 Thread Jesse Luehrs
On Mon, Jan 09, 2012 at 05:42:39PM -0800, Toby Betts wrote: The issue seems to be that the arguments to be given to the callback are missing. Based on the XML::Twig docs, handlers are passed a self-referencing object called a twig and the element to handle, like so: Yes, this is the issue. If

Re: automatically wrapping methods.

2012-01-11 Thread Jesse Luehrs
On Wed, Jan 11, 2012 at 01:58:40PM -0800, Peter Shangov wrote: Or you can use B::Hooks::EndOfScope to do the wrapping at the end of the compilation stage: # untested code package MooseX::MethodValidation; use B::Hooks::EndOfScope; sub import {   on_scope_end {     my $caller = caller;  

Re: make_immutable, lazy, and 'app'?

2012-01-26 Thread Jesse Luehrs
On Fri, Jan 27, 2012 at 12:51:40PM +1000, Jason Galea wrote: Hi all, I need to stop looking at this.. I have a headache now.. I'm messing around with building a Plack app and had some really odd behaviour which I tracked back and boiled down to the test cases below. (unfortunately the

Re: Removing a role

2012-02-10 Thread Jesse Luehrs
On Fri, Feb 10, 2012 at 02:06:24PM -0500, Chris Prather wrote: On Fri, Feb 10, 2012 at 12:27 PM, Ovid curtis_ovid_...@yahoo.com wrote: Of course, both Acme::Combat::Chipmunk and Acme::Combat::Normal implement the desired role. With that, you can swap out abilities as needed. What if

Re: MX::Traits why can't traits be added with just new?

2012-03-14 Thread Jesse Luehrs
On Wed, Mar 14, 2012 at 06:37:34PM +, Tomas Doran wrote: On 14 Mar 2012, at 17:21, Caleb Cushing wrote: I'm not saying new_with_traits is bad, or with_traits is bad, just that I'd like to be able optionally turn on a way to do it with just -new . regardless of whether it changes

Re: Moose in Intermediate Perl

2012-05-04 Thread Jesse Luehrs
On Thu, May 03, 2012 at 12:28:26PM -0500, brian d foy wrote: We're adding a single Moose chapter to the next edition of Intermediate Perl. Our goal is to show people that it exists and redo our vanilla OO examples in Moose. We certainly recommend the Moose book to get the whole story. If

Re: Set attribute using 'after'

2012-05-11 Thread Jesse Luehrs
On Fri, May 11, 2012 at 08:30:13AM -0600, Curtis Jewell wrote: On Fri, May 11, 2012, at 15:42, Emmanuel Quevillon wrote: Hi, I got an exception when using 'after' this way. Here is my Moose class : package Myclass; use Moose; extends 'SuperClass'; with 'MyRole'; has

Re: RFC: Fix is_subtype_of to handle not-yet-defined role

2012-07-05 Thread Jesse Luehrs
On Wed, Jul 04, 2012 at 11:16:02AM -0500, Christopher J. Madsen wrote: After MooseX-Types 0.35 was released, I started getting failure reports for a number of my modules that use it. This turned out to be caused by this issue: use Moose::Util::TypeConstraints; # { package Foo::Role;

Re: BUILDARGS not invoked by 'new_object'

2012-07-17 Thread Jesse Luehrs
On Tue, Jul 17, 2012 at 04:08:09AM -0700, Peter Shangov wrote: Hi all, It appears that if I create an object with $metaclass-new_object(), BUILDARGS will not be executed, e.g.:   {       package Foo;       use Moose 2.0603;            sub BUILDARGS { warn Building args; return {} }  

Re: Extending attribute declaration syntax - best practice

2012-08-28 Thread Jesse Luehrs
On Tue, Aug 28, 2012 at 10:19:36AM -0700, Peter Shangov wrote: Hi,  MoooseX::Has::Options (https://metacpan.org/module/MooseX::Has::Options) adds a different syntax for declaring Moose attribute options, i.e. instead of:     has 'foo', is = 'ro', isa = 'Str', lazy_build = 1; it allows

Re: Method modifiers and subclasses

2012-09-04 Thread Jesse Luehrs
This is actually not the reason (before modifiers will be run before around modifiers if they are defined in the same class, for instance). The reason is that a subclass should not have to know implementation details about how a parent class defined its methods. When you wrap a method in a

Re: Should I coerce a DBIC schema from HashRef?

2012-09-04 Thread Jesse Luehrs
On Tue, Sep 04, 2012 at 11:22:21AM -0700, John Napiorkowski wrote: Bill, I've done this a lot in the past, as well as a few other approaches.  In the end I've come to the conclusion that although off the top it seems like a nice interface, it doesn't grow old well and can be confusing to

Re: What is the problem here?

2012-09-29 Thread Jesse Luehrs
On Sat, Sep 29, 2012 at 07:47:01PM +, sh...@comcast.net wrote: I cannot make this work: use MooseX::Declare; class Foo { use Moose::Util::TypeConstraints; subtype 'NewType' = as 'Object'; method bar (NewType $arg) { } } I get the following error:

Re: attribute initialisation and after

2012-10-08 Thread Jesse Luehrs
On Mon, Oct 08, 2012 at 10:32:28AM +0100, Dave Howorth wrote: Chris Prather wrote: On Fri, Oct 5, 2012 at 10:54 AM, Dave Howorth dhowo...@mrc-lmb.cam.ac.uk wrote: Jeff Hallock wrote: Hi Dave, 'after' is called after a method call. If you want a block of code to be called every

Re: Applying a role to an instance vs. subclassing

2012-10-08 Thread Jesse Luehrs
On Mon, Oct 08, 2012 at 07:08:09AM -0700, Bill Moseley wrote: I'm looking for some design ideas, and I'll try and briefly describe it. I suspect this is a Role vs. subclass question. I have a job processing system where a set of one or more jobs are processed. At the top I have a small

Re: BUILD called twice.

2013-02-14 Thread Jesse Luehrs
On Thu, Feb 14, 2013 at 10:58:18AM -0800, Bill Moseley wrote: On Thu, Feb 14, 2013 at 10:05 AM, Dave Rolsky auta...@urth.org wrote: But as you point out, what you did is just wrong anyway. The whole point of BUILD is that defining it in subclasses doesn't hide the parent's

Re: BUILD called twice.

2013-02-14 Thread Jesse Luehrs
On Thu, Feb 14, 2013 at 11:11:12AM -0800, Bill Moseley wrote: On Thu, Feb 14, 2013 at 11:00 AM, Jesse Luehrs d...@tozt.net wrote: In this case, you don't really want to be using BUILD at all, because running everything is basically the entire point of BUILD. Maybe your base class BUILD

Re: BUILD called twice.

2013-02-15 Thread Jesse Luehrs
On Fri, Feb 15, 2013 at 07:27:14AM -0800, Bill Moseley wrote: On Thu, Feb 14, 2013 at 11:34 AM, Bill Moseley mose...@hank.org wrote: On Thu, Feb 14, 2013 at 11:13 AM, Jesse Luehrs d...@tozt.net wrote: Baseclass-meta-remove_method( 'BUILD' ); No, that's almost certainly a bad idea

Re: union isn't finding the types

2013-02-18 Thread Jesse Luehrs
On Mon, Feb 18, 2013 at 08:35:16PM -0800, Ben Tilly wrote: This is documented, sort of. http://search.cpan.org/dist/Moose/lib/Moose/Manual/Types.pod#WHAT_IS_A_TYPE? Any Moose type is automatically a type. Any created type is a type. Any reference to something unknown is assumed to be a

Re: Role1 with attribute matches requires on Role2

2013-03-01 Thread Jesse Luehrs
On Fri, Mar 01, 2013 at 04:56:57PM +, Pedro Melo wrote: Hi, I keep getting bitten by this, and I was wondering if this is something that will be solved eventually, or its something that would be nice to solve but it is actually tricky to do, or just that I'm doing it wrong. I have

  1   2   >