Result:
found more than 1074 distributions - search limited to the first 2001 files matching your query ( run in 1.099 )


CSS-Croco

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

sv_reftype|||
sv_release_COW|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.004050||p

 view all matches for this distribution


CSS-DOM

 view release on metacpan or  search on metacpan

lib/CSS/DOM.pm  view on Meta::CPAN

   warnings;

use CSS::DOM::Exception
	'SYNTAX_ERR' ,'HIERARCHY_REQUEST_ERR', 'INDEX_SIZE_ERR';
use CSS::DOM::Constants 'STYLE_RULE';
use Scalar::Util 'weaken';

require CSS::DOM::RuleList;

use constant 1.03 our $_constants = {
	ruls => 0,

lib/CSS/DOM.pm  view on Meta::CPAN

	my $old = (my $self = shift) ->[dsbl];
	@_ and $self->[dsbl] = shift;
	$old
};
sub ownerNode { defined $_[0][node]?$_[0][node]:() }
sub set_ownerNode { weaken($_[0]->[node] = $_[1]) }
sub parentStyleSheet { shift->[prsh]||() }
sub _set_parentStyleSheet { weaken($_[0]->[prsh] = $_[1]) }
sub href { shift->[hrfe] }
sub set_href { $_[0]->[hrfe] = $_[1] }
sub title { no warnings 'uninitialized';
           ''.(shift->ownerNode || return)->attr('title') }

lib/CSS/DOM.pm  view on Meta::CPAN


sub ownerRule {
	shift->[ownr] || ()
}
sub _set_ownerRule {
	weaken($_[0]->[ownr] = $_[1]);
}

# If you find a bug in the following three methods, Media.pm’s methods
# probably also need fixing.
sub cssRules { 

 view all matches for this distribution


CSS-Sass

 view release on metacpan or  search on metacpan

lib/CSS/ppport.h  view on Meta::CPAN

sv_reftype|||
sv_release_COW|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.004050||p

 view all matches for this distribution


Cache-Adaptive-ByLoad

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


Cache-Adaptive

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


Cache-CacheFactory

 view release on metacpan or  search on metacpan

lib/Cache/CacheFactory/Object.pm  view on Meta::CPAN

    $data = Storable::dclone( $data )
        if ref( $data ) and not $param->{ no_deep_clone };

    #  Set the data.
    $self->set_data( $data );
    #  TODO: weaken ref param handling here?

    #  Overrule default properties if they've been supplied.
    foreach my $property ( qw/created_at accessed_at expires_at/ )
    {
        if( exists( $param->{ $property } ) )

 view all matches for this distribution


Cache-Ehcache

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


Cache-FastMmap

 view release on metacpan or  search on metacpan

lib/Cache/FastMmap.pm  view on Meta::CPAN

  }

  # If using empty_on_exit, need to track used caches
  my $empty_on_exit = $Self->{empty_on_exit} = int($Args{empty_on_exit} || 0);

  # Need Scalar::Util::weaken to track open caches
  if ($empty_on_exit) {
    eval "use Scalar::Util qw(weaken); 1;"
      || die "Could not load Scalar::Util module: $@";
  }

  # Work out expiry time in seconds
  my $expire_time = $Self->{expire_time} = parse_expire_time($Args{expire_time});

lib/Cache/FastMmap.pm  view on Meta::CPAN


  # And initialise it
  fc_init($Cache);

  # Track cache if need to empty on exit
  weaken($LiveCaches{ref($Self)} = $Self)
    if $empty_on_exit;

  # All done, return PERL hash ref as class
  return $Self;
}

 view all matches for this distribution


Cache-LRU

 view release on metacpan or  search on metacpan

