.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Convert::Binary::C::Cached 3pm" .TH Convert::Binary::C::Cached 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Convert::Binary::C::Cached \- Caching for Convert::Binary::C .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Convert::Binary::C::Cached; \& use Data::Dumper; \& \& #\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& # Create a cached object \& #\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& $c = Convert::Binary::C::Cached\->new( \& Cache => \*(Aq/tmp/cache.c\*(Aq, \& Include => [ \& \*(Aq/usr/lib/gcc/x86_64\-pc\-linux\-gnu/10.2.0/include\*(Aq, \& \*(Aq/usr/lib/gcc/x86_64\-pc\-linux\-gnu/10.2.0/include\-fixed\*(Aq, \& \*(Aq/usr/include\*(Aq, \& ], \& ); \& \& #\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& # Parse \*(Aqtime.h\*(Aq and dump the definition of timespec \& #\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& $c\->parse_file(\*(Aqtime.h\*(Aq); \& \& print Dumper($c\->struct(\*(Aqtimespec\*(Aq)); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Convert::Binary::C::Cached simply adds caching capability to Convert::Binary::C. You can use it in just the same way that you would use Convert::Binary::C. The interface is exactly the same. .PP To use the caching capability, you must pass the \f(CW\*(C`Cache\*(C'\fR option to the constructor. If you don't pass it, you will receive an ordinary Convert::Binary::C object. The argument to the \f(CW\*(C`Cache\*(C'\fR option is the file that is used for caching this object. .PP The caching algorithm automatically detects when the cache file cannot be used and the original code has to be parsed. In that case, the cache file is updated. An update of the cache file can be triggered by one or more of the following factors: .IP \(bu 2 The cache file doesn't exist, which is obvious. .IP \(bu 2 The cache file is corrupt, i.e. cannot be parsed. .IP \(bu 2 The object's configuration has changed. .IP \(bu 2 The embedded code for a \f(CW\*(C`parse\*(C'\fR method call has changed. .IP \(bu 2 At least one of the files that the object depends on does not exist or has a different size or a different modification or change timestamp. .SH LIMITATIONS .IX Header "LIMITATIONS" You cannot call \f(CW\*(C`parse\*(C'\fR or \f(CW\*(C`parse_file\*(C'\fR more that once when using a Convert::Binary::C::Cached object. This isn't a big problem, as you usually don't call them multiple times. .PP If a dependency file changes, but the change affects neither the size nor the timestamps of that file, the caching algorithm cannot detect that an update is required. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (c) 2002\-2020 Marcus Holland-Moritz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" See Convert::Binary::C.