Initial Commit

This commit is contained in:
Riley Schneider
2025-12-03 16:38:10 +01:00
parent c5e26bf594
commit b732d8d4b5
17680 changed files with 5977495 additions and 2 deletions

View File

@@ -0,0 +1,59 @@
use strict;
use warnings;
package Class::Load::PP;
our $VERSION = '0.25';
use Module::Runtime ();
use Package::Stash 0.14;
use Scalar::Util ();
use Try::Tiny;
sub is_class_loaded {
my $class = shift;
my $options = shift;
my $loaded = _is_class_loaded($class);
return $loaded if ! $loaded;
return $loaded unless $options && $options->{-version};
return try {
$class->VERSION($options->{-version});
1;
}
catch {
0;
};
}
sub _is_class_loaded {
my $class = shift;
return 0 unless Module::Runtime::is_module_name($class);
my $stash = Package::Stash->new($class);
if ($stash->has_symbol('$VERSION')) {
my $version = ${ $stash->get_symbol('$VERSION') };
if (defined $version) {
return 1 if ! ref $version;
# Sometimes $VERSION ends up as a reference to undef (weird)
return 1 if ref $version && Scalar::Util::reftype $version eq 'SCALAR' && defined ${$version};
# a version object
return 1 if Scalar::Util::blessed $version;
}
}
if ($stash->has_symbol('@ISA')) {
return 1 if @{ $stash->get_symbol('@ISA') };
}
# check for any method
return 1 if $stash->list_all_symbols('CODE');
# fail
return 0;
}
1;

View File

@@ -0,0 +1,89 @@
package Class::Load::XS; # git description: v0.09-19-g9364900
use strict;
use warnings;
our $VERSION = '0.10';
use Class::Load 0.20;
use XSLoader;
XSLoader::load(
__PACKAGE__,
$VERSION,
);
1;
# ABSTRACT: XS implementation of parts of Class::Load
# KEYWORDS: class module load require use runtime XS
__END__
=pod
=encoding UTF-8
=head1 NAME
Class::Load::XS - XS implementation of parts of Class::Load
=head1 VERSION
version 0.10
=head1 SYNOPSIS
use Class::Load;
=head1 DESCRIPTION
This module provides an XS implementation for portions of L<Class::Load>. See
L<Class::Load> for API details.
=for Pod::Coverage is_class_loaded
=head1 SUPPORT
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Class-Load-XS>
(or L<bug-Class-Load-XS@rt.cpan.org|mailto:bug-Class-Load-XS@rt.cpan.org>).
There is also a mailing list available for users of this distribution, at
L<http://lists.perl.org/list/moose.html>.
There is also an irc channel available for users of this distribution, at
L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>.
=head1 AUTHOR
Dave Rolsky <autarch@urth.org>
=head1 CONTRIBUTORS
=for stopwords Karen Etheridge Jesse Luehrs hurricup
=over 4
=item *
Karen Etheridge <ether@cpan.org>
=item *
Jesse Luehrs <doy@tozt.net>
=item *
hurricup <hurricup@gmail.com>
=back
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
=cut