.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 "FFI::Build::File::Base 3pm" .TH FFI::Build::File::Base 3pm "2019-02-13" "perl v5.28.1" "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" FFI::Build::File::Base \- Base class for File::Build files .SH "VERSION" .IX Header "VERSION" version 0.83 .SH "SYNOPSIS" .IX Header "SYNOPSIS" Create your own file class .PP .Vb 4 \& package FFI::Build::File::Foo; \& use base qw( FFI::Build::File::Base ); \& use constant default_suffix => \*(Aq.foo\*(Aq; \& use constant default_encoding => \*(Aq:utf8\*(Aq; .Ve .PP Use it: .PP .Vb 2 \& # use an existing file in the filesystem \& my $file = FFI::Build::File::Foo\->new(\*(Aqsrc/myfile.foo\*(Aq); \& \& # generate a temp file with provided content \& # file will be deletd when $file falls out of scope. \& my $file = FFI::Build::File::Foo\->new(\e\*(Aqcontent for a temp foo\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class is the base class for other FFI::Build::File classes. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .SS "new" .IX Subsection "new" .Vb 2 \& my $file = FFI::Build::File::Base\->new(\e$content, %options); \& my $file = FFI::Build::File::Base\->new($filename, %options); .Ve .PP Create a new instance of the file class. You may provide either the content of the file as a scalar reference, or the path to an existing filename. Options: .IP "base" 4 .IX Item "base" The base name for any temporary file \f(CW\*(C`ffi_build_\*(C'\fR by default. .IP "build" 4 .IX Item "build" The FFI::Build instance to use. .IP "dir" 4 .IX Item "dir" The directory to store any temporary file. .IP "platform" 4 .IX Item "platform" The FFI::Build::Platform instance to use. .SH "METHODS" .IX Header "METHODS" .SS "default_suffix" .IX Subsection "default_suffix" .Vb 1 \& my $suffix = $file\->default_suffix; .Ve .PP \&\fB\s-1MUST\s0\fR be overridden in the subclass. This is the standard extension for the file type. \f(CW\*(C`.c\*(C'\fR for a C file, \f(CW\*(C`.o\*(C'\fR or \f(CW\*(C`.obj\*(C'\fR for an object file depending on platform. etc. .SS "default_encoding" .IX Subsection "default_encoding" .Vb 1 \& my $encoding = $file\->default_encoding; .Ve .PP \&\fB\s-1MUST\s0\fR be overridden in the subclass. This is the passed to \f(CW\*(C`binmode\*(C'\fR when the file is opened for reading or writing. .SS "accept_suffix" .IX Subsection "accept_suffix" .Vb 1 \& my @suffix_list = $file\->accept_suffix; .Ve .PP Returns a list of regexes that recognize the file type. .SS "path" .IX Subsection "path" .Vb 1 \& my $path = $file\->path; .Ve .PP The full or relative path to the file. .SS "basename" .IX Subsection "basename" .Vb 1 \& my $basename = $file\->basename; .Ve .PP The base filename part of the path. .SS "dirname" .IX Subsection "dirname" .Vb 1 \& my $dir = $file\->dirname; .Ve .PP The directory part of the path. .SS "is_temp" .IX Subsection "is_temp" .Vb 1 \& my $bool = $file\->is_temp; .Ve .PP Returns true if the file is temporary, that is, it will be deleted when the file object falls out of scope. You can call \f(CW\*(C`keep\*(C'\fR, to keep the file. .SS "platform" .IX Subsection "platform" .Vb 1 \& my $platform = $file\->platform; .Ve .PP The FFI::Build::Platform instance used for this file object. .SS "build" .IX Subsection "build" .Vb 1 \& my $build = $file\->build; .Ve .PP The FFI::Build instance used for this file object, if any. .SS "native" .IX Subsection "native" .Vb 1 \& my $path = $file\->native; .Ve .PP Returns the operating system native version of the filename path. On Windows, this means that forward slash \f(CW\*(C`\e\*(C'\fR is used instead of backslash \f(CW\*(C`/\*(C'\fR. .SS "slurp" .IX Subsection "slurp" .Vb 1 \& my $content = $file\->slurp; .Ve .PP Returns the content of the file. .SS "keep" .IX Subsection "keep" .Vb 1 \& $file\->keep; .Ve .PP Turns off the temporary flag on the file object, meaning it will not automatically be deleted when the file object is deallocated or falls out of scope. .SS "build_item" .IX Subsection "build_item" .Vb 1 \& $file\->build_item; .Ve .PP Builds the file into its natural output type, usually an object file. It returns a new file instance, or if the file is an object file then it returns empty list. .SS "needs_rebuild" .IX Subsection "needs_rebuild" .Vb 1 \& my $bool = $file\->needs_rebuild .Ve .SS "ld" .IX Subsection "ld" .SH "AUTHOR" .IX Header "AUTHOR" Author: Graham Ollis .PP Contributors: .PP Bakkiaraj Murugesan (bakkiaraj) .PP Dylan Cali (calid) .PP pipcet .PP Zaki Mughal (zmughal) .PP Fitz Elliott (felliott) .PP Vickenty Fesunov (vyf) .PP Gregor Herrmann (gregoa) .PP Shlomi Fish (shlomif) .PP Damyan Ivanov .PP Ilya Pavlov (Ilya33) .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2015,2016,2017,2018,2019 by Graham Ollis. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.