[Dbix-class] scope in DBIx::Class::Core subclass

Charlie Garrison garrison at zeta.org.au
Sun Feb 15 21:47:46 GMT 2015


Good morning,

On 15/2/15 at 9:51 PM +0100, Erik Colson <eco at ecocode.net> wrote:

>However, the code doesn't work if I put a 'use String::Util;' at the top
>of the package and replace 'String::Util::trim' by 'trim'. It looks like
>the declaration gets out of scope.

You need to either import the `trim` sub:

use String::Util 'trim';
......
return 'CALC: '.trim( $self->acolumn );


Or you need to call the sub with the package name as you were doing before:

return 'CALC: '.String::Util::trim( $self->acolumn );


Charlie

-- 
   Charlie Garrison  <garrison at zeta.org.au>
   github.com/cngarrison   metacpan.org/author/CNG

O< ascii ribbon campaign - stop html mail
http://www.ietf.org/rfc/rfc1855.txt




More information about the DBIx-Class mailing list