[Dbix-class] Re: spaces in my column names... help?

Adam Sjøgren asjo at koldfront.dk
Thu Apr 19 22:34:24 GMT 2007


On Thu, 19 Apr 2007 08:43:47 -0700, Michael wrote:

> The only glitch is that I have to define my 'Bill 2 Name' column accessor(?)
> before I can use it:

> $bill2name = "Bill 2 Name";

> print $clients->$bill2name

> ... and now I can get some work done. 

You don't have to give the accessor the same name as the column - you
can say something like:

 __PACKAGE__->add_columns('Bill 2 Name'=>{ accessor=>'bill2name' }, ...);

And then you'd just go:

 print $clients->bill2name;

without changing the database.

(See <http://search.cpan.org/~blblack/DBIx-Class-0.07006/lib/DBIx/Class/ResultSource.pm#add_columns>).


  Best regards,

     Adam

-- 
 "Vi är små citroner"                                         Adam Sjøgren
                                                         asjo at koldfront.dk



More information about the Dbix-class mailing list