| 1 | # ----------------------------------------------------------------------------- | ||
| 2 | |||
| 3 | =encoding utf8 | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Quiq::Text::Generator - Generiere Textfragmente | ||
| 8 | |||
| 9 | =head1 BASE CLASS | ||
| 10 | |||
| 11 | L<Quiq::Hash> | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | Ein Objekt der Klasse repräsentiert einen Generator für Text-Fragmente. | ||
| 16 | |||
| 17 | =cut | ||
| 18 | |||
| 19 | # ----------------------------------------------------------------------------- | ||
| 20 | |||
| 21 | package Quiq::Text::Generator; | ||
| 22 | 1 | ▶ | use base qw/Quiq::Hash/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | 1 | ▶ | use v5.10; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | |||
| 28 | 1 | our $VERSION = '1.240'; | |
| 29 | |||
| 30 | # ----------------------------------------------------------------------------- | ||
| 31 | |||
| 32 | =head1 METHODS | ||
| 33 | |||
| 34 | =head2 Klassenmethoden | ||
| 35 | |||
| 36 | =head3 new() - Konstuktor | ||
| 37 | |||
| 38 | =head4 Synopsis | ||
| 39 | |||
| 40 | $t = $class->new; | ||
| 41 | |||
| 42 | =head4 Description | ||
| 43 | |||
| 44 | Instantiiere ein Objekt der Klasse und liefere eine Referenz auf | ||
| 45 | dieses Objekt zurück. Da die Klasse ausschließlich Klassenmethoden | ||
| 46 | enthält, hat das Objekt ausschließlich die Funktion, eine abkürzende | ||
| 47 | Aufrufschreibweise zu ermöglichen. | ||
| 48 | |||
| 49 | =cut | ||
| 50 | |||
| 51 | # ----------------------------------------------------------------------------- | ||
| 52 | |||
| 53 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 54 | 0 | my $class = shift; | |
| 55 | 0 | return bless \(my $dummy),$class; | |
| 56 | } | ||
| 57 | |||
| 58 | # ----------------------------------------------------------------------------- | ||
| 59 | |||
| 60 | =head3 title() - Generiere eine unterstrichene Titelzeile | ||
| 61 | |||
| 62 | =head4 Synopsis | ||
| 63 | |||
| 64 | $text = $t->title($title); | ||
| 65 | |||
| 66 | =head4 Arguments | ||
| 67 | |||
| 68 | =over 4 | ||
| 69 | |||
| 70 | =item $title | ||
| 71 | |||
| 72 | Titelzeile | ||
| 73 | |||
| 74 | =back | ||
| 75 | |||
| 76 | =head4 Options | ||
| 77 | |||
| 78 | =over 4 | ||
| 79 | |||
| 80 | =item -lineChar => $char (Default: '-') | ||
| 81 | |||
| 82 | Zeichen für die Unterstreichung | ||
| 83 | |||
| 84 | =back | ||
| 85 | |||
| 86 | =head4 Returns | ||
| 87 | |||
| 88 | (String) Unterstrichene Titelzeile | ||
| 89 | |||
| 90 | =head4 Description | ||
| 91 | |||
| 92 | Erzeuge eine unterstrichene Titelzeile und liefere das Resultat zurück. | ||
| 93 | |||
| 94 | =head4 Example | ||
| 95 | |||
| 96 | $t->title('Geschäftsregeln'); | ||
| 97 | |||
| 98 | produziert | ||
| 99 | |||
| 100 | Geschäftsregeln | ||
| 101 | --------------- | ||
| 102 | |||
| 103 | =cut | ||
| 104 | |||
| 105 | # ----------------------------------------------------------------------------- | ||
| 106 | |||
| 107 | 0 | ▶ | sub title { |
|
Subroutine
title: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 108 | 0 | my ($this,$title) = splice @_,0,2; | |
| 109 | |||
| 110 | # Optionen und Argumente | ||
| 111 | |||
| 112 | 0 | my $lineChar = '-'; | |
| 113 | |||
| 114 | 0 | $this->parameters(\@_, | |
| 115 | -lineChar => \$lineChar, | ||
| 116 | ); | ||
| 117 | |||
| 118 | 0 | return "$title\n".($lineChar x length($title))."\n"; | |
| 119 | } | ||
| 120 | |||
| 121 | # ----------------------------------------------------------------------------- | ||
| 122 | |||
| 123 | =head1 VERSION | ||
| 124 | |||
| 125 | 1.240 | ||
| 126 | |||
| 127 | =head1 AUTHOR | ||
| 128 | |||
| 129 | Frank Seitz, L<http://fseitz.de/> | ||
| 130 | |||
| 131 | =head1 COPYRIGHT | ||
| 132 | |||
| 133 | Copyright (C) 2026 Frank Seitz | ||
| 134 | |||
| 135 | =head1 LICENSE | ||
| 136 | |||
| 137 | This code is free software; you can redistribute it and/or modify | ||
| 138 | it under the same terms as Perl itself. | ||
| 139 | |||
| 140 | =cut | ||
| 141 | |||
| 142 | # ----------------------------------------------------------------------------- | ||
| 143 | |||
| 144 | 1 | 1; | |
| 145 | |||
| 146 | # eof | ||