Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.148.104.103
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/root/proc/3/root/lib/x86_64-linux-gnu/perl5/5.36/Moose/Meta/Method/Accessor/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/root/proc/3/root/lib/x86_64-linux-gnu/perl5/5.36/Moose/Meta/Method/Accessor//Native.pm
package Moose::Meta::Method::Accessor::Native;
our $VERSION = '2.2203';

use strict;
use warnings;

use Carp qw( confess );
use Scalar::Util qw( blessed );

use Moose::Role;

use Moose::Util 'throw_exception';

around new => sub {
    my $orig = shift;
    my $class   = shift;
    my %options = @_;

    $options{curried_arguments} = []
        unless exists $options{curried_arguments};

    throw_exception( MustSupplyArrayRefAsCurriedArguments => params     => \%options,
                                                             class_name => $class
                   )
        unless $options{curried_arguments}
            && ref($options{curried_arguments}) eq 'ARRAY';

    my $attr_context = $options{attribute}->definition_context;
    my $desc = 'native delegation method ';
    $desc   .= $options{attribute}->associated_class->name;
    $desc   .= '::' . $options{name};
    $desc   .= " ($options{delegate_to_method})";
    $desc   .= " of attribute " . $options{attribute}->name;
    $options{definition_context} = {
        %{ $attr_context || {} },
        description => $desc,
    };

    $options{accessor_type} = 'native';

    return $class->$orig(%options);
};

sub _new {
    my $class = shift;
    my $options = @_ == 1 ? $_[0] : {@_};

    return bless $options, $class;
}

sub root_types { (shift)->{'root_types'} }

sub _initialize_body {
    my $self = shift;

    $self->{'body'} = $self->_compile_code( [$self->_generate_method] );

    return;
}

sub _inline_curried_arguments {
    my $self = shift;

    return unless @{ $self->curried_arguments };

    return 'unshift @_, @curried;';
}

sub _inline_check_argument_count {
    my $self = shift;

    my @code;

    if (my $min = $self->_minimum_arguments) {
        push @code, (
            'if (@_ < ' . $min . ') {',
                $self->_inline_throw_exception( MethodExpectsMoreArgs =>
                                                'method_name           => "'.$self->delegate_to_method.'",'.
                                                "minimum_args          => ".$min,
                ) . ';',
            '}',
        );
    }

    if (defined(my $max = $self->_maximum_arguments)) {
        push @code, (
            'if (@_ > ' . $max . ') {',
                $self->_inline_throw_exception( MethodExpectsFewerArgs =>
                                                'method_name            => "'.$self->delegate_to_method.'",'.
                                                'maximum_args           => '.$max,
                ) . ';',
            '}',
        );
    }

    return @code;
}

sub _inline_return_value {
    my $self = shift;
    my ($slot_access, $for_writer) = @_;

    return 'return ' . $self->_return_value($slot_access, $for_writer) . ';';
}

sub _minimum_arguments { 0 }
sub _maximum_arguments { undef }

override _get_value => sub {
    my $self = shift;
    my ($instance) = @_;

    return $self->_slot_access_can_be_inlined
        ? super()
        : $instance . '->$reader';
};

override _inline_store_value => sub {
    my $self = shift;
    my ($instance, $value) = @_;

    return $self->_slot_access_can_be_inlined
        ? super()
        : $instance . '->$writer(' . $value . ');';
};

override _eval_environment => sub {
    my $self = shift;

    my $env = super();

    $env->{'@curried'} = $self->curried_arguments;

    return $env if $self->_slot_access_can_be_inlined;

    my $reader = $self->associated_attribute->get_read_method_ref;
    $reader = $reader->body if blessed $reader;

    $env->{'$reader'} = \$reader;

    my $writer = $self->associated_attribute->get_write_method_ref;
    $writer = $writer->body if blessed $writer;

    $env->{'$writer'} = \$writer;

    return $env;
};

sub _slot_access_can_be_inlined {
    my $self = shift;

    return $self->is_inline && $self->_instance_is_inlinable;
}

no Moose::Role;

1;

Anon7 - 2022
AnonSec Team