Server IP : 103.119.228.120 / Your IP : 3.147.6.176 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/local/ssl/local/share/perl5/Sub/Exporter/ |
Upload File : |
package Sub::Exporter::Progressive; $Sub::Exporter::Progressive::VERSION = '0.001012'; use strict; use warnings; # ABSTRACT: Only use Sub::Exporter if you need it sub _croak { require Carp; &Carp::croak; } sub import { my ($self, @args) = @_; my $inner_target = caller; my $export_data = sub_export_options($inner_target, @args); my $full_exporter; no strict 'refs'; @{"${inner_target}::EXPORT_OK"} = @{$export_data->{exports}}; @{"${inner_target}::EXPORT"} = @{$export_data->{defaults}}; %{"${inner_target}::EXPORT_TAGS"} = %{$export_data->{tags}}; *{"${inner_target}::import"} = sub { use strict; my ($self, @args) = @_; if ( grep { length ref $_ or $_ !~ / \A [:-]? \w+ \z /xm } @args ) { _croak 'your usage of Sub::Exporter::Progressive requires Sub::Exporter to be installed' unless eval { require Sub::Exporter }; $full_exporter ||= Sub::Exporter::build_exporter($export_data->{original}); goto $full_exporter; } elsif ( defined( (my ($num) = grep { m/^\d/ } @args)[0] ) ) { _croak "cannot export symbols with a leading digit: '$num'"; } else { require Exporter; s/ \A - /:/xm for @args; @_ = ($self, @args); goto \&Exporter::import; } }; return; } my $too_complicated = <<'DEATH'; You are using Sub::Exporter::Progressive, but the features your program uses from Sub::Exporter cannot be implemented without Sub::Exporter, so you might as well just use vanilla Sub::Exporter DEATH sub sub_export_options { my ($inner_target, $setup, $options) = @_; my @exports; my @defaults; my %tags; if ( ($setup||'') eq '-setup') { my %options = %$options; OPTIONS: for my $opt (keys %options) { if ($opt eq 'exports') { _croak $too_complicated if ref $options{exports} ne 'ARRAY'; @exports = @{$options{exports}}; _croak $too_complicated if grep { length ref $_ } @exports; } elsif ($opt eq 'groups') { %tags = %{$options{groups}}; for my $tagset (values %tags) { _croak $too_complicated if grep { length ref $_ or $_ =~ / \A - (?! all \b ) /x } @{$tagset}; } @defaults = @{$tags{default} || [] }; } else { _croak $too_complicated; } } @{$_} = map { / \A [:-] all \z /x ? @exports : $_ } @{$_} for \@defaults, values %tags; $tags{all} ||= [ @exports ]; my %exports = map { $_ => 1 } @exports; my @errors = grep { not $exports{$_} } @defaults; _croak join(', ', @errors) . " is not exported by the $inner_target module\n" if @errors; } return { exports => \@exports, defaults => \@defaults, original => $options, tags => \%tags, }; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Sub::Exporter::Progressive - Only use Sub::Exporter if you need it =head1 VERSION version 0.001012 =head1 SYNOPSIS package Syntax::Keyword::Gather; use Sub::Exporter::Progressive -setup => { exports => [qw( break gather gathered take )], groups => { default => [qw( break gather gathered take )], }, }; # elsewhere # uses Exporter for speed use Syntax::Keyword::Gather; # somewhere else # uses Sub::Exporter for features use Syntax::Keyword::Gather 'gather', take => { -as => 'grab' }; =head1 DESCRIPTION L<Sub::Exporter> is an incredibly powerful module, but with that power comes great responsibility, er- as well as some runtime penalties. This module is a C<Sub::Exporter> wrapper that will let your users just use L<Exporter> if all they are doing is picking exports, but use C<Sub::Exporter> if your users try to use C<Sub::Exporter>'s more advanced features, like renaming exports, if they try to use them. Note that this module will export C<@EXPORT>, C<@EXPORT_OK> and C<%EXPORT_TAGS> package variables for C<Exporter> to work. Additionally, if your package uses advanced C<Sub::Exporter> features like currying, this module will only ever use C<Sub::Exporter>, so you might as well use it directly. =head1 CONTRIBUTORS ilmari - Dagfinn Ilmari Mannsåker (cpan:ILMARI) <ilmari@ilmari.org> mst - Matt S. Trout (cpan:MSTROUT) <mst@shadowcat.co.uk> leont - Leon Timmermans (cpan:LEONT) <leont@cpan.org> =head1 AUTHOR Arthur Axel "fREW" Schmidt <Sub-Exporter-Progressive@afoolishmanifesto.com> =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2016 by Arthur Axel "fREW" Schmidt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut