| 1 | # ----------------------------------------------------------------------------- | ||||||||||
| 2 | |||||||||||
| 3 | =encoding utf8 | ||||||||||
| 4 | |||||||||||
| 5 | =head1 NAME | ||||||||||
| 6 | |||||||||||
| 7 | Quiq::ContentProcessor::SubType - Sub-Typ Objekte | ||||||||||
| 8 | |||||||||||
| 9 | =head1 BASE CLASS | ||||||||||
| 10 | |||||||||||
| 11 | L<Quiq::ContentProcessor::BaseType> | ||||||||||
| 12 | |||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||
| 14 | |||||||||||
| 15 | Diese Klasse ist die Basisklasse von Typen, die keine Entitäten, | ||||||||||
| 16 | sondern Bestandteile von Entitäten sind. In Jaz werden | ||||||||||
| 17 | die Abschnitts-Objekte Group und Method durch SubTypes repräsentiert. | ||||||||||
| 18 | |||||||||||
| 19 | =cut | ||||||||||
| 20 | |||||||||||
| 21 | # ----------------------------------------------------------------------------- | ||||||||||
| 22 | |||||||||||
| 23 | package Quiq::ContentProcessor::SubType; | ||||||||||
| 24 | 1 | ▶ | use base qw/Quiq::ContentProcessor::BaseType/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | 1 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | |||||||||||
| 30 | 1 | our $VERSION = '1.240'; | |||||||||
| 31 | |||||||||||
| 32 | # ----------------------------------------------------------------------------- | ||||||||||
| 33 | |||||||||||
| 34 | =head1 METHODS | ||||||||||
| 35 | |||||||||||
| 36 | =head2 Erzeugung | ||||||||||
| 37 | |||||||||||
| 38 | =head3 create() - Wandele Abschnitts-Objekt in Subtyp-Objekt | ||||||||||
| 39 | |||||||||||
| 40 | =head4 Synopsis | ||||||||||
| 41 | |||||||||||
| 42 | $sty = $class->create($sec,$parent); | ||||||||||
| 43 | |||||||||||
| 44 | =head4 Arguments | ||||||||||
| 45 | |||||||||||
| 46 | =over 4 | ||||||||||
| 47 | |||||||||||
| 48 | =item $sec | ||||||||||
| 49 | |||||||||||
| 50 | Referenz auf Abschnitts-Objekt. | ||||||||||
| 51 | |||||||||||
| 52 | =item $parent | ||||||||||
| 53 | |||||||||||
| 54 | Referenz auf übergeordnetes (Sub)Typ-Objekt. | ||||||||||
| 55 | |||||||||||
| 56 | =back | ||||||||||
| 57 | |||||||||||
| 58 | =head4 Returns | ||||||||||
| 59 | |||||||||||
| 60 | Zum Subtyp geblesstes Abschnitts-Objekt. | ||||||||||
| 61 | |||||||||||
| 62 | =head4 Description | ||||||||||
| 63 | |||||||||||
| 64 | Erweitere Abschnitts-Objekt $sec und blesse es zu einem Subtyp-Objekt. | ||||||||||
| 65 | |||||||||||
| 66 | =cut | ||||||||||
| 67 | |||||||||||
| 68 | # ----------------------------------------------------------------------------- | ||||||||||
| 69 | |||||||||||
| 70 | 0 | ▶ | sub create { | ||||||||
|
Subroutine
create: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 71 | 0 | my ($class,$sec,$parent) = splice @_,0,3; | |||||||||
| 72 | # @_: @keyVal | ||||||||||
| 73 | |||||||||||
| 74 | # Inhalt und Abschnitts-Attribute prüfen | ||||||||||
| 75 | 0 | $sec->validate($class->contentAllowed,scalar $class->attributes); | |||||||||
| 76 | |||||||||||
| 77 | 0 | $sec->set( | |||||||||
| 78 | parent => $parent, | ||||||||||
| 79 | # memoize | ||||||||||
| 80 | name => undef, | ||||||||||
| 81 | # Subklassen-Attribute | ||||||||||
| 82 | @_, | ||||||||||
| 83 | ); | ||||||||||
| 84 | 0 | $sec->weaken('parent'); | |||||||||
| 85 | |||||||||||
| 86 | 0 | return bless $sec,$class; | |||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | # ----------------------------------------------------------------------------- | ||||||||||
| 90 | |||||||||||
| 91 | =head2 Objektmethoden | ||||||||||
| 92 | |||||||||||
| 93 | =head3 name() - Name der Sub-Entität | ||||||||||
| 94 | |||||||||||
| 95 | =head4 Synopsis | ||||||||||
| 96 | |||||||||||
| 97 | $name = $sty->name; | ||||||||||
| 98 | |||||||||||
| 99 | =head4 Description | ||||||||||
| 100 | |||||||||||
| 101 | Liefere den Namen der Sub-Entität. Dies ist der Wert | ||||||||||
| 102 | des Attributs C<Name:>, bereinigt um Besonderheiten: | ||||||||||
| 103 | |||||||||||
| 104 | =over 2 | ||||||||||
| 105 | |||||||||||
| 106 | =item * | ||||||||||
| 107 | |||||||||||
| 108 | ein Sigil am Namensanfang (z.B. C<°°>) wird entfernt | ||||||||||
| 109 | |||||||||||
| 110 | =back | ||||||||||
| 111 | |||||||||||
| 112 | =cut | ||||||||||
| 113 | |||||||||||
| 114 | # ----------------------------------------------------------------------------- | ||||||||||
| 115 | |||||||||||
| 116 | 0 | ▶ | sub name { | ||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 117 | 0 | my $self = shift; | |||||||||
| 118 | |||||||||||
| 119 | 0 | ▶ | return $self->memoize('name',sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 120 | 0 | my ($self,$key) = @_; | |||||||||
| 121 | |||||||||||
| 122 | 0 | my ($name) = $self->get('Name'); | |||||||||
| 123 | 0 | ▶ | if (!$name) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 124 | 0 | $self->throw; | |||||||||
| 125 | } | ||||||||||
| 126 | 0 | $name =~ s/^\W+//; # Sigil entfernen | |||||||||
| 127 | |||||||||||
| 128 | 0 | return $name; | |||||||||
| 129 | 0 | }); | |||||||||
| 130 | } | ||||||||||
| 131 | |||||||||||
| 132 | # ----------------------------------------------------------------------------- | ||||||||||
| 133 | |||||||||||
| 134 | =head1 VERSION | ||||||||||
| 135 | |||||||||||
| 136 | 1.240 | ||||||||||
| 137 | |||||||||||
| 138 | =head1 AUTHOR | ||||||||||
| 139 | |||||||||||
| 140 | Frank Seitz, L<http://fseitz.de/> | ||||||||||
| 141 | |||||||||||
| 142 | =head1 COPYRIGHT | ||||||||||
| 143 | |||||||||||
| 144 | Copyright (C) 2026 Frank Seitz | ||||||||||
| 145 | |||||||||||
| 146 | =head1 LICENSE | ||||||||||
| 147 | |||||||||||
| 148 | This code is free software; you can redistribute it and/or modify | ||||||||||
| 149 | it under the same terms as Perl itself. | ||||||||||
| 150 | |||||||||||
| 151 | =cut | ||||||||||
| 152 | |||||||||||
| 153 | # ----------------------------------------------------------------------------- | ||||||||||
| 154 | |||||||||||
| 155 | 1 | 1; | |||||||||
| 156 | |||||||||||
| 157 | # eof | ||||||||||