lib/Cache/LRU.pm  view on Meta::CPAN

        $$old_value_ref = undef;
    }

    # register
    my $value_ref = \$value;
    Scalar::Util::weaken($entries->{$key} = $value_ref);
    $self->_update_fifo($key, $value_ref);

    # expire the oldest entry if full
    while (scalar(keys %$entries) > $self->{size}) {
        my $exp_key = shift(@{$self->{_fifo}})->[0];

 view all matches for this distribution


Cache-Memcached-AnyEvent

 view release on metacpan or  search on metacpan

lib/Cache/Memcached/AnyEvent.pm  view on Meta::CPAN

    };

    foreach my $method ( qw( get get_multi ) ) {
        $installer->( $method, sub {
            my ($self, $keys, $cb) = @_;
            Scalar::Util::weaken($self);

            $self->_push_queue( $self->protocol->$method($self, $keys, $cb) );
        } );
    }

    foreach my $method ( qw( decr incr ) ) {
        $installer->($method, sub {
            my ($self, @args) = @_;
            my $cb = pop @args if (ref $args[-1] eq 'CODE' or ref $args[-1] eq 'AnyEvent::CondVar');
            my ($key, $value, $initial) = @args;
            Scalar::Util::weaken($self);
            $self->_push_queue( $self->protocol->$method( $self, $key, $value, $initial, $cb ) );
        });
    }

    foreach my $method ( qw(add append prepend replace set) ) {
        $installer->($method, sub {
            my ($self, @args) = @_;
            my $cb = pop @args if (ref $args[-1] eq 'CODE' or ref $args[-1] eq 'AnyEvent::CondVar');
            my ($key, $value, $exptime, $noreply) = @args;
            Scalar::Util::weaken($self);
            $self->_push_queue( $self->protocol->$method( $self, $key, $value, $exptime, $noreply, $cb ) );
        });
    }
}

 view all matches for this distribution


Cache-Memcached-Fast-Safe

 view release on metacpan or  search on metacpan

lib/Cache/Memcached/Fast/Safe.pm  view on Meta::CPAN

use warnings;
use Cache::Memcached::Fast 0.19;
use Digest::SHA qw/sha1_hex/;
use parent qw/Cache::Memcached::Fast/;
use POSIX::AtFork;
use Scalar::Util qw/weaken/;

our $VERSION = '0.06';
our $SANITIZE_METHOD = \&_sanitize_method;

{

lib/Cache/Memcached/Fast/Safe.pm  view on Meta::CPAN

sub new {
    my $class = shift;
    my %args = ref $_[0] ? %{$_[0]} : @_;
    my $mem = $class->SUPER::new(\%args);
    # fork safe
    weaken(my $mem_weaken = $mem);
    POSIX::AtFork->add_to_child(sub {
        eval { $mem_weaken->disconnect_all };
    });
    $mem;
}

for my $method ( qw/set cas add replace append prepend incr decr delete touch/ ) {

 view all matches for this distribution


Cache-Memcached-Fast

 view release on metacpan or  search on metacpan

lib/Cache/Memcached/Fast.pm  view on Meta::CPAN

    $conf->{serialize_methods} //= [ \&Storable::nfreeze, \&Storable::thaw ];

    my $memd = $class->_new($conf);

    my $context = [ $memd, $conf ];
    _weaken( $context->[0] );
    $instance{$$memd} = $context;

    return $memd;
}

 view all matches for this distribution


Cache-Memcached-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

sv_release_COW|||
sv_release_IVX|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.006000||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.006000||p

 view all matches for this distribution


Cache-Memcached-libmemcached

 view release on metacpan or  search on metacpan

lib/Cache/Memcached/libmemcached.pm  view on Meta::CPAN

    MEMCACHED_PREFIX_KEY_MAX_SIZE
);
use base qw(Memcached::libmemcached);

use Carp qw(croak carp);
use Scalar::Util qw(weaken);
use Storable ();

our $VERSION = '0.04001';

use constant HAVE_ZLIB    => eval { require Compress::Zlib } && !$@;

lib/Cache/Memcached/libmemcached.pm  view on Meta::CPAN


