Class-DBI-SAK
view release on metacpan or search on metacpan
lib/Class/DBI/SAK.pm view on Meta::CPAN
foreach my $req ( @requests ) {
if ( substr( $req, 0, 1 ) eq ':' ) {
if ( exists $EXTENSIONS{$req} ) {
$modules{$_} = $EXTENSIONS{$req}->{$_}
foreach keys %{$EXTENSIONS{$req}};
} else {
croak "$class does not export a $req tag";
}
} else {
if ( exists $EXTENSIONS{':all'}->{$req} ) {
$modules{$req} = $EXTENSIONS{':all'}->{$req};
} else {
croak "$class does not export $req\n";
}
}
}
while ( my ($name, $use) = each %modules ) {
push @uses, sprintf $use, "Class::DBI::$name";
}
unshift @uses, 'use base qw[Class::DBI]'
unless grep { exists $modules{$_} } @OVERRIDES;
@uses = sort { ( () = $b =~ /base/ ) <=> ( () = $a =~ /base/ ) } @uses;
my $statement = join ";\n", sort {
( () = $b =~ /base/ ) <=> ( () = $a =~ /base/ )
} @uses;
$statement .= ";\n";
eval qq[
package $caller;
$statement;
package $class;
];
croak $@ if $@;
}
1;
__END__
=pod
=head1 NAME
Class::DBI::SAK - Class::DBI Swiss Army Knife (SAK)
=head1 SYNOPSIS
use Class::DBI::SAK qw[:common :mysql FromCGI];
=head1 ABSTRACT
This module encapsulates the pain and suffering that is importing
Class::DBI and all it's little helper friends.
=head1 DESCRIPTION
By taking the busy work out of using Class::DBI as you see fit,
your code becomes more useful by size. Most of us end up using at
least a couple Class::DBI extensions in our programs, and it's just
a pain. Enter the Swiss Army Knife.
This module is intelligent. It knows how each module is supposed
to be used, and which ones override the need to
C<use base qw[Class::DBI]>.
C<Class::DBI::SAK> is not a subclass of C<Class::DBI>. If you want
to subclass C<Class::DBI> you do the following.
use Class::DBI::SAK qw[:useful];
use base qw[Class::DBI];
Also, C<Class::DBI::SAK> installation recommends that you install the
described in the C<:useful> tag. No modules described in L<Tags>
or L<Modules> are bundled with this distribution. They must be installed
by you if you want to use them.
=head2 Tags
Tags may be specified either by groupings, begining with a colon
(C<:>), or by the name of the module following the C<Class::DBI::>
prefix.
Tags are available for all modules in the Class::DBI namepace, where
it makes sense to do so, as of the date of this distribution.
All modules are mentioned without the C<Class::DBI::> prefix for
brevity.
=head3 Groups
=over 4
=item C<:all>
All the modules specified in this module. This couldn't possibly
be useful to the end user (you) since so many of them conflict.
=item C<:useful>
Modules that are generally useful all the time. AbstractSearch,
and Pager. This is the default if no tags are given at all.
=item C<:mysql>
Modules for widened support for Mysql. mysql, mysql::FullTextSearch.
=back
=head3 Modules
=over 4
=item Extension
=item FromCGI
=item Pg
( run in 1.258 second using v1.01-cache-2.11-cpan-39bf76dae61 )