This one time, on #dbix-class, mst told me somet things about virtual views with DBIC.
package MySchema::Sneaky;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/Core/);
__PACKAGE__->table("DUMMY"); # madness going on
# scalar ref to the sql statement
__PACKAGE__->result_source_instance->name(
\<<EOSQL);
(
select foo, bar
from baz
)
EOSQL
__PACKAGE__->add_columns(
qw/ foo bar /
);
Note that SQL::Translator will have trouble ->deploying this kind of table, and you need a hook to remove this table from the definition with something like:
package MySchema;
use strict;
use base qw/DBIx::Class::Schema/;
sub sqlt_deploy_hook {
my ($self, $sqlt_schema) = @_;
my @pesky_tables = grep /^SCALAR\(0x[0-9A-F]+\)/i, keys %{ $sqlt_s
+chema->{tables} };
$sqlt_schema->drop_table( $_ ) for @pesky_tables;
local $" = ', '; warn "Removed @pesky_tables from list of tables t
+o deploy";
use Data::Dumper;
#die Dumper $sqlt_schema;
}
@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;