404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.129.194.144: ~ $
package constant;
use 5.008;
use strict;
use warnings::register;

our $VERSION = '1.33';
our %declared;

#=======================================================================

# Some names are evil choices.
my %keywords = map +($_, 1), qw{ BEGIN INIT CHECK END DESTROY AUTOLOAD };
$keywords{UNITCHECK}++ if $] > 5.009;

my %forced_into_main = map +($_, 1),
    qw{ STDIN STDOUT STDERR ARGV ARGVOUT ENV INC SIG };

my %forbidden = (%keywords, %forced_into_main);

my $normal_constant_name = qr/^_?[^\W_0-9]\w*\z/;
my $tolerable = qr/^[A-Za-z_]\w*\z/;
my $boolean = qr/^[01]?\z/;

BEGIN {
    # We'd like to do use constant _CAN_PCS => $] > 5.009002
    # but that's a bit tricky before we load the constant module :-)
    # By doing this, we save several run time checks for *every* call
    # to import.
    my $const = $] > 5.009002;
    my $downgrade = $] < 5.015004; # && $] >= 5.008
    my $constarray = exists &_make_const;
    if ($const) {
	Internals::SvREADONLY($const, 1);
	Internals::SvREADONLY($downgrade, 1);
	$constant::{_CAN_PCS}   = \$const;
	$constant::{_DOWNGRADE} = \$downgrade;
	$constant::{_CAN_PCS_FOR_ARRAY} = \$constarray;
    }
    else {
	no strict 'refs';
	*{"_CAN_PCS"}   = sub () {$const};
	*{"_DOWNGRADE"} = sub () { $downgrade };
	*{"_CAN_PCS_FOR_ARRAY"} = sub () { $constarray };
    }
}

