in reply to Can't use two Moose classes with the same coercion action

Is this an XY Problem problem?

At the cost of some editing of your scripts, does the unshown portion ( # ...) of either foo.pm or bar.pm restrict your ability to combine them in a single (say, foobar.pm) package, and thus step around the coercion issue?

Replies are listed 'Best First'.
Re^2: Can't use two Moose classes with the same coercion action
by ikegami (Patriarch) on Apr 24, 2009 at 15:11 UTC
    Maybe I missed some implication since I don't know Moose, but how can you combine two classes into one package?

    Incidentally, the OP's code doesn't compile for me.

    $ perl -e'use Foo; use Bar;' String found where operator expected at Foo.pm line 3, near "coerce 'A +rrayRef'" (Do you need to predeclare coerce?) String found where operator expected at Foo.pm line 3, near "from 'Int +'" (Do you need to predeclare from?) syntax error at Foo.pm line 3, near "coerce 'ArrayRef'" Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1.
      1. Open package
      2. put the classes in the package
      3. shake the package
      :D