Revision history for DBIx::Class
+ * Fixes
+ - Throw comprehensible exception on erroneous $schema->source()
+ invocation
+
0.08126_01 2011-01-14 14:00 (UTC)
* New Features / Changes
- Schema/resultsource instances are now crossreferenced via a new
caelum: Rafael Kitover <rkitover@cpan.org>
+caldrin: Maik Hentsche <maik.hentsche@amd.com>
+
castaway: Jess Robinson
claco: Christopher H. Laco
=cut
sub source {
- my ($self, $moniker) = @_;
+ my $self = shift;
+
+ $self->throw_exception("source() expects a source name")
+ unless @_;
+
+ my $moniker = shift;
+
my $sreg = $self->source_registrations;
return $sreg->{$moniker} if exists $sreg->{$moniker};
--- /dev/null
+use warnings;
+use strict;
+
+use Test::More;
+use Test::Exception;
+
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema;
+
+throws_ok {$schema->source()} qr/\Qsource() expects a source name/, 'Empty args for source caught';
+
+done_testing();