1Convert::Binary::C::CacUhseedr(3C)ontributed Perl DocumeCnotnavteirotn::Binary::C::Cached(3)
2
3
4

NAME

6       Convert::Binary::C::Cached - Caching for Convert::Binary::C
7

SYNOPSIS

9         use Convert::Binary::C::Cached;
10         use Data::Dumper;
11
12         #------------------------
13         # Create a cached object
14         #------------------------
15         $c = Convert::Binary::C::Cached->new(
16                Cache   => '/tmp/cache.c',
17                Include => [
18                  '/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include',
19                  '/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include-fixed',
20                  '/usr/include',
21                ],
22              );
23
24         #----------------------------------------------------
25         # Parse 'time.h' and dump the definition of timespec
26         #----------------------------------------------------
27         $c->parse_file('time.h');
28
29         print Dumper($c->struct('timespec'));
30

DESCRIPTION

32       Convert::Binary::C::Cached simply adds caching capability to
33       Convert::Binary::C. You can use it in just the same way that you would
34       use Convert::Binary::C. The interface is exactly the same.
35
36       To use the caching capability, you must pass the "Cache" option to the
37       constructor. If you don't pass it, you will receive an ordinary
38       Convert::Binary::C object. The argument to the "Cache" option is the
39       file that is used for caching this object.
40
41       The caching algorithm automatically detects when the cache file cannot
42       be used and the original code has to be parsed.  In that case, the
43       cache file is updated. An update of the cache file can be triggered by
44       one or more of the following factors:
45
46       • The cache file doesn't exist, which is obvious.
47
48       • The cache file is corrupt, i.e. cannot be parsed.
49
50       • The object's configuration has changed.
51
52       • The embedded code for a "parse" method call has changed.
53
54       • At least one of the files that the object depends on does not exist
55         or has a different size or a different modification or change
56         timestamp.
57

LIMITATIONS

59       You cannot call "parse" or "parse_file" more that once when using a
60       Convert::Binary::C::Cached object. This isn't a big problem, as you
61       usually don't call them multiple times.
62
63       If a dependency file changes, but the change affects neither the size
64       nor the timestamps of that file, the caching algorithm cannot detect
65       that an update is required.
66
68       Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved.
69       This program is free software; you can redistribute it and/or modify it
70       under the same terms as Perl itself.
71

SEE ALSO

73       See Convert::Binary::C.
74
75
76
77perl v5.34.0                      2022-01-21     Convert::Binary::C::Cached(3)
Impressum