X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=maint%2Fjoint_deps.pl;h=8c16a7d73bbb70eabe9cd2d99f214e8fc7a7aefc;hb=a9e8284f478f029f6f50c9423c3fa20aa3256d4a;hp=cfdbede7bc674ed887595fb922ebd19b88f08f2d;hpb=deeb88bc5da7577fafd07123c7f125d5a73e97dd;p=dbsrgits%2FDBIx-Class.git diff --git a/maint/joint_deps.pl b/maint/joint_deps.pl index cfdbede..8c16a7d 100755 --- a/maint/joint_deps.pl +++ b/maint/joint_deps.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use warnings; use strict; @@ -19,15 +19,27 @@ use Data::Dumper::Concise; my $s = CPANDB::Schema->connect (sub { CPANDB->dbh } ); # reference names are unstable - just create rels manually -# is there a saner way to do that? -my $distclass = $s->class('Distribution'); -$distclass->has_many ( +my $distrsrc = $s->source('Distribution'); + +# the has_many helper is a class-only method (why?), thus +# manual add_rel +$distrsrc->add_relationship ( 'deps', $s->class('Dependency'), - 'distribution', + { 'foreign.distribution' => 'self.' . ($distrsrc->primary_columns)[0] }, + { accessor => 'multi', join_type => 'left' }, ); -$s->unregister_source ('Distribution'); -$s->register_class ('Distribution', $distclass); + +# here is how one could use the helper currently: +# +#my $distresult = $s->class('Distribution'); +#$distresult->has_many ( +# 'deps', +# $s->class('Dependency'), +# 'distribution', +#); +#$s->unregister_source ('Distribution'); +#$s->register_class ('Distribution', $distresult); # a proof of concept how to find out who uses us *AND* SQLT