File manager - Edit - /usr/local/cpanel/3rdparty/perl/542/cpanel-lib/Mojo/BaseUtil.pm
Back
package Mojo::BaseUtil; # Only using pure Perl as the only purpose of this module is to break a circular dependency involving Mojo::Base use strict; use warnings; use feature ':5.16'; use Exporter qw(import); use Sub::Util qw(set_subname); our @EXPORT_OK = (qw(class_to_path monkey_patch)); sub class_to_path { join '.', join('/', split(/::|'/, shift)), 'pm' } ## This sub was modified for the perl compiler ## see https://jira.cpanel.net/browse/CPANEL-30160 ## https://stackoverflow.com/q/58677042/124486 sub monkey_patch { my ($class, %patch) = @_; no strict 'refs'; no warnings 'redefine'; foreach my $k ( keys %patch ) { *{"${class}::$k"} = Sub::Util::set_prototype( Sub::Util::prototype( $patch{$k} ), Sub::Util::set_subname( "${class}::$k", sub { my $cr = Sub::Util::set_subname("${class}::$k", $patch{$k}); goto $cr; } ) ); } } 1; =encoding utf8 =head1 NAME Mojo::BaseUtil - Common utility functions used in Mojo::Base, re-exported in Mojo::Util =head1 SYNOPSIS use Mojo::BaseUtil qw(class_to_patch monkey_path); my $path = class_to_path 'Foo::Bar'; monkey_patch 'MyApp', foo => sub { say 'Foo!' }; =head1 DESCRIPTION L<Mojo::BaseUtil> provides functions to both L<Mojo::Base> and L<Mojo::Util>, so that C<Mojo::Base> does not have to load the rest of L<Mojo::Util>, while preventing a circular dependency. =head1 SEE ALSO L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>. =cut
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings