Quiq/MailTo.pm

filter: Statementstmt 65.5% 19 / 29 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 66.6% 26 / 39 CC 2 SCAR 8.1
CC
2
Cov
61%
url
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« Quiq/Ldap/Client.pm ↑ Summary Quiq/Json.pm »
1 # -----------------------------------------------------------------------------
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 Quiq::MailTo - Erzeuge mailto-URL
8  
9 =head1 BASE CLASS
10  
11 L<Quiq::Object>
12  
13 =cut
14  
15 # -----------------------------------------------------------------------------
16  
17 package Quiq::MailTo;
18 1 ▶use base qw/Quiq::Object/;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 our $VERSION = '1.240';
25  
26 1 ▶use Quiq::Parameters;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use Quiq::Url;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 # -----------------------------------------------------------------------------
30  
31 =head1 METHODS
32  
33 =head2 Klassenmethoden
34  
35 =head3 url() - Erzeuge mailto-URL
36  
37 =head4 Synopsis
38  
39 $url = $class->url($to,@keyVal);
40  
41 =head4 Arguments
42  
43 =over 4
44  
45 =item $to
46  
47 Liste der direkten Empfänger.
48  
49 =item @keyVal
50  
51 Optionale URL-Eigenschaften:
52  
53 =over 4
54  
55 =item cc => $cc
56  
57 Liste der Empfänger, die die Mail in Kopie erhalten.
58  
59 =item bcc => $bcc
60  
61 Liste der Empfänger, die die Mail als verdeckte Kopie erhalten.
62  
63 =item subject => $subject
64  
65 Betreff.
66  
67 =item body => $text
68  
69 Text.
70  
71 =back
72  
73 =back
74  
75 =head4 Returns
76  
77 (String) URL
78  
79 =head4 Description
80  
81 Erzeuge einen mailto-URL über den Schlüssel/Wert-Paaren @keyVal
82 und liefere diesen zurück.
83  
84 =head4 Example
85  
86 Quiq::MailTo->url('fs@fseitz.de',subject=>'Ein Test');
87 # =>
88 mailto:fs@fseitz.de?subject=Ein%20Test
89  
90 =cut
91  
92 # -----------------------------------------------------------------------------
93  
94 0 ▶sub url {
Subroutine url: not called CC=2 SCAR=17.9
Pod documented
95 0 my ($class,$to) = splice @_,0,2;
96  
97 0 my ($cc,$bcc,$subject,$body);
98  
99 0 Quiq::Parameters->extractPropertiesToVariables(\@_,
100 cc => \$cc,
101 bcc => \$bcc,
102 subject => \$subject,
103 body => \$body,
104 );
105  
106 0 my $u = Quiq::Url->new;
107  
108 0 my $url = 'mailto:'.$u->encode($to);
109 0 my $query = Quiq::Url->queryEncode(
110 cc => $cc,
111 bcc => $bcc,
112 subject => $subject,
113 body => $body,
114 );
115 0 ▶ if ($query) {
Branch: 1 branch
BranchTrueFalseTotal
if ($query) 0 0 0
116 0 $url .= "?$query";
117 }
118 0 $url =~ s/%40/\@/g;
119  
120 0 return $url;
121 }
122  
123 # -----------------------------------------------------------------------------
124  
125 =head1 VERSION
126  
127 1.240
128  
129 =head1 AUTHOR
130  
131 Frank Seitz, L<http://fseitz.de/>
132  
133 =head1 COPYRIGHT
134  
135 Copyright (C) 2026 Frank Seitz
136  
137 =head1 LICENSE
138  
139 This code is free software; you can redistribute it and/or modify
140 it under the same terms as Perl itself.
141  
142 =cut
143  
144 # -----------------------------------------------------------------------------
145  
146 1 1;
147  
148 # eof
« Quiq/Ldap/Client.pm ↑ Summary Quiq/Json.pm »