blib/lib/Class/MakeMethods/Template/Scalar.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 94.4% 17 / 18 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Class/MakeMethods/Template/Global.pm ↑ Summary blib/lib/Class/MakeMethods/Standard.pm »
1 package Class::MakeMethods::Template::Scalar;
2  
3 4 ▶use Class::MakeMethods::Template::Generic '-isasubclass';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 $VERSION = 1.008;
6 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 require 5.00;
8 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 Class::MakeMethods::Template::Scalar - Methods for blessed scalars
13  
14 =head1 SYNOPSIS
15  
16 package MyObject;
17 use Class::MakeMethods::Template::ExternalData (
18 new => 'new',
19 scalar => 'foo',
20 );
21
22 package main;
23  
24 my $obj = MyObject->new( foo => "Foozle" );
25 print $obj->foo(); # Prints Foozle
26 $obj->foo("Bamboozle"); # Sets $$obj
27 print $obj->foo(); # Prints Bamboozle
28  
29 =head1 DESCRIPTION
30  
31 Supports the Generic object constructor and accessors meta-method
32 types, but uses scalar refs as the underlying implementation type,
33 so only one accessor method can be used effectively.
34  
35 =cut
36  
37 4 ▶sub generic {
Subroutine generic: called CC=1 SCAR=0.0
Pod undocumented
38 {
39 4 '-import' => {
40 'Template::Generic:generic' => '*'
41 },
42 'code_expr' => {
43 _VALUE_ => '(${_SELF_})',
44 _EMPTY_NEW_INSTANCE_ => 'bless \( my $scalar = undef ), _SELF_CLASS_',
45 },
46 'params' => {
47 }
48 }
49 }
50  
51 ########################################################################
52  
53 =head2 Standard Methods
54  
55 The following methods from Generic are all supported:
56  
57 new
58 scalar
59 string
60 string_index
61 number
62 boolean
63 bits
64 array
65 hash
66 tiedhash
67 hash_of_arrays
68 object
69 instance
70 array_of_objects
71 code
72 code_or_scalar
73  
74 See L<Class::MakeMethods::Template::Generic> for the interfaces and behaviors of these method types.
75  
76 However, note that due to special nature of this package, all accessor methods reference the same scalar value, so setting a value with one method will overwrite the value retrieved by another.
77  
78 =cut
79  
80 4 1;
« blib/lib/Class/MakeMethods/Template/Global.pm ↑ Summary blib/lib/Class/MakeMethods/Standard.pm »