Avoid some echo '...\...' gotchas
[autoconf.git] / lib / Autom4te / Request.pm
blob4114e5edc8409f71aa9bdc9b81650a779957f5b9
1 # autoconf -- create 'configure' using m4 macros
2 # Copyright (C) 2001-2003, 2009-2017, 2020-2024 Free Software
3 # Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
18 package Autom4te::Request;
20 =head1 NAME
22 Autom4te::Request - a single m4 run request
24 =head1 SYNOPSIS
26 use Autom4te::Request;
28 =head1 DESCRIPTION
30 This perl module provides various general purpose support functions
31 used in several executables of the Autoconf and Automake packages.
33 =cut
35 use 5.006;
36 use strict;
37 use warnings FATAL => 'all';
39 use Carp;
40 use Class::Struct;
41 use Data::Dumper;
43 struct
45 # The key of the cache files.
46 'id' => "\$",
47 # True iff %MACRO contains all the macros we want to trace.
48 'valid' => "\$",
49 # The include path.
50 'path' => '@',
51 # The set of input files.
52 'input' => '@',
53 # The set of macros currently traced.
54 'macro' => '%',
58 # Serialize a request or all the current requests.
59 sub marshall($)
61 my ($caller) = @_;
63 # CALLER is an object: instance method.
64 my $marshall = Data::Dumper->new ([$caller]);
65 $marshall->Indent(2)->Terse(0);
67 # The Sortkeys method was added in Data::Dumper 2.12_01, so it is
68 # available in 5.8.x and 5.6.2 but not in 5.6.1 or earlier.
69 # Ignore failure of method lookup.
70 eval { $marshall->Sortkeys(1); };
72 return $marshall->Dump . "\n";
76 # includes_p ($SELF, @MACRO)
77 # --------------------------
78 # Does this request covers all the @MACRO.
79 sub includes_p
81 my ($self, @macro) = @_;
83 foreach (@macro)
85 return 0
86 if ! exists ${$self->macro}{$_};
88 return 1;
92 =head1 SEE ALSO
94 L<Autom4te::C4che>
96 =head1 HISTORY
98 Written by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.
100 =cut
104 1; # for require
106 ### Setup "GNU" style for perl-mode and cperl-mode.
107 ## Local Variables:
108 ## perl-indent-level: 2
109 ## perl-continued-statement-offset: 2
110 ## perl-continued-brace-offset: 0
111 ## perl-brace-offset: 0
112 ## perl-brace-imaginary-offset: 0
113 ## perl-label-offset: -2
114 ## cperl-indent-level: 2
115 ## cperl-brace-offset: 0
116 ## cperl-continued-brace-offset: 0
117 ## cperl-label-offset: -2
118 ## cperl-extra-newline-before-brace: t
119 ## cperl-merge-trailing-else: nil
120 ## cperl-continued-statement-offset: 2
121 ## End: