Skip Menu |

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

Report information
The Basics
Id: 131659
Status: new
Priority: 0/
Queue: DBIx-Class

Owner: Nobody in particular
Requestors: ether [...]

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

Subject: on_connect_do accepted syntax inconsistent with documentation - listref of subref returning string not actually supported
Download (untitled) / with headers
text/plain 1.3k says that the argument to on_connect_do can be a listref that contains a subref -- which can return a string. However, this usage does not work. This can be easily seen by altering an existing unit test: diff --git a/t/storage/on_connect_do.t b/t/storage/on_connect_do.t index 115fadb7..999b312b 100644 --- a/t/storage/on_connect_do.t +++ b/t/storage/on_connect_do.t @@ -101,8 +101,5 @@ sub check_dropped { sub insert_from_subref { my $storage = shift; - return [ - [ 'INSERT INTO TEST_empty VALUES (?)', {}, 3 ], - 'INSERT INTO TEST_empty VALUES (7)', - ]; + 'INSERT INTO TEST_empty VALUES (7)', } $ perl -Ilib t/storage/on_disconnect_do.t ... DBIx::Class::Storage::DBI::catch {...} (): Can't use string ("INSERT INTO TEST_empty VALUES (7"...) as an ARRAY ref while "strict refs" in use at lib/DBIx/Class/Storage/ line 1459. at t/storage/on_connect_do.t line 55 The documentation also does not mention the usage exercised in the unit test -- where the subref returns a listref of strings, nor the usage where a single query is itself a listref (query plus attributes and bind arguments). (I'm not sure which way is right, but I'm guessing that all of these syntaxes ought to be valid.)

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to