#=======================================================================
# import() - import symbols into user's namespace
#
# What we actually do is define a function in the caller's namespace
# which returns the value. The function we create will normally
# be inlined as a constant, thereby avoiding further sub calling 
# overhead.
#=======================================================================
sub import {
    my $class = shift;
    return unless @_;			# Ignore 'use constant;'
    my $constants;
    my $multiple  = ref $_[0];
    my $caller = caller;
    my $flush_mro;
    my $symtab;

    if (_CAN_PCS) {
	no strict 'refs';
	$symtab = \%{$caller . '::'};
    };

    if ( $multiple ) {
	if (ref $_[0] ne 'HASH') {
	    require Carp;
	    Carp::croak("Invalid reference type '".ref(shift)."' not 'HASH'");
	}
	$constants = shift;
    } else {
	unless (defined $_[0]) {
	    require Carp;
	    Carp::croak("Can't use undef as constant name");
	}
	$constants->{+shift} = undef;
    }

    foreach my $name ( keys %$constants ) {
	my $pkg;
	my $symtab = $symtab;
	my $orig_name = $name;
	if ($name =~ s/(.*)(?:::|')(?=.)//s) {
	    $pkg = $1;
	    if (_CAN_PCS && $pkg ne $caller) {
		no strict 'refs';
		$symtab = \%{$pkg . '::'};
	    }
	}
	else {
	    $pkg = $caller;
	}

	# Normal constant name
	if ($name =~ $normal_constant_name and !$forbidden{$name}) {
	    # Everything is okay

	# Name forced into main, but we're not in main. Fatal.
	} elsif ($forced_into_main{$name} and $pkg ne 'main') {
	    require Carp;
	    Carp::croak("Constant name '$name' is forced into main::");

	# Starts with double underscore. Fatal.
	} elsif ($name =~ /^__/) {
	    require Carp;
	    Carp::croak("Constant name '$name' begins with '__'");

	# Maybe the name is tolerable
	} elsif ($name =~ $tolerable) {
	    # Then we'll warn only if you've asked for warnings
	    if (warnings::enabled()) {
		if ($keywords{$name}) {
		    warnings::warn("Constant name '$name' is a Perl keyword");
		} elsif ($forced_into_main{$name}) {
		    warnings::warn("Constant name '$name' is " .
			"forced into package main::");
		}
	    }

	# Looks like a boolean
	# use constant FRED == fred;
	} elsif ($name =~ $boolean) {
            require Carp;
	    if (@_) {
		Carp::croak("Constant name '$name' is invalid");
	    } else {
		Carp::croak("Constant name looks like boolean value");
	    }

	} else {
	   # Must have bad characters
            require Carp;
	    Carp::croak("Constant name '$name' has invalid characters");
	}

	{
	    no strict 'refs';
	    my $full_name = "${pkg}::$name";
	    $declared{$full_name}++;
	    if ($multiple || @_ == 1) {
		my $scalar = $multiple ? $constants->{$orig_name} : $_[0];

		if (_DOWNGRADE) { # for 5.8 to 5.14
		    # Work around perl bug #31991: Sub names (actually glob
		    # names in general) ignore the UTF8 flag. So we have to
		    # turn it off to get the "right" symbol table entry.
		    utf8::is_utf8 $name and utf8::encode $name;
		}

		# The constant serves to optimise this entire block out on
		# 5.8 and earlier.
		if (_CAN_PCS) {
		    # Use a reference as a proxy for a constant subroutine.
		    # If this is not a glob yet, it saves space.  If it is
		    # a glob, we must still create it this way to get the
		    # right internal flags set, as constants are distinct
		    # from subroutines created with sub(){...}.
		    # The check in Perl_ck_rvconst knows that inlinable
		    # constants from cv_const_sv are read only. So we have to:
		    Internals::SvREADONLY($scalar, 1);
		    if (!exists $symtab->{$name}) {
			$symtab->{$name} = \$scalar;
			++$flush_mro->{$pkg};
		    }
		    else {
			local $constant::{_dummy} = \$scalar;
			*$full_name = \&{"_dummy"};
		    }
		} else {
		    *$full_name = sub () { $scalar };
		}
	    } elsif (@_) {
		my @list = @_;
		if (_CAN_PCS_FOR_ARRAY) {
		    _make_const($list[$_]) for 0..$#list;
		    _make_const(@list);
		    if (!exists $symtab->{$name}) {
			$symtab->{$name} = \@list;
			$flush_mro->{$pkg}++;
		    }
		    else {
			local $constant::{_dummy} = \@list;
			*$full_name = \&{"_dummy"};
		    }
		}
		else { *$full_name = sub () { @list }; }
	    } else {
		*$full_name = sub () { };
	    }
	}
    }
    # Flush the cache exactly once if we make any direct symbol table changes.
    if (_CAN_PCS && $flush_mro) {
	mro::method_changed_in($_) for keys %$flush_mro;
    }
}

1;

__END__


Filemanager

Name Type Size Permission Actions
App Folder 0755
Archive Folder 0755
Attribute Folder 0755
B Folder 0755
CPAN Folder 0755
Carp Folder 0755
Class Folder 0755
Compress Folder 0755
Config Folder 0755
DBM_Filter Folder 0755
Devel Folder 0755
Digest Folder 0755
Encode Folder 0755
Exporter Folder 0755
ExtUtils Folder 0755
File Folder 0755
Filter Folder 0755
Getopt Folder 0755
HTTP Folder 0755
I18N Folder 0755
IO Folder 0755
IPC Folder 0755
JSON Folder 0755
Locale Folder 0755
Math Folder 0755
Memoize Folder 0755
Module Folder 0755
Net Folder 0755
Params Folder 0755
Parse Folder 0755
Perl Folder 0755
PerlIO Folder 0755
Pod Folder 0755
Search Folder 0755
TAP Folder 0755
Term Folder 0755
Test Folder 0755
Test2 Folder 0755
Text Folder 0755
Thread Folder 0755
Tie Folder 0755
Time Folder 0755
Unicode Folder 0755
User Folder 0755
autodie Folder 0755
encoding Folder 0755
overload Folder 0755
pod Folder 0755
unicore Folder 0755
version Folder 0755
warnings Folder 0755
AnyDBM_File.pm File 2.56 KB 0644
AutoLoader.pm File 5.36 KB 0644
AutoSplit.pm File 19.18 KB 0644
Benchmark.pm File 30.3 KB 0644
CORE.pod File 3.11 KB 0644
CPAN.pm File 138.12 KB 0644
Carp.pm File 19.68 KB 0644
DB.pm File 18.48 KB 0644
DBM_Filter.pm File 14.05 KB 0644
Digest.pm File 10.45 KB 0644
DirHandle.pm File 1.52 KB 0644
Dumpvalue.pm File 17.14 KB 0644
English.pm File 4.65 KB 0644
Env.pm File 5.39 KB 0644
Exporter.pm File 2.31 KB 0644
Fatal.pm File 56.91 KB 0644
FileCache.pm File 5.44 KB 0644
FileHandle.pm File 2.06 KB 0644
FindBin.pm File 4.45 KB 0644
Internals.pod File 2.52 KB 0644
Memoize.pm File 35.34 KB 0644
NEXT.pm File 18.4 KB 0644
PerlIO.pm File 10.21 KB 0644
Safe.pm File 24.49 KB 0644
SelectSaver.pm File 344 B 0644
SelfLoader.pm File 17.28 KB 0644
Symbol.pm File 2.05 KB 0644
Test.pm File 29.35 KB 0644
Test2.pm File 6.24 KB 0644
Thread.pm File 8.09 KB 0644
UNIVERSAL.pm File 6.44 KB 0644
XSLoader.pm File 3.83 KB 0644
_charnames.pm File 32.39 KB 0644
autodie.pm File 12.58 KB 0644
autouse.pm File 4.14 KB 0644
base.pm File 8.72 KB 0644
bigint.pm File 22.85 KB 0644
bignum.pm File 20.64 KB 0644
bigrat.pm File 15.78 KB 0644
blib.pm File 2.04 KB 0644
bytes.pm File 447 B 0644
bytes_heavy.pl File 758 B 0644
charnames.pm File 20.38 KB 0644
constant.pm File 5.6 KB 0644
deprecate.pm File 3.43 KB 0644
diagnostics.pm File 18.59 KB 0644
dumpvar.pl File 15.19 KB 0644
experimental.pm File 5.66 KB 0644
feature.pm File 4.39 KB 0644
fields.pm File 4.9 KB 0644
filetest.pm File 3.91 KB 0644
if.pm File 3.26 KB 0644
integer.pm File 172 B 0644
less.pm File 3.13 KB 0644
locale.pm File 3.34 KB 0644
meta_notation.pm File 2.07 KB 0644
ok.pm File 967 B 0644
open.pm File 7.83 KB 0644
overload.pm File 4.34 KB 0644
overloading.pm File 964 B 0644
parent.pm File 478 B 0644
perl5db.pl File 309.01 KB 0644
perlfaq.pm File 78 B 0644
sigtrap.pm File 7.43 KB 0644
sort.pm File 5.94 KB 0644
strict.pm File 1.57 KB 0644
subs.pm File 848 B 0644
utf8.pm File 342 B 0644
utf8_heavy.pl File 30.87 KB 0644
vars.pm File 1.12 KB 0644
version.pm File 1.67 KB 0644
version.pod File 9.63 KB 0644
vmsish.pm File 4.21 KB 0644
warnings.pm File 21.44 KB 0644