sub _mk_callbacks
{
    my $self = shift;

    weaken($self);
    my $inflate = sub {
        my ($key, $flags) = @_;
        if ($flags & F_COMPRESS) {
            if (! HAVE_ZLIB) {
                croak("Data for $key is compressed, but we have no Compress::Zlib");

 view all matches for this distribution


Cache-Sliding

 view release on metacpan or  search on metacpan

lib/Cache/Sliding.pm  view on Meta::CPAN

use utf8;
use Carp;

our $VERSION = 'v2.0.1';

use Scalar::Util qw( weaken );
use EV;


sub new {
    my ($class, $expire_after) = @_;
    my $self = {
        L1      => {},
        L2      => {},
        t       => undef,
    };
    weaken(my $this = $self);
    $self->{t} = EV::timer $expire_after, $expire_after, sub { if ($this) {
        $this->{L2} = $this->{L1};
        $this->{L1} = {};
    } };
    return bless $self, $class;

 view all matches for this distribution


Cache-Swifty

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

sv_release_COW|||
sv_release_IVX|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.006000||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.006000||p

 view all matches for this distribution


Cache-Weak

 view release on metacpan or  search on metacpan

lib/Cache/Weak.pm  view on Meta::CPAN

use warnings;

use version; our $VERSION = qv('1.0.3');

use Carp qw/carp croak/;
use Scalar::Util qw/weaken/;

use constant {
	DEFAULT_NAMESPACE => '_',
	DEFAULT_AUTO_PURGE_INTERVAL => 1000,
	DEFAULT_AUTO_PURGE => 1,

lib/Cache/Weak.pm  view on Meta::CPAN

	# is it time to purge cache from dead objects?
	if ( $self->auto_purge ) {
		$self->purge unless ( $self->_inc_count % $self->auto_purge_interval );
	}

	weaken ( $cache_data{ $self->namespace }{$key} = $object );
	return 1;
}

sub remove {
	my ( $self, $key ) = @_;

lib/Cache/Weak.pm  view on Meta::CPAN

=head1 DEPENDENCIES

This module requires weak references support in your system.
To find out if your system supports weak references, you can run this on the command line:

	perl -e 'use Scalar::Util qw(weaken)'

If you get an error message about weak references not being implemented, this module would
not work.

=head1 SEE ALSO

 view all matches for this distribution


Cache-utLRU

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

sv_ref||5.015004|
sv_replace|||
sv_report_used|||
sv_resetpvn|||
sv_reset|||
sv_rvweaken||5.006000|
sv_sethek|||
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||

 view all matches for this distribution


Cairo

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

sv_reftype|||
sv_release_COW|||
sv_replace|||
sv_report_used|||
sv_reset|||
sv_rvweaken||5.006000|
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||
sv_setpv_mg|5.004050||p

 view all matches for this distribution


CallBackery

 view release on metacpan or  search on metacpan

lib/CallBackery.pm  view on Meta::CPAN

use File::Basename;
use CallBackery::Config;
use CallBackery::Plugin::Doc;
use CallBackery::Database;
use CallBackery::User;
use Scalar::Util qw(weaken);

our $VERSION = '0.53.1';

=head2 config

lib/CallBackery.pm  view on Meta::CPAN

    my $app = shift;
    # having a non-C locale for number will wreck all sorts of havoc
    # when things get converted to string and back
    setlocale(LC_NUMERIC, "C");
    setlocale(LC_TIME, "C");
    weaken($app);
    $app->config->postProcessCfg();
    my $gcfg = $app->config->cfgHash->{BACKEND};
    if ($gcfg->{log_file}){
        if (open my $file, '>>', $gcfg->{log_file}){
           $app->log->handle($file);

 view all matches for this distribution


Callback-Frame

 view release on metacpan or  search on metacpan

lib/Callback/Frame.pm  view on Meta::CPAN


    $new_frame->{catcher} = $catcher if defined $catcher;
    $new_frame->{locals} = $locals if defined $locals;

    $active_frames->{$cb_address} = $new_frame;
    Scalar::Util::weaken($active_frames->{$cb_address});
  }

  $internal_cb = sub {
    my $orig_error = $@;

lib/Callback/Frame.pm  view on Meta::CPAN


    return $val;
  };

  my $final_cb = $ret_cb;
  Scalar::Util::weaken($ret_cb);

  return $final_cb;
}


 view all matches for this distribution


Capstone

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

sv_release_COW|||
sv_replace|||
sv_report_used|||
sv_resetpvn|||
sv_reset|||
sv_rvweaken||5.006000|
sv_sethek|||
sv_setiv_mg|5.004050||p
sv_setiv|||
sv_setnv_mg|5.006000||p
sv_setnv|||

 view all matches for this distribution


Carp-Datum

 view release on metacpan or  search on metacpan

Datum.pm  view on Meta::CPAN

happens correctly (in the proper state, the proper order, etc...) and cannot
be part of the contract (for external users of the class) since clients cannot
check that the pre-condition is true, because it will not have access to the
internal attributes.

Furthermore, in object-oriented programming, a redefined feature must I<weaken>
the pre-condition of its parent feature and I<strengthen> its post-condition.
It can also keep them as-is.  To fully understand why, it's best to read
Meyer.  Intuitively, it's easy to understand why the pre-condition cannot
be strengthened, nor why the post-condition cannot be weakened: because of dynamic
binding, a caller of r() only has the static type of the object, not its
dynamic type.  Therefore, it cannot know in advance which of the routines will
be called amongst the inheritance tree.

=head2 Common Pitfalls

 view all matches for this distribution


Cassandra-Client

 view release on metacpan or  search on metacpan

lib/Cassandra/Client/Connection.pm  view on Meta::CPAN

use Ref::Util qw/is_blessed_ref is_plain_arrayref/;
use IO::Socket::INET;
use IO::Socket::INET6;
use Errno qw/EAGAIN/;
use Socket qw/SOL_SOCKET IPPROTO_TCP SO_KEEPALIVE TCP_NODELAY/;
use Scalar::Util qw/weaken/;
use Net::SSLeay qw/ERROR_WANT_READ ERROR_WANT_WRITE ERROR_NONE/;

use Cassandra::Client::Util;
use Cassandra::Client::Protocol qw/
    :constants

lib/Cassandra/Client/Connection.pm  view on Meta::CPAN

        tls_want_write  => undef,

        healthcheck     => undef,
        protocol_version => $args{options}{protocol_version},
    }, $class;
    weaken($self->{async_io});
    weaken($self->{client});
    return $self;
}

sub get_local_status {
    my ($self, $callback)= @_;

 view all matches for this distribution


Catalyst-Action-Firebug

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


Catalyst-Component-ACCEPT_CONTEXT

 view release on metacpan or  search on metacpan

lib/Catalyst/Component/ACCEPT_CONTEXT.pm  view on Meta::CPAN

package Catalyst::Component::ACCEPT_CONTEXT;

use warnings;
use strict;
use MRO::Compat;
use Scalar::Util qw(weaken);

=head1 NAME

Catalyst::Component::ACCEPT_CONTEXT - Make the current Catalyst
request context available in Models and Views.

lib/Catalyst/Component/ACCEPT_CONTEXT.pm  view on Meta::CPAN

sub ACCEPT_CONTEXT {
    my $self    = shift;
    my $context = shift;

    $self->{context} = $context;
    weaken($self->{context});

    return $self->maybe::next::method($context, @_) || $self;
}

=head2 COMPONENT

lib/Catalyst/Component/ACCEPT_CONTEXT.pm  view on Meta::CPAN

sub COMPONENT {
    my $class = shift;
    my $app   = shift;
    my $args  = shift;
    $args->{context} = $app;
    weaken($args->{context}) if ref $args->{context};
    return $class->maybe::next::method($app, $args, @_);
}

=head1 AUTHOR

 view all matches for this distribution


Catalyst-Controller-FlashRemoting

 view release on metacpan or  search on metacpan

inc/Spiffy.pm  view on Meta::CPAN

      "  return \$_[0]->{%s} = do { my \$self = \$_[0]; %s }\n" .
      "    unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    weak_init =>
      "  return do {\n" .
      "    \$_[0]->{%s} = do { my \$self = \$_[0]; %s };\n" .
      "    Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n" .
      "    \$_[0]->{%s};\n" .
      "  } unless \$#_ > 0 or defined \$_[0]->{%s};\n",
    return_if_get => 
      "  return \$_[0]->{%s} unless \$#_ > 0;\n",
    set => 
      "  \$_[0]->{%s} = \$_[1];\n",
    weaken => 
      "  Scalar::Util::weaken(\$_[0]->{%s}) if ref \$_[0]->{%s};\n",
    sub_end => 
      "  return \$_[0]->{%s};\n}\n",
);

sub field {

inc/Spiffy.pm  view on Meta::CPAN

        local *paired_arguments = sub { (qw(-package -init)) };
        Spiffy->parse_arguments(@_);
    };
    my ($field, $default) = @values;
    $package = $args->{-package} if defined $args->{-package};
    die "Cannot have a default for a weakened field ($field)"
        if defined $default && $args->{-weak};
    return if defined &{"${package}::$field"};
    require Scalar::Util if $args->{-weak};
    my $default_string =
        ( ref($default) eq 'ARRAY' and not @$default )

inc/Spiffy.pm  view on Meta::CPAN

    }
    $code .= sprintf $code{set_default}, $field, $default_string, $field
      if defined $default;
    $code .= sprintf $code{return_if_get}, $field;
    $code .= sprintf $code{set}, $field;
    $code .= sprintf $code{weaken}, $field, $field 
      if $args->{-weak};
    $code .= sprintf $code{sub_end}, $field;

    my $sub = eval $code;
    die $@ if $@;

 view all matches for this distribution


Catalyst-Controller-FormBuilder

 view release on metacpan or  search on metacpan

lib/Catalyst/Controller/FormBuilder/Action.pm  view on Meta::CPAN

      unless exists $self->attributes->{ActionClass}
      && $self->attributes->{ActionClass}[0] eq
      $controller->_fb_setup->{action};

    my $form = $self->_setup_form(@_);
    Scalar::Util::weaken($form->{c});
    $controller->_formbuilder($form);
    $self->maybe::next::method(@_);
    $controller->_formbuilder($form);   # keep the same form in case of forwards

    $self->setup_template_vars( @_ );

 view all matches for this distribution


Catalyst-Controller-HTML-FormFu

 view release on metacpan or  search on metacpan

lib/Catalyst/Controller/HTML/FormFu.pm  view on Meta::CPAN

use Moose;

use HTML::FormFu;
use Config::Any;
use Regexp::Assemble;
use Scalar::Util qw/ isweak weaken /;
use Carp qw/ croak /;

use namespace::autoclean;

# see https://rt.cpan.org/Ticket/Display.html?id=55780

lib/Catalyst/Controller/HTML/FormFu.pm  view on Meta::CPAN

sub build_per_context_instance {
    my ( $self, $c ) = @_;
    return $self unless ( ref $c );
    $self->{c} = $c;

    weaken( $self->{c} )
        if !isweak( $self->{c} );

    return $self;
}

lib/Catalyst/Controller/HTML/FormFu.pm  view on Meta::CPAN

                        if /__config\(/;
                }
            }
        );

        weaken( $self->{c} )
            if !isweak( $self->{c} );
    }

    if ( $config->{languages_from_context} ) {
        $form->languages( $self->{c}->languages );

lib/Catalyst/Controller/HTML/FormFu.pm  view on Meta::CPAN

        $form->action($action);
    }

    my $context_stash = $config->{context_stash};
    $form->stash->{$context_stash} = $self->{c};
    weaken( $form->stash->{$context_stash} );

    my $model_stash = $config->{model_stash};

    for my $model ( keys %$model_stash ) {
        $form->stash->{$model} = $self->{c}->model( $model_stash->{$model} );

lib/Catalyst/Controller/HTML/FormFu.pm  view on Meta::CPAN

    </Controller::HTML::FormFu>

=head2 context_stash

To allow your form validation packages, etc, access to the catalyst context, a
weakened reference of the context is copied into the form's stash.

    $form->stash->{context};

This setting allows you to change the key name used in the form stash.

 view all matches for this distribution


Catalyst-Controller-LeakTracker

 view release on metacpan or  search on metacpan

lib/Catalyst/Controller/LeakTracker.pm  view on Meta::CPAN

use Data::Dumper ();
use Devel::Cycle ();
use Devel::Size ();
use Tie::RefHash::Weak ();
use YAML::XS ();
use Scalar::Util qw(weaken);

use namespace::clean -except => "meta";

{
    package Catalyst::Controller::LeakTracker::Template;

lib/Catalyst/Controller/LeakTracker.pm  view on Meta::CPAN

        $object->{foo}{self} = $object;
    }

    my $object2 = bless {}, "class::b";
    $object2->{foo}{self} = $object2;
    weaken($object2->{foo}{self});

    my $object3 = bless [], "class::c";
    push @$object3, $object3, map { [ 1 .. $n ] } 1 .. $n;

    $c->res->body("it leaks " . ( $n + 1 ) . " objects");

 view all matches for this distribution


( run in 1.099 second using v1.01-cache-2.11-cpan-65fba6d93b7 )