Skip Menu |

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

Report information
The Basics
Id: 23493
Status: rejected
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: maros [...] k-1.com
Cc:
AdminCc:

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



Subject: DBIx::Class::ResultSet object not usable after schema goes out of scope
The following testcase fails. It is based on the CD, Artist example in the DBIx-Class documentation. I know that this doesn't look very reasonable, but I'm using a similar setup in conjunction with connection pooling. ------------------------------------ use DB::Main; sub getRecordset { my $sClass = shift; my $oSchema = DB::Main->connect('DBI:mysql:database=dbixtest','', '', {}); return $oSchema->resultset($sClass); } my $record = getRecordset('Artist'); while (my $element = $record->next()) { print $element->name; } ------------------------------------ It seems that the result_source->schema attribute is empty after it leaves the 'getRecordset' function in the example above. The errormessage runs as follows: Can't call method "storage" on an undefined value at C:\Lang\Perl\5.8.8\site\lib/DBIx/Class/ResultSource.pm line 411. I'm running DBIx-Class 0.07 with Perl 5.8.8 (Activestate) on Win32.
This was already rejected under bug # 19474 Basically, the answer is "don't do that". You need to keep the schema object around. Read the other ticket for more details about why: https://rt.cpan.org/Ticket/Display.html?id=19474