Gtk2-Ex-ComboBoxBits

 view release on metacpan or  search on metacpan

t/Test/Weaken/ExtraBits.pm  view on Meta::CPAN

  my $ref = shift;
  ref $ref eq 'CODE' or return;

  while (@_) {
    my $module = shift;
    my $symtabname = "${module}::";
    no strict 'refs';
    %$symtabname or next;
    foreach my $name (keys %$symtabname) {
      my $fullname = "${module}::$name";
      if (defined &$fullname && $ref == \&$fullname) {
        return 1;
      }
    }
  }
  return 0;
}

1;
__END__

=head1 NAME

Test::Weaken::ExtraBits -- various helpers for Test::Weaken

=head1 SYNOPSIS

 use Test::Weaken::ExtraBits;

=head1 EXPORTS

Nothing is exported by default, but the functions can be requested
individually in the usual C<Exporter> style (see L<Exporter>).

    use Test::Weaken::ExtraBits qw(ignore_Class_Singleton);

=head1 FUNCTIONS

=head2 Ignores

=over 4

=item C<< $bool = Test::Weaken::ExtraBits::ignore_Class_Singleton ($ref) >>

Return true if C<$ref> is the singleton instance of a class using
C<Class::Singleton>.

The current implementation of this function requires C<Class::Singleton>
version 1.04 for its C<has_instance> method.

=item C<< $bool = Test::Weaken::ExtraBits::ignore_DBI_globals ($ref) >>

Return true if C<$ref> is one of the various C<DBI> module global objects.

Currently this means any C<DBI::dr> driver object, one each of which is
created permanently for each driver loaded, and which C<DBI::db> handles
then refer to.

A bug/misfeature of Perl through to at least 5.10.1 on lvalue C<substr>
means certain scratchpad temporaries of DBI "ImplementorClass" strings end
up held alive after C<DBI::db> and C<DBI::st> objects have finished with
them.  These aren't recognised by C<ignore_DBI_globals> currently.
A workaround is to do a dummy C<DBI::db> creation to flush out the old
scratchpad.

=back

=head1 SEE ALSO

L<Test::Weaken>

=cut



( run in 1.797 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )