.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "UR::Object::Type::AccessorWriter 3pm" .TH UR::Object::Type::AccessorWriter 3pm "2019-01-02" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" UR::Object::Type::AccessorWriter \- Helper module for UR::Object::Type responsible for creating accessors for properties .SH "DESCRIPTION" .IX Header "DESCRIPTION" Subroutines within this module actually live in the UR::Object::Type namespace; this module is just a convienent place to collect them. The class initializer uses these subroutines when it's time to create accessor methods for a newly defined class. Each accessor is implemented by a closure that is then assigned a name by Sub::Name and inserted into the defined class's namespace by Sub::Install. .SH "METHODS" .IX Header "METHODS" .IP "initialize_direct_accessors" 4 .IX Item "initialize_direct_accessors" .Vb 1 \& $classobj\->initialize_direct_accessors(); .Ve .Sp This is the entry point into the accessor writing system. It inspects each item in the 'has' key of the class object's hashref, and creates methods for each property. .IP "mk_rw_accessor" 4 .IX Item "mk_rw_accessor" .Vb 1 \& $classobj\->mk_rw_accessor($class_name, $accessor_name, $column_name, $property_name, $is_transient); .Ve .Sp Creates a mutable accessor named \f(CW$accessor_name\fR which stores its value in the \f(CW$property_name\fR key of the object's hashref. .IP "mk_ro_accessor" 4 .IX Item "mk_ro_accessor" .Vb 1 \& $classobj\->mk_ro_accessor($class_name, $accessor_name, $column_name, $property_name); .Ve .Sp Creates a read-only accessor named \f(CW$accessor_name\fR which retrieves its value in the \f(CW$property_name\fR key of the object's hashref. If the method is used as a mutator by passing in a value to the method, it will throw an exception with Carp::croak. .IP "mk_id_based_object_accessor" 4 .IX Item "mk_id_based_object_accessor" .Vb 2 \& $classobj\->mk_id_based_object_accessor($class_name, $accessor_name, $id_by, \& $r_class_name, $where); .Ve .Sp Creates an object accessor named \f(CW$accessor_name\fR. It returns objects of type \&\f(CW$r_class_name\fR, id-ed by the parameters named in the \f(CW$id_by\fR arrayref. \f(CW$where\fR is an optional listref of additional filters to apply when retrieving objects. .Sp The behavior of the created accessor depends on the number of parameters passed to it. For 0 params, it retrieves the object pointed to by \&\f(CW$r_class_name\fR and \f(CW$id_by\fR. For 1 param, it looks up the \s-1ID\s0 param values of the passed-in object-parameter, and reassigns value stored in the \f(CW$id_by\fR properties of the acted-upon object, effectively acting as a mutator. .Sp For more than 1 param, the additional parameters are taken as properties/values to filter the returned objects on .IP "mk_indirect_ro_accessor" 4 .IX Item "mk_indirect_ro_accessor" .Vb 1 \& $classobj\->mk_indirect_ro_accessor($class_name, $accessor_name, $via, $to, $where); .Ve .Sp Creates a read-only via accessor named \f(CW$accessor_name\fR. Its value is obtained by calling the object accessor named \f(CW$via\fR, and then calling the method \f(CW$to\fR on that object. The optional \f(CW$where\fR listref is used as additional filters when calling \f(CW$via\fR. .IP "mk_indirect_rw_accessor" 4 .IX Item "mk_indirect_rw_accessor" .Vb 2 \& $classobj\->mk_indirect_rw_accessor($class_name, $accessor_name, $via, $to, \& $where, $singular_name); .Ve .Sp Creates a via accessor named \f(CW$accessor_name\fR that is able to change the property it points to with \f(CW$to\fR when called as a mutator. If the \f(CW$to\fR property on the remote object is an \s-1ID\s0 property of its class, it deletes the refered-to object and creates a new one with the appropriate properties. Otherwise, it updates the \f(CW$to\fR property on the refered-to object. .IP "mk_calculation_accessor" 4 .IX Item "mk_calculation_accessor" .Vb 2 \& $classobj\->mk_calculation_accessor($class_name, $accessor_name, $calculation_src, \& $calculate_from, $params, $is_constant, $column_name); .Ve .Sp Creates a calculated accessor called \f(CW$accessor_name\fR. If the \f(CW$is_constant\fR flag is true, then the accessor runs the calculation once, caches the result, and returns that result for subsequent calls to the accessor. .Sp \&\f(CW$calculation_src\fR can be one of: coderef, string containing Perl code, or the name of a module under UR::Object::Type::AccessorWriter which has a method called \f(CW\*(C`calculate\*(C'\fR. If \f(CW$calculation_src\fR is empty, then \f(CW$accessor_name\fR must be the name of an already-existing subroutine in the class's namespace. .IP "mk_dimension_delegate_accessors" 4 .IX Item "mk_dimension_delegate_accessors" .PD 0 .IP "mk_dimension_identifying_accessor" 4 .IX Item "mk_dimension_identifying_accessor" .PD These create accessors for dealing with dimension tables in OLAP-type schemas. They need more documentation. .IP "mk_rw_class_accessor" 4 .IX Item "mk_rw_class_accessor" .Vb 1 \& $classobj\->mk_rw_class_accessor($class_name, $accessor_name, $column_name, $is_transient, $variable_value); .Ve .Sp Creates a read-write accessor called \f(CW$accessor_name\fR which stores its value in a scalar captured by the accessor's closure. Since the closure is inserted into the class's namespace, all instances of the class share the same closure (and therefore the same scalar), and the property effectively acts as a class-wide property. .IP "mk_ro_class_accessor" 4 .IX Item "mk_ro_class_accessor" .Vb 1 \& $classobj\->mk_ro_class_accessor($class_name, $accessor_name, $column_name, $variable_value); .Ve .Sp Creates a read-only accessor called \f(CW$accessor_name\fR which retrieves its value from a scalar captured by the accessor's closure. The value is initialized to \f(CW$variable_value\fR. If called as a mutator, it throws an exception through Carp::croak .SH "SEE ALSO" .IX Header "SEE ALSO" UR::Object::Type::AccessorWriter, UR::Object::Type