Subject: | Error with producer 'SQL::Translator::Producer::JSON': Can't locate object method "imap_file" via package "JSON" |
Hello,
I have found a bug in JSON producer:
andrius@amalas:$ cat sql/tables/numbers.sql
DROP TABLE IF EXISTS `numbers`;
CREATE TABLE `numbers` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique table key',
`range` varchar(12) DEFAULT NULL COMMENT '',
`user` varchar(255) DEFAULT NULL COMMENT 'name of the user associated with the range',
PRIMARY KEY (`id`)
) CHARSET=utf8
COMMENT='stores SOLSA sample ID ranges associated with specific users';
andrius@amalas:$ sqlt --from MySQL --to JSON sql/tables/numbers.sql
Error: translate: Error with producer 'SQL::Translator::Producer::JSON': Can't locate object method "db_user" via package "JSON" at /usr/share/perl5/JSON.pm line 166.
The bug is related with the passing of $translator->producer_args to JSON::to_json() function. I suppose the $translator->producer_args have to be filtered before passing them to JSON::to_json(). With the aforementioned line commented out, the translation works as expected.
Andrius