1 package Rose::DBx::Cache::Anywhere;
 
   5 use base qw( Rose::DB::Cache );
 
   9 Rose::DBx::Cache::Anywhere - get Apache::DBI behaviour without Apache
 
  13 This class is used by Rose::DBx::AutoReconnect.
 
  15 Rose::DB with Catalyst under both the Catalyst dev server and
 
  16 FastCGI and found that the standard Rose::DB::Cache behaviour
 
  17 did not work well with those environments.
 
  21 =head2 prepare_db( I<rose_db>, I<entry> )
 
  23 Overrides default method to always ping() dbh if not running
 
  29     my ( $self, $db, $entry ) = @_;
 
  31     if ( Rose::DB::Cache::MOD_PERL_1 || Rose::DB::Cache::MOD_PERL_2 ) {
 
  32         return $self->SUPER::prepare_db( $db, $entry );
 
  35     if ( !$entry->is_prepared ) {
 
  36         if ( $entry->created_during_apache_startup ) {
 
  38                 eval { $db->dbh->disconnect };    # will probably fail!
 
  42             $entry->created_during_apache_startup(0);
 
  46         # if this a dummy kivitendo dbh, don't try to actually prepare this.
 
  47         if ($db->type =~ /KIVITENDO_EMPTY/) {
 
  54     if ( !$db->dbh->ping ) {
 
  65 Peter Karman, C<< <karman at cpan.org> >>
 
  69 Please report any bugs or feature requests to
 
  70 C<bug-rose-dbx-autoreconnect at rt.cpan.org>, or through the web interface at
 
  71 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rose-DBx-AutoReconnect>.
 
  72 I will be notified, and then you'll automatically be notified of progress on
 
  73 your bug as I make changes.
 
  77 You can find documentation for this module with the perldoc command.
 
  79     perldoc Rose::DBx::AutoReconnect
 
  81 You can also look for information at:
 
  85 =item * AnnoCPAN: Annotated CPAN documentation
 
  87 L<http://annocpan.org/dist/Rose-DBx-AutoReconnect>
 
  91 L<http://cpanratings.perl.org/d/Rose-DBx-AutoReconnect>
 
  93 =item * RT: CPAN's request tracker
 
  95 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Rose-DBx-AutoReconnect>
 
  99 L<http://search.cpan.org/dist/Rose-DBx-AutoReconnect>
 
 103 =head1 ACKNOWLEDGEMENTS
 
 105 The Minnesota Supercomputing Institute C<< http://www.msi.umn.edu/ >>
 
 106 sponsored the development of this software.
 
 110 Copyright 2008 by the Regents of the University of Minnesota.
 
 113 This program is free software; you can redistribute it and/or modify it
 
 114 under the same terms as Perl itself.