.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" ======================================================================== .\" .IX Title "Object::Pad::FieldAttr::Trigger 3pm" .TH Object::Pad::FieldAttr::Trigger 3pm 2024-03-07 "perl v5.38.2" "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 "Object::Pad::FieldAttr::Trigger" \- invoke an instance method after a ":writer" accessor .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Object::Pad; \& use Object::Pad::FieldAttr::Trigger; \& \& class Label { \& field $title :param :reader :writer :Trigger(redraw); \& \& method redraw { \& ... \& } \& } \& \& my $label = Label\->new( text => "Something" ); \& \& $label\->set_label( "New text here" ); \& # $label\->redraw is automatically invoked .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides a third-party field attribute for Object::Pad\-based classes, which declares that a named instance method shall be invoked after a generated \f(CW\*(C`:writer\*(C'\fR accessor method is called. .PP \&\fBWARNING\fR The ability for Object::Pad to take third-party field attributes is still new and highly experimental, and subject to much API change in future. As a result, this module should be considered equally experimental. .SH "FIELD ATTRIBUTES" .IX Header "FIELD ATTRIBUTES" .SS :Trigger .IX Subsection ":Trigger" .Vb 1 \& field $name :writer :Trigger(NAME) ...; .Ve .PP Declares that the accessor method generated for the field by the \f(CW\*(C`:writer\*(C'\fR attribute will invoke the method named by the \f(CW\*(C`:Trigger\*(C'\fR attribute, after the new value has been stored into the field itself. This method is invoked with no additional arguments, in void context. .PP Note that this only applies to the generated accessor method. It does not apply to direct modifications of the field variable by method code within the class itself. .SH AUTHOR .IX Header "AUTHOR" Paul Evans