| 1 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | Quiq::Html::Construct - Generierung von einfachen Tag-Konstrukten | ||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | =head1 BASE CLASS | ||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | L<Quiq::Html::Tag> | ||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | Die Klasse erweitert ihre Basisklasse Quiq::Html::Tag um die | ||||||||||||||||||||||||||||||||
| 16 | Generierung von einfachen HTML-Konstrukten, die einerseits | ||||||||||||||||||||||||||||||||
| 17 | über Einzeltags hinausgehen, andererseits aber nicht die Implementierung | ||||||||||||||||||||||||||||||||
| 18 | einer eigenen Klasse rechtfertigen. | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | package Quiq::Html::Construct; | ||||||||||||||||||||||||||||||||
| 25 | 9 | ▶ | use base qw/Quiq::Html::Tag/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | 9 | ▶ | use v5.10; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 28 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 29 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 9 | our $VERSION = '1.240'; | |||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 9 | ▶ | use Quiq::Css; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 34 | 9 | ▶ | use Quiq::JavaScript; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||
| 38 | =head1 METHODS | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | =head2 Objektmethoden | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | =head3 loadFiles() - Lade CSS- und JavaScript-Dateien | ||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | =head4 Synopsis | ||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | $html = $class->loadFiles(@spec); | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | =cut | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | 6 | ▶ | sub loadFiles { | ||||||||||||||||||||||||||||||
|
Subroutine
loadFiles: called CC=10 SCAR=23.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 53 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||
| 54 | # @_: @spec | ||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 6 | my (%seen,@css,@js); | |||||||||||||||||||||||||||||||
| 57 | 6 | ▶ | for (my $i = 0; $i < @_; $i++) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 58 | 6 | my $arg = $_[$i]; | |||||||||||||||||||||||||||||||
| 59 | 6 | ▶ | if ($arg eq 'css' || $arg =~ /\.css$/) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$arg eq "css" or $arg =~ /\.css$/
MC/DC100%2/2
$arg eq "css" or $arg =~ /\.css$/
$arg eq "css"
$arg =~ /\.css$/
Truth table100%3/3
A or B
A= $arg eq "css"B= $arg =~ /\.css$/
| |||||||||||||||||||||||||||||||||
| 60 | 2 | ▶ | if ($arg eq 'css') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 61 | 1 | $i++; | |||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||
| 63 | 2 | my $url = $_[$i]; | |||||||||||||||||||||||||||||||
| 64 | 2 | ▶ | if ($seen{"css|$url"}++) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 65 | 0 | next; | |||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||
| 67 | 2 | push @css,Quiq::Css->style($self,$url); | |||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||
| 69 | ▶ | elsif ($arg eq 'js' || $arg =~ /\.js$/) { | |||||||||||||||||||||||||||||||
|
Condition66%2/3
$arg eq "js" or $arg =~ /\.js$/
MC/DC0%0/2
$arg eq "js" or $arg =~ /\.js$/
$arg eq "js"
$arg =~ /\.js$/
Truth table66%2/3
A or B
A= $arg eq "js"B= $arg =~ /\.js$/
| |||||||||||||||||||||||||||||||||
| 70 | 4 | ▶ | if ($arg eq 'js') { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 71 | 3 | $i++; | |||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||
| 73 | 4 | my $url = $_[$i]; | |||||||||||||||||||||||||||||||
| 74 | 4 | ▶ | if ($seen{"js|$url"}++) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 75 | 0 | next; | |||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||
| 77 | 4 | push @js,Quiq::JavaScript->script($self,$url); | |||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||
| 79 | else { | ||||||||||||||||||||||||||||||||
| 80 | 0 | $self->throw( | |||||||||||||||||||||||||||||||
| 81 | 'HTML-00099: Unexpected argument', | ||||||||||||||||||||||||||||||||
| 82 | Argument => $arg, | ||||||||||||||||||||||||||||||||
| 83 | ); | ||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | 6 | return join '',@css,@js; | |||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||
| 90 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||
| 92 | =head1 VERSION | ||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | 1.240 | ||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||
| 96 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||
| 98 | Frank Seitz, L<http://fseitz.de/> | ||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||
| 100 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | Copyright (C) 2026 Frank Seitz | ||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||
| 104 | =head1 LICENSE | ||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||
| 106 | This code is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||
| 107 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||
| 109 | =cut | ||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||
| 111 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | 9 | 1; | |||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||
| 115 | # eof | ||||||||||||||||||||||||||||||||