File: Sentinel.pm

package info (click to toggle)
liblv-perl 0.006-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 180 kB
  • sloc: perl: 176; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use 5.008;
use strict;
use warnings;

package LV::Backend::Sentinel;

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '0.006';

use Sentinel;

sub lvalue :lvalue
{
	my %args = @_;
	unless ($args{set} && $args{get})
	{
		my $caller = (caller(1))[3];
		$args{get} ||= sub { require Carp; Carp::croak("$caller is writeonly") };
		$args{set} ||= sub { require Carp; Carp::croak("$caller is readonly") };
	}
	sentinel(%args);
}

1;