view release on metacpan or search on metacpan
t/30cpan_path.t view on Meta::CPAN
use warnings;
use Test::More;
# This tests attempts to load the maintainers file from cpan,
# which is blocked by cpantesters... which makes all its nice
# regression tests fail.
plan skip_all => "Running in cpantesters"
if $ENV{NO_NETWORK_TESTING};
plan tests => 4;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Labyrinth/Plugin/CPAN/Tester.pm view on Meta::CPAN
=over 4
=item CheckLock
Checks whether the specified user account is currently locked.
=item Lock
Tester has just registered on the site, lock the user profile until email is
confirmed.
lib/Labyrinth/Plugin/CPAN/Tester.pm view on Meta::CPAN
=cut
sub CheckLock {
my $userid = $tvars{'loginid'};
my @row = $dbi->GetQuery('hash','GetUserByID',$userid);
return if(@row && !$row[0]->{locked});
Labyrinth::Session::Logout();
$tvars{redirect} = '';
SetCommand('tester-locked');
}
sub Lock {
return unless RealmCheck('public','tester','admin');
my $userid = $cgiparams{'userid'};
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/html/js/tiny_mce/langs/en.js view on Meta::CPAN
browse:"Browse",
class_name:"Class",
not_set:"-- Not set --",
clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
invalid_data:"Error: Invalid values entered, these are marked in red.",
more_colors:"More colors"
},
contextmenu:{
align:"Alignment",
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/cgi-bin/templates/users/user-edit.html
vhost/cgi-bin/templates/users/user-failure.html
vhost/cgi-bin/templates/users/user-forgot.html
vhost/cgi-bin/templates/users/user-item.html
vhost/cgi-bin/templates/users/user-list.html
vhost/cgi-bin/templates/users/user-locked.html
vhost/cgi-bin/templates/users/user-login-author.html
vhost/cgi-bin/templates/users/user-login.html
vhost/cgi-bin/templates/users/user-login-tester.html
vhost/cgi-bin/templates/users/user-pass.html
vhost/cgi-bin/templates/users/user-registered.html
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/html/js/tiny_mce/langs/en.js view on Meta::CPAN
browse:"Browse",
class_name:"Class",
not_set:"-- Not set --",
clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
invalid_data:"Error: Invalid values entered, these are marked in red.",
more_colors:"More colors"
},
contextmenu:{
align:"Alignment",
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/cgi-bin/config/phrasebook.ini view on Meta::CPAN
# Wiki Pages
GetWikiPageVersion=SELECT * FROM wikipage WHERE pagename=? AND version=?
GetWikiPage=SELECT * FROM wikipage WHERE pagename=? ORDER BY version DESC LIMIT 1
SaveWikiPage=INSERT INTO wikipage (pagename,version,userid,comment,content,createdate) VALUES (?,?,?,?,?,?)
GetWikiHistory=SELECT w.pagename,w.version,w.createdate,w.comment,w.locked,u.* FROM wikipage AS w \
INNER JOIN users AS u ON w.userid=u.userid \
WHERE w.pagename=? ORDER BY w.version DESC
CheckWikiPage=SELECT version FROM wikipage WHERE pagename=? LIMIT 1
GetWikiIndex=SELECT * FROM wikiindex WHERE pagename=?
vhost/cgi-bin/config/phrasebook.ini view on Meta::CPAN
INNER JOIN users AS u ON w.userid=u.userid \
ORDER BY w.createdate DESC $limit
DeleteWikiPage=DELETE FROM wikipage WHERE version>? AND pagename=?
DeleteWikiPages=DELETE FROM wikipage WHERE pagename=?
DeleteWikiIndex=DELETE FROM wikiindex WHERE pagename=?
SetWikiLock=UPDATE wikipage SET locked=? WHERE pagename=?
WikiSearch=SELECT * FROM wikiindex AS x \
INNER JOIN wikipage AS w ON w.pagename=x.pagename AND w.version=x.version \
INNER JOIN users AS u ON w.userid=u.userid \
WHERE w.content LIKE ? \
view all matches for this distribution
view release on metacpan or search on metacpan
inc/bundle/Module/CoreList.pm view on Meta::CPAN
'CPAN::DeferredCode' => '5.50',
'CPAN::Distribution' => '1.93',
'CPAN::Distroprefs' => '6',
'CPAN::Distrostatus' => '5.5',
'CPAN::Exception::RecursiveDependency'=> '5.5',
'CPAN::Exception::blocked_urllist'=> '1.0',
'CPAN::Exception::yaml_not_installed'=> '5.5',
'CPAN::FTP' => '5.5001',
'CPAN::FTP::netrc' => '1.00',
'CPAN::FirstTime' => '5.53',
'CPAN::HandleConfig' => '5.5',
inc/bundle/Module/CoreList.pm view on Meta::CPAN
'B' => '1.29',
'CPAN' => '1.9600',
'CPAN::Author' => '5.5001',
'CPAN::CacheMgr' => '5.5001',
'CPAN::Distribution' => '1.9602',
'CPAN::Exception::blocked_urllist'=> '1.001',
'CPAN::HTTP::Client' => '1.9600',
'CPAN::HTTP::Credentials'=> '1.9600',
'CPAN::Index' => '1.9600',
'CPAN::LWP::UserAgent' => '1.9600',
'CPAN::Mirrors' => '1.9600',
inc/bundle/Module/CoreList.pm view on Meta::CPAN
'CPAN::DeferredCode' => 'cpan',
'CPAN::Distribution' => 'cpan',
'CPAN::Distroprefs' => 'cpan',
'CPAN::Distrostatus' => 'cpan',
'CPAN::Exception::RecursiveDependency'=> 'cpan',
'CPAN::Exception::blocked_urllist'=> 'cpan',
'CPAN::Exception::yaml_not_installed'=> 'cpan',
'CPAN::Exception::yaml_process_error'=> 'cpan',
'CPAN::FTP' => 'cpan',
'CPAN::FTP::netrc' => 'cpan',
'CPAN::FirstTime' => 'cpan',
inc/bundle/Module/CoreList.pm view on Meta::CPAN
'CPAN::DeferredCode' => undef,
'CPAN::Distribution' => undef,
'CPAN::Distroprefs' => undef,
'CPAN::Distrostatus' => undef,
'CPAN::Exception::RecursiveDependency'=> undef,
'CPAN::Exception::blocked_urllist'=> undef,
'CPAN::Exception::yaml_not_installed'=> undef,
'CPAN::Exception::yaml_process_error'=> undef,
'CPAN::FTP' => undef,
'CPAN::FTP::netrc' => undef,
'CPAN::FirstTime' => undef,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPAN/Audit/DB.pm view on Meta::CPAN
use warnings;
our $VERSION = '20260419.002';
sub db {
{"dists" => {"ActivePerl" => {"advisories" => [{"affected_versions" => ["==5.16.1.1601"],"cves" => ["CVE-2012-5377"],"description" => "Untrusted search path vulnerability in the installation functionality in ActivePerl 5.16.1.1601, when installed in...
}
__PACKAGE__;
view all matches for this distribution
view release on metacpan or search on metacpan
include/boost/container/detail/mutex.hpp view on Meta::CPAN
#ifndef _M_AMD64
/* These are already defined on AMD64 builds */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
long __cdecl _InterlockedCompareExchange(long volatile *Dest, long Exchange, long Comp);
long __cdecl _InterlockedExchange(long volatile *Target, long Value);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _M_AMD64 */
#pragma intrinsic (_InterlockedCompareExchange)
#pragma intrinsic (_InterlockedExchange)
#define interlockedcompareexchange _InterlockedCompareExchange
#define interlockedexchange _InterlockedExchange
#elif defined(WIN32) && defined(__GNUC__)
#define interlockedcompareexchange(a, b, c) __sync_val_compare_and_swap(a, c, b)
#define interlockedexchange __sync_lock_test_and_set
#endif /* Win32 */
/* First, define CAS_LOCK and CLEAR_LOCK on ints */
/* Note CAS_LOCK defined to return 0 on success */
include/boost/container/detail/mutex.hpp view on Meta::CPAN
#define BOOST_CONTAINER_CAS_LOCK(sl) boost_container_x86_cas_lock(sl)
#define BOOST_CONTAINER_CLEAR_LOCK(sl) boost_container_x86_clear_lock(sl)
#else /* Win32 MSC */
#define BOOST_CONTAINER_CAS_LOCK(sl) interlockedexchange((long volatile*)sl, (long)1)
#define BOOST_CONTAINER_CLEAR_LOCK(sl) interlockedexchange((long volatile*)sl, (long)0)
#endif
/* How to yield for a spin lock */
#define SPINS_PER_YIELD 63
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPU/Z80/Disassembler.pm view on Meta::CPAN
__PACKAGE__->mk_accessors(
'memory', # memory to disassemble
'_type', # identified type of each memory address, TYPE_xxx
'instr', # array of Instruction objects at each address
'labels', # all defined labels
'_call_instr', # hash of all call instructions where we are blocked
'_can_call', # hash of all subroutines we may call:
# 1 : can be called, no stack impact
# 0 : has stack impact, needs to be checked manually
# sub {} : call sub->($self, $next_addr) to handle
# stack impact and return next code addresses
lib/CPU/Z80/Disassembler.pm view on Meta::CPAN
# continue on next addresses
push @stack, $instr->next_code;
}
# check if we can unwind any blocked calls, after all paths without calls are
# exhausted
push @stack, $self->_check_call_instr;
}
}
lib/CPU/Z80/Disassembler.pm view on Meta::CPAN
sub _check_call_instr {
my($self) = @_;
my @stack;
# check simple call instructions where we blocked
for my $addr (keys %{$self->_call_instr}) {
my $instr = $self->_get_instr($addr);
my $call_addr = $instr->NN;
if ( # if any of the calls is conditional, then _can_call
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CTK/Configuration.pm view on Meta::CPAN
# Ok
my %newconfig = $cfg->getall if $cfg && $cfg->can('getall');
$self->{files} = [$cfg->files] if $cfg && $cfg->can('files');
# Set only unlocked keys
my %lkeys = ();
foreach my $k (@{(LOCKED_KEYS)}) { $lkeys{$k} = 1 }
foreach my $k (keys(%newconfig)) { $self->{conf}->{$k} = $newconfig{$k} if $k && !$lkeys{$k} }
# Set statuses
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CXC/DB/DDL/Util.pm view on Meta::CPAN
my \%types = $CACHE{$dbd}{types}{dbd};
return "&$name", $types{ $+{type} }
if exists $types{ $+{type} };
}
# $symbols is a locked hash, so can't just grab a value
my $symbols = types( $dbd );
if ( exists $symbols->{$name} && defined( my $sub = $symbols->{$name} ) ) {
return $class->_expand_field_sub( $cache, $stash->{field_class}, $name, $sub->() );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/AgainstFile/Storable.pm view on Meta::CPAN
_create_dir_if_required($dir);
#Select locking implementation
my $locking = $options->{Locking} || 'AtomicWrite';
if($locking eq 'Flock') {
$self->{write} = \&_write_locked;
$self->{read} = \&_read_locked;
} elsif ($locking eq 'AtomicWrite') {
$self->{write} = \&_write_atomic;
$self->{read} = \&_read;
} else {
croak("Unrecognised locking model '$locking'");
lib/Cache/AgainstFile/Storable.pm view on Meta::CPAN
#
# Subroutines
#
sub _read_locked {
my($cache_filename, $fh) = @_;
# we don't want the filehandle. Suppose it might need to be closed
# under Win32? Close it anyway
$fh->close if $fh;
check_safe($cache_filename,"r") if(HAVE_FILE_POLICY);
my $ref_data = lock_retrieve($cache_filename);
TRACE("Fetched from cache file: $cache_filename");
return $$ref_data;
}
sub _write_locked {
my ($cache_filename, $data, $mtime) = @_;
check_safe($cache_filename,"w") if(HAVE_FILE_POLICY);
lock_store(\$data, $cache_filename);
TRACE("wrote cache file: $cache_filename");
_backtouch($cache_filename, $mtime);
view all matches for this distribution
view release on metacpan or search on metacpan
t/03-lock.t view on Meta::CPAN
for (my $j = 1; $j <= $rows; $j++) {
# my $r = ($j ** $it) x 4;
# sleep 1 if $$ % 2 == 0;
my $lk = $c->{__db}->cds_lock;
# diag("$$: locked, setting row $j");
my $rv = $c->set($j, $$);
$lk->cds_unlock();
# diag("$$: unlocked");
#diag("$$: set $j");
push @ids, $j;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/SharedMemoryBackend.pm view on Meta::CPAN
sub delete_key
{
my ( $self, $p_namespace, $p_key ) = @_;
my $store_ref = $self->_get_locked_store_ref( );
delete $store_ref->{ $p_namespace }{ $p_key };
$self->_set_locked_store_ref( $store_ref );
}
sub delete_namespace
{
my ( $self, $p_namespace ) = @_;
my $store_ref = $self->_get_locked_store_ref( );
delete $store_ref->{ $p_namespace };
$self->_set_locked_store_ref( $store_ref );
}
sub store
{
my ( $self, $p_namespace, $p_key, $p_data ) = @_;
my $store_ref = $self->_get_locked_store_ref( );
$store_ref->{ $p_namespace }{ $p_key } = $p_data;
$self->_set_locked_store_ref( $store_ref );
}
# create a IPC::ShareLite share under the ipc_identifier
lib/Cache/SharedMemoryBackend.pm view on Meta::CPAN
$share->unlock( LOCK_UN );
}
sub _get_locked_store_ref
{
return _Restore_Shared_Hash_Ref_With_Lock( $IPC_IDENTIFIER );
}
sub _set_locked_store_ref
{
my ( $self, $p_store_ref ) = @_;
_Store_Shared_Hash_Ref_And_Unlock( $IPC_IDENTIFIER, $p_store_ref );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/Cascade.pm view on Meta::CPAN
In a multiprocess, and especially a multiserver application caching is a very
effective means of improving results.
The tradeoff of increasing the scale of the caching is in added complexity.
For example, caching in a FastMmap based storage is much slower than using a
memory based cache, because pages must be locked to ensure that no corruption
will happen. Likewise Memcached is even more overhead than FastMmap because it
is network bound, and uses blocking IO (on the client side).
This module attempts to make a transparent cascade of caches using several
backends.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/FastMmap.pm view on Meta::CPAN
not already exist. If the share_file specified does already
exist, it defaults to 0.
=item * B<catch_deadlocks>
Sets an alarm(10) before each page is locked via fcntl(F_SETLKW) to catch
any deadlock. This used to be the default behaviour, but it's not really
needed in the default case and could clobber sub-second Time::HiRes
alarms setup by other code. Defaults to 0.
=back
lib/Cache/FastMmap.pm view on Meta::CPAN
=item I<get_and_set($Key, $AtomicSub)>
Atomically retrieve and set the value of a Key.
The page is locked while retrieving the $Key and is unlocked only after
the value is set, thus guaranteeing the value does not change between
the get and set operations.
$AtomicSub is a reference to a subroutine that is called to calculate the
new value to store. $AtomicSub gets $Key, the current value from the
lib/Cache/FastMmap.pm view on Meta::CPAN
operations lock the page and you may end up with a dead lock!
=item *
If your sub does a die/throws an exception, the page will correctly
be unlocked (1.15 onwards)
=back
=cut
sub get_and_set {
lib/Cache/FastMmap.pm view on Meta::CPAN
=item I<get_and_remove($Key)>
Atomically retrieve value of a Key while removing it from the cache.
The page is locked while retrieving the $Key and is unlocked only after
the value is removed, thus guaranteeing the value stored by someone else
isn't removed by us.
=cut
sub get_and_remove {
lib/Cache/FastMmap.pm view on Meta::CPAN
=item I<multi_get($PageKey, [ $Key1, $Key2, ... ])>
The two multi_xxx routines act a bit differently to the
other routines. With the multi_get, you pass a separate
PageKey value and then multiple keys. The PageKey value
is hashed, and that page locked. Then that page is
searched for each key. It returns a hash ref of
Key => Value items found in that page in the cache.
The main advantage of this is just a speed one, if you
happen to need to search for a lot of items on each call.
lib/Cache/FastMmap.pm view on Meta::CPAN
=cut
sub _lock_page {
my ($Self, $Cache) = ($_[0], $_[0]->{Cache});
my $Unlock = Cache::FastMmap::OnLeave->new(sub {
fc_unlock($Cache) if fc_is_locked($Cache);
});
fc_lock($Cache, $_[1]);
return $Unlock;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/Isolator.pm view on Meta::CPAN
last TRYLOOP if $value;
$try++;
my @lockkeys = map { $key .":lock:". $_ } shuffle 1..$self->concurrency;
foreach my $lockkey ( @lockkeys ) {
my $locked = $self->cache->add($lockkey, 1, $self->timeout ); #lock
if ( $locked ) {
try {
$value = $self->get($key);
return 1 if $value;
$value = $cb->();
$self->set( $key, $value, $expires );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/Memcached/PDeque.pm view on Meta::CPAN
last if $have_lock;
sleep(.1);
}
affirm {
my $locked_by = $self->memcached->get("$priority:lock");
$$ == $locked_by;
};
}
sub _unlock {
my ( $self, $priority ) = @_;
affirm {
my $locked_by = $self->memcached->get("$priority:lock");
$$ == $locked_by;
};
$self->memcached->delete("$priority:lock");
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/Memcached/Queue.pm view on Meta::CPAN
my $serialized = $self->serializer->serialize($value);
$value = $serialized;
undef $serialized;
}
$self->load;
if(!$self->_is_locked || $self->_unlock){
$self->_lock;
my $size = $self->size // 0;
#checando se a fila esta cheia
if($self->max_enq > 0 && $self->size >= $self->max_enq){
say "Queue is full!";
lib/Cache/Memcached/Queue.pm view on Meta::CPAN
$self->memcached->set($new_last,$value,0);
}
$self->size($size);
$self->_save(['last','size']);
$self->_unlock if($self->_is_locked);
}
}
return $ok;
}
lib/Cache/Memcached/Queue.pm view on Meta::CPAN
sub deq {
my ( $self, ) = @_;
my ( $last_item,$value ) = ( undef,undef );
$self->load;
if(!$self->_is_locked || $self->_unlock ){
$self->_lock;
my $size = $self->size;
if(!$size){
say 'Queue is empty!';
}
lib/Cache/Memcached/Queue.pm view on Meta::CPAN
$self->_save(['last']);
}
}
$self->size($size);
$self->_save(['first','size']);
$self->_unlock if($self->_is_locked);
}
return $value // '';
}
lib/Cache/Memcached/Queue.pm view on Meta::CPAN
my ($self,$pid,$lock_pid) = (shift,$$,0);
$self->load;
my $qid = $self->qid;
confess "Panic! No 'qid'!" if (!defined($qid) || !$qid);
my $lock_idx = $qid . 'LOCKED';
$lock_pid = $self->_is_locked($lock_idx);
if(!$lock_pid){
my $rs = $self->memcached->set($lock_idx,$pid,0);
confess "Memcached server can't write!" if !defined($rs);
$lock_pid = $pid;
}
else {
say "is already locked!";
$lock_pid = 0;
}
$self->load;
return $lock_pid || 0;
}
lib/Cache/Memcached/Queue.pm view on Meta::CPAN
my ($self,$pid,$ok) = (shift,$$,0);
$self->load;
my $qid = $self->qid;
confess "Panic! No 'qid'!" if (!defined($qid) || !$qid);
my $lock_idx = $qid . 'LOCKED';
my $lock_pid = $self->_is_locked($lock_idx);
if($lock_pid && $lock_pid == $pid){
my $rs = $self->memcached->set($lock_idx,0,0);
confess "Memcached can't write!" if !defined($rs);
$ok = 1;
}
elsif($lock_pid && $lock_pid != $pid){
say "Is locked by another process! $lock_pid";
}
$self->load;
return $ok;
}
lib/Cache/Memcached/Queue.pm view on Meta::CPAN
sub _is_locked {
my ($self,$lock_idx) = @_;
$lock_idx = 0 if !defined $lock_idx;
my $found = 0;
# confess "Parameter 'lock_idx' is mandatory!" if (!defined($lock_idx) || !$lock_idx);
if(!defined($lock_idx) || !$lock_idx){
$lock_idx = $self->qid . 'LOCKED';
}
my $lock_pid = $self->memcached->get($lock_idx); #this pid locked the queue!
# $lock_pid = 0 if $$ == $lock_pid;
# foreach my $p(@{$t->table}){
# if($p->pid == $lock_pid){
# $found = $p->pid;
# last;
view all matches for this distribution
view release on metacpan or search on metacpan
t/001.lock.t view on Meta::CPAN
my $c_lock = Cache::Memcached::Semaphore->new( memd => $memd, name => "c_test" );
my $s_lock = Cache::Memcached::Semaphore::acquire( memd => $memd, name => "s_test" );
ok( $c_lock, "Inner block constructor acquired" );
ok( $s_lock, "Inner block sub acquired" );
ok( !Cache::Memcached::Semaphore->new( memd => $memd, name => "c_test" ), "Inner block constructor locked" );
ok( !Cache::Memcached::Semaphore::acquire( memd => $memd, name => "s_test" ), "Inner block sub locked" );
}
my $c_lock = Cache::Memcached::Semaphore->new( memd => $memd, name => "c_test" );
my $s_lock = Cache::Memcached::Semaphore::acquire( memd => $memd, name => "s_test" );
ok( $c_lock, "Outer block constructor acquired" );
ok( $s_lock, "Outer block sub acquired" );
ok( !Cache::Memcached::Semaphore->new( memd => $memd, name => "c_test" ), "Outer block constructor locked" );
ok( !Cache::Memcached::Semaphore::acquire( memd => $memd, name => "s_test" ), "Outer block sub locked" );
# timeout
ok( Cache::Memcached::Semaphore->new( memd => $memd, name => "c_timeout", timeout => 10 ), "Constructor with timeout" );
ok( !Cache::Memcached::Semaphore->new( memd => $memd, name => "c_timeout", timeout => 10 ), "Constructor with timeout locked" );
ok( Cache::Memcached::Semaphore::acquire( memd => $memd, name => "s_timeout", timeout => 10 ), "Sub with timeout" );
ok( !Cache::Memcached::Semaphore::acquire( memd => $memd, name => "s_timeout", timeout => 10 ), "Sub with timeout locked" );
ok( Cache::Memcached::Semaphore::wait_acquire( memd => $memd, name => "w_timeout", timeout => 2 ), "Wait lock. Create with timeout" );
ok( Cache::Memcached::Semaphore::wait_acquire( memd => $memd, name => "w_timeout", timeout => 10), "Wait indefinitely. Create with timeout" );
ok( !Cache::Memcached::Semaphore::wait_acquire( memd => $memd, name => "w_timeout", timeout => 10, max_wait => 1), "Wait 1 sec. No acquire" );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/Memcached/Turnstile.pm view on Meta::CPAN
computed values for each input key in turn.
The C<wait> parameter works fundamentally the same as in the single-key function,
but the callback variant also receives a third parameter:
The list of keys whose values weren't available from the cache and couldn't be
locked for computation. The callback is expected to return a hash reference
of keys and values. This is different from the C<compute_cb> interface
to allow for easy calling back into C<multi_cache_get_or_compute> for retries
(see the C<wait> example for the single-key implementation above).
As with the single-key variant, C<compute_time> is the additional
view all matches for this distribution
view release on metacpan or search on metacpan
or croak "Can't seek to beginning: $!";
syswrite($self->{_fh},$head,$headsize)==$headsize
or croak "Can't write file header: $!";
}
# mmap() isn't supposed to work on locked files, so unlock
$self->_unlock;
mmap($self->{_mmap}='',$size,$self->{_fh})
or do{
delete $self->{_mmap};
close $self->{_fh};
}
=item _lock($offset)
Lock the cache file. If $offset is zero, the file header is locked.
Otherwise, the bucket starting at $offset is locked.
XXX This also needs to create an internal lock if threading is enabled.
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
get_if_same:
if(!defined(is_same(...))) {
if(my $FH = open_with_flock(LOCK_EX, block => 0)) {
$cache::static::_curr_locked_FH = $FH;
} else {
#wait until it's been set, then return it
open_with_flock(LOCK_SH, block => 1);
return get(...);
}
} else {
return get(...);
}
set:
my $FH = $cache::static::_curr_locked_FH || open(...);
...
close($FH);
an optimization idea stolen from the lighthttpd folks:
in the case where you allow old results:
before writing, copy the cache file "$f" to "$f.bak"
any get_if_same() during that time reads "$f.bak"
when done, remove "$f.bak" (this results in race condition in reader:
1 - find the file locked, try the .bak file
2 - .bak file is removed, goto 1
OR have a crontab that runs e.g. hourly to clean up .bak files...
start the lock when generation starts, remove the lock when new value
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cache/File.pm view on Meta::CPAN
sub purge {
my Cache::File $self = shift;
my $time = time();
# if it's locked, someone else will probably be doing a purge already
$self->trylock() or return;
# open expiry index
my $expheap = $self->get_exp_heap();
lib/Cache/File.pm view on Meta::CPAN
return $self->lock(1);
}
sub unlock {
my Cache::File $self = shift;
$self->{lock} or croak "not locked";
return unless --$self->{lockcount} == 0;
# close heaps and save counts
$self->{openexp} = undef;
$self->{openage} = undef;
lib/Cache/File.pm view on Meta::CPAN
}
sub get_index {
my Cache::File $self = shift;
unless ($self->{openidx}) {
$self->{lock} or croak "not locked";
my $indexfile = $self->{index};
File::NFSLock::uncache($indexfile) if $self->{locklevel} == LOCK_NFS;
my $oldmask = umask $self->cache_umask();
lib/Cache/File.pm view on Meta::CPAN
}
sub _open_heap {
my Cache::File $self = shift;
my ($heapfile) = @_;
$self->{lock} or croak "not locked";
File::NFSLock::uncache($heapfile) if $self->{locklevel} == LOCK_NFS;
my $oldmask = umask $self->cache_umask();
my $heap = Cache::File::Heap->new($heapfile);
view all matches for this distribution
view release on metacpan or search on metacpan
t/02locks.t view on Meta::CPAN
my $cal2;
ok($cal2 = get_cal_dav('birthday.ics'), "Instantiated ok");
ok(!$cal2->lock, "Failed to get lock with second cal");
# Unlock
ok($cal->unlock, "Unlocked first cal");
# Obtain lock
ok($cal2->lock, "Got lock with second cal");
# Forceably unlock
ok($cal->forcefully_unlock_all, "First cal forcefully unlocked");
# Lock
ok($cal->lock, "First cal got lock back");
# Steal lock
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Calendar/Plugin/Renderer.pm view on Meta::CPAN
my $text = Calendar::Plugin::Renderer::Text->new($params);
my $line1 = $text->get_dashed_line;
my $line2 = $text->get_month_header;
my $line3 = $text->get_blocked_line;
my $line4 = $text->get_day_header;
my $empty = $text->get_empty_space;
my $dates = $text->get_dates;
my $calendar = join("\n", $line1, $line2, $line3, $line4, $line3, $empty.$dates)."\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CallBackery/qooxdoo/callbackery/source/class/callbackery/ui/Busy.js view on Meta::CPAN
@asset(callbackery/spinner.gif);
*/
/**
* singleton with two methods for blocking and unblocking the screen. while the screen
* is blocked, a busy icon is shown.
*
* <pre code='javascript'>
* var busy = callbackery.ui.Busy.getInstance();
* busy.manifest();busy.vanish();
* </pre>
view all matches for this distribution
view release on metacpan or search on metacpan
- Added get/set/has/clear property methods
0.002001 2010-01-16
- Updated tests to use Directory::Scratch rather than messing with FindBin
0.002000
- INCOMPATIBLE CHANGE: renamed 'set_metadata' to 'metadata'
- Added grep_files and map_files methods (were blocked by Path::Class bug)
- Updated tests to use Test::Manifest instead of numbered tests.
- Updated POD
0.001000 2009-11-25
- Initial Release
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Captive/Portal/LockHandle.pm view on Meta::CPAN
}
}
=item $handle->DESTROY()
Called whenever the locked filehandle is destroyed. Just implemented to get proper debug messages for locking/unlocking.
=cut
sub DESTROY {
my $lock_handle = shift;
view all matches for this distribution