Data::Dump chokes on DBIDM Class Names

4 views
Skip to first unread message

Ross Attrill

unread,
Jul 9, 2013, 1:37:34 AM7/9/13
to dbix-da...@googlegroups.com
I am converting from Data::Dumper to Data::Dump in much of my code.

But when a hash is constructed from a join using DBIDM we get a class roughly like this (hand edited).

bless( {
                   'table1_id' => 10,
                   'table2_id' => 23,
                   ...

                 }, 'Exl::Schema::AutoJoin::Table1|t1<=>Table2|t2' )

What is the Table1|t1<=>Table2|t2 bit?  Is that the name of a dynamically defined class?

I am trying to get my head around this so that I can raise an enhancement request against Data::Dump - or at least find out what characters or structure Data::Dump is falling over on.

Thank you,

Ross Attrill.


Laurent Dami

unread,
Jul 9, 2013, 2:04:52 AM7/9/13
to dbix-da...@googlegroups.com
Le 09.07.2013 07:37, Ross Attrill a écrit :

What is the Table1|t1<=>Table2|t2 bit?  Is that the name of a dynamically defined class?



Yes, this is a dynamically defined class.

The perl interpreter doesn't put any restrictions in class names, so these are valid characters; but some tools may not expect to find such characters in class names.
Actually,  I had a problem similar to yours when using the Perl debugger; this was declared in ticket

https://rt.perl.org:443/rt3/Ticket/Display.html?id=101814. The problem in Data::Dump is probably quite similar.

Cheers, Laurent D.

Ross Attrill

unread,
Jul 9, 2013, 2:07:03 AM7/9/13
to dbix-da...@googlegroups.com
It is the '=' sign in the class name that Data::Dump doesn't like.   

Laurent - do you want me to try and see if I can ask Data::Dump maintainer if they can support this?   Data::Dumper can handle it.

Here is some test code:



use Test::Most;
use v5.10;
use Data::Dumper;
use Data::Dump qw(dump);

my $funny_name = 'Table1|t1<=>Table2|t2';
my $less_funny_name = 'Table1|t1<>Table2|t2';

package Bar {
    sub new {
        my $class = shift;
        bless({}, $class);
    }
};

package Table {
    sub new {
        my $class = shift;
        my $class_name = $class . '::' . $funny_name;
        bless({}, $class_name);
    }
}

package Table2 {
    sub new {
        my $class = shift;
        my $class_name = $class . '::' . $less_funny_name;
        bless({}, $class_name);
    }
}

my $bar = Bar->new();
isa_ok($bar, 'Bar');

my $table = Table->new();
isa_ok($table, 'Table::Table1|t1<=>Table2|t2');

my $table2 = Table2->new();
isa_ok($table2, "Table2::$less_funny_name");

# say "table Dumper" . Dumper $table;
# say "table2 Dumper " . Dumper $table2;
say "Table2 dump " . dump $table2;
say "table dump " . dump $table;

done_testing;

Dami Laurent (PJ)

unread,
Jul 9, 2013, 2:16:41 AM7/9/13
to dbix-da...@googlegroups.com

 

 

De : dbix-da...@googlegroups.com [mailto:dbix-da...@googlegroups.com] De la part de Ross Attrill
Envoyé : mardi 9 juillet 2013 08:07
À : dbix-da...@googlegroups.com
Objet : [dbix-datamodel] Re: Data::Dump chokes on DBIDM Class Names

 

It is the '=' sign in the class name that Data::Dump doesn't like.   

 

Laurent - do you want me to try and see if I can ask Data::Dump maintainer if they can support this?   Data::Dumper can handle it.

 

 

[DAL] Yes, please go on and open a ticket by them. You can refer to the https://rt.perl.org:443/rt3/Ticket/Display.html?id=101814 ticket.

Ross Attrill

unread,
Jul 9, 2013, 2:18:11 AM7/9/13
to dbix-da...@googlegroups.com
Thanks Laurent - I will raise a request this week. 


--
 
---
You received this message because you are subscribed to the Google Groups "dbix-datamodel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbix-datamode...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ross Attrill

unread,
Jul 9, 2013, 2:47:03 AM7/9/13
to dbix-da...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages