Hi,

On Nov 10, 2006, at 7:25 PM, [EMAIL PROTECTED] wrote:

PS.
One thing may be not so important... is it possible so that we have a alias
to ->resultset() it is too long, especialy when u chain
several calls it eats up all the space ;)) ....... i.e.    ->rs()
As we talk about aliases, what about ;) :
$schema->from($table)->select(\%where);

This was discussed last week or the previous one.

I use this:


use strict;
use base qw/DBIx::Class::Schema/;

foreach my $class (qw/TableOne TableTwo TableThree/) {
  __PACKAGE__->load_classes($class);

  my $method = $class;
  $method =~ s/([a-z])([A-Z])/${1}_$2/g;
  $method = lc($method);

  no strict 'refs';
  *{__PACKAGE__ . "::$method"}
      = sub { return shift->resultset($class) };
}

1;


This allows you to use:

$schema->table_one->seach...

Best regards,
--
Pedro Melo
JID: xmpp:[EMAIL PROTECTED]



_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to