Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 25012
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: CDBICompat requires a class exist for it to has_a
Class::DBI->has_a() does not check if the given class exists at the time the relationship is declared. This allows you to do interesting things like generate, in memory, a large number of CDBI classes from a schema file without caring about load order. DBIx::Class::CDBICompat does not support this as the attached test demonstrates.
Subject: hasa_without_loading.t
#!/usr/bin/perl -w use strict; use Test::More; BEGIN { eval "use DBIx::Class::CDBICompat;"; plan $@ ? (skip_all => 'Class::Trigger and DBIx::ContextualFetch required') : (tests=> 3); } package Foo; use base qw(DBIx::Class); __PACKAGE__->load_components(qw/CDBICompat Core DB/); eval { Foo->table("foo"); Foo->columns(Essential => qw(foo bar)); Foo->has_a( bar => "This::Does::Not::Exist::Yet" ); }; ::is $@, ''; ::is(Foo->table, "foo"); ::is_deeply [sort map lc, Foo->columns], [sort map lc, qw(foo bar)];
resolvatron!