{"id":7067,"date":"2022-12-20T19:35:11","date_gmt":"2022-12-20T22:35:11","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/ioinnerfile-man3\/"},"modified":"2022-12-20T19:35:11","modified_gmt":"2022-12-20T22:35:11","slug":"ioinnerfile-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/ioinnerfile-man3\/","title":{"rendered":"IO::InnerFile (man3)"},"content":{"rendered":"<h1 align=\"center\">IO::InnerFile<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#CONSTRUCTORS\">CONSTRUCTORS<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#CONTRIBUTORS\">CONTRIBUTORS<\/a><br \/> <a href=\"#COPYRIGHT &#038; LICENSE\">COPYRIGHT &#038; LICENSE<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">IO::InnerFile \u2212 define a file inside another file<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use strict; <br \/> use warnings; <br \/> use IO::InnerFile; <br \/> # Read a subset of a file: <br \/> my $fh = _some_file_handle; <br \/> my $start = 10; <br \/> my $length = 50; <br \/> my $inner = IO::InnerFile\u2212>new($fh, $start, $length); <br \/> while (my $line = <$inner>) { <br \/> # &#8230; <br \/> }<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">If you have a file handle that can &#8220;seek&#8221; and &#8220;tell&#8221;, then you can open an IO::InnerFile on a range of the underlying file.<\/p>\n<h2>CONSTRUCTORS <a name=\"CONSTRUCTORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">IO::InnerFile implements the following constructors.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>new<\/b> <br \/> my $inner = IO::InnerFile\u2212>new($fh); <br \/> $inner = IO::InnerFile\u2212>new($fh, 10); <br \/> $inner = IO::InnerFile\u2212>new($fh, 10, 50);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Create a new IO::InnerFile opened on the given file handle. The file handle supplied <b><small>MUST<\/small><\/b> be able to both &#8220;seek&#8221; and &#8220;tell&#8221;.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The second and third parameters are start and length. Both are defaulted to zero (0). Negative values are silently coerced to zero.<\/p>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">IO::InnerFile implements the following methods.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>add_length<\/b> <br \/> $inner\u2212>add_length(30);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Add to the virtual length of the inner file by the number given in bytes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>add_start<\/b> <br \/> $inner\u2212>add_start(30);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Add to the virtual position of the inner file by the number given in bytes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>binmode<\/b> <br \/> $inner\u2212>binmode();<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This is a <small>NOOP<\/small> method just to satisfy the normal IO::File interface.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>close <br \/> fileno<\/b> <br \/> $inner\u2212>fileno();<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This is a <small>NOOP<\/small> method just to satisfy the normal IO::File interface.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>flush<\/b> <br \/> $inner\u2212>flush();<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This is a <small>NOOP<\/small> method just to satisfy the normal IO::File interface.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>get_end<\/b> <br \/> my $num_bytes = $inner\u2212>get_end();<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Get the virtual end position of the inner file in bytes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>get_length<\/b> <br \/> my $num_bytes = $inner\u2212>get_length();<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Get the virtual length of the inner file in bytes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>get_start<\/b> <br \/> my $num_bytes = $inner\u2212>get_start();<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Get the virtual position of the inner file in bytes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getc <br \/> getline <br \/> print <small>LIST<\/small> <br \/> printf <br \/> read <br \/> readline <br \/> seek <br \/> set_end<\/b> <br \/> $inner\u2212>set_end(30);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Set the virtual end of the inner file in bytes (this basically just alters the length).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>set_length<\/b> <br \/> $inner\u2212>set_length(30);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Set the virtual length of the inner file in bytes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>set_start<\/b> <br \/> $inner\u2212>set_start(30);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Set the virtual start position of the inner file in bytes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>tell <br \/> write<\/b><\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%;\">Eryq (<i>eryq@zeegee.com<\/i>). President, ZeeGee Software Inc (<i>http:\/\/www.zeegee.com<\/i>).<\/p>\n<h2>CONTRIBUTORS <a name=\"CONTRIBUTORS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Dianne Skoll (<i>dfs@roaringpenguin.com<\/i>).<\/p>\n<h2>COPYRIGHT &#038; LICENSE <a name=\"COPYRIGHT &#038; LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright (c) 1997 Erik (Eryq) Dorfman, ZeeGee Software, Inc. All rights reserved.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  IO::InnerFile \u2212 define a file inside another file <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3413,3007],"class_list":["post-7067","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-ioinnerfile","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7067"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7067\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}