Quiq/Diff.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 32 / 32 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Quiq/Database/Api.pm ↑ Summary Quiq/Gd/Image.pm »
1 # -----------------------------------------------------------------------------
2  
3 =encoding utf8
4  
5 =head1 NAME
6  
7 Quiq::Diff - Zeige Differenzen zwischen Zeichenketten
8  
9 =head1 BASE CLASS
10  
11 L<Quiq::Object>
12  
13 =cut
14  
15 # -----------------------------------------------------------------------------
16  
17 package Quiq::Diff;
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::Path;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use Quiq::Shell;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 # -----------------------------------------------------------------------------
30  
31 =head1 METHODS
32  
33 =head2 Klassenmethoden
34  
35 =head3 diff() - Vergleiche Zeichenketten per diff(1)
36  
37 =head4 Synopsis
38  
39 $diff = $class->diff($str1,$str2);
40  
41 =head4 Arguments
42  
43 =over 4
44  
45 =item $str1
46  
47 Erste Zeichenkette.
48  
49 =item $str2
50  
51 Zweite Zeichenkette.
52  
53 =back
54  
55 =head4 Returns
56  
57 Differenzen (String)
58  
59 =head4 Description
60  
61 Vergleiche die Zeichenketten $str1 und $str2 per diff(1) und liefere
62 das Ergebnis zurück. Unterschiede im Umfang an Whitespace werden
63 ignoriert (diff-Option C<--ignore-space-change> ist gesetzt).
64  
65 =head4 See Also
66  
67 diff(1)
68  
69 =cut
70  
71 # -----------------------------------------------------------------------------
72  
73 1 ▶sub diff {
Subroutine diff: called CC=1 SCAR=0.0
Pod documented
74 1 my ($class,$str1,$str2) = @_;
75  
76 1 my $p = Quiq::Path->new;
77 1 my $file1 = $p->tempFile($str1);
78 1 my $file2 = $p->tempFile($str2);
79  
80 1 return Quiq::Shell->exec("diff --ignore-space-change $file1 $file2",
81 -capture => 'stdout',
82 -sloppy => 1,
83 );
84 }
85  
86 # -----------------------------------------------------------------------------
87  
88 =head1 VERSION
89  
90 1.240
91  
92 =head1 AUTHOR
93  
94 Frank Seitz, L<http://fseitz.de/>
95  
96 =head1 COPYRIGHT
97  
98 Copyright (C) 2026 Frank Seitz
99  
100 =head1 LICENSE
101  
102 This code is free software; you can redistribute it and/or modify
103 it under the same terms as Perl itself.
104  
105 =cut
106  
107 # -----------------------------------------------------------------------------
108  
109 1 1;
110  
111 # eof
« Quiq/Database/Api.pm ↑ Summary Quiq/Gd/Image.pm »