{
    "mode": "perldoc",
    "parameter": "MARC::File",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/MARC%3A%3AFile/json",
    "generated": "2026-06-13T14:29:14Z",
    "synopsis": "use MARC::File::USMARC;\n# If you have weird control fields...\nuse MARC::Field;\nMARC::Field->allowcontrolfieldtags('FMT', 'LDX');\nmy $file = MARC::File::USMARC->in( $filename );\nwhile ( my $marc = $file->next() ) {\n# Do something\n}\n$file->close();\nundef $file;",
    "sections": {
        "NAME": {
            "content": "MARC::File - Base class for files of MARC records\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use MARC::File::USMARC;\n\n# If you have weird control fields...\nuse MARC::Field;\nMARC::Field->allowcontrolfieldtags('FMT', 'LDX');\n\nmy $file = MARC::File::USMARC->in( $filename );\n\nwhile ( my $marc = $file->next() ) {\n# Do something\n}\n$file->close();\nundef $file;\n",
            "subsections": []
        },
        "EXPORT": {
            "content": "None.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "in()\nOpens a file for import. Ordinarily you will use \"MARC::File::USMARC\" or \"MARC::File::MicroLIF\"\nto do this.\n\nmy $file = MARC::File::USMARC->in( 'file.marc' );\n\nReturns a \"MARC::File\" object, or \"undef\" on failure. If you encountered an error the error\nmessage will be stored in $MARC::File::ERROR.\n\nOptionally you can also pass in a filehandle, and \"MARC::File\". will \"do the right thing\".\n\nmy $handle = IO::File->new( 'gunzip -c file.marc.gz |' );\nmy $file = MARC::File::USMARC->in( $handle );\n\nnext( [\\&filterfunc] )\nReads the next record from the file handle passed in.\n\nThe $filterfunc is a reference to a filtering function. Currently, only USMARC records support\nthis. See MARC::File::USMARC's \"decode()\" function for details.\n\nReturns a MARC::Record reference, or \"undef\" on error.\n\nskip()\nSkips over the next record in the file. Same as \"next()\", without the overhead of parsing a\nrecord you're going to throw away anyway.\n\nReturns 1 or undef.\n\nwarnings()\nSimlilar to the methods in MARC::Record and MARC::Batch, \"warnings()\" will return any warnings\nthat have accumulated while processing this file; and as a side-effect will clear the warnings\nbuffer.\n\nclose()\nCloses the file, both from the object's point of view, and the actual file.\n\nwrite()\nWrites a record to the output file. This method must be overridden in your subclass.\n\ndecode()\nDecodes a record into a USMARC format. This method must be overridden in your subclass.\n",
            "subsections": []
        },
        "RELATED MODULES": {
            "content": "MARC::Record\n",
            "subsections": []
        },
        "TODO": {
            "content": "*   \"out()\" method\n\nWe only handle files for input right now.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "This code may be distributed under the same terms as Perl itself.\n\nPlease note that these modules are not products of or supported by the employers of the various\ncontributors to the code.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Andy Lester, \"<andy@petdance.com>\"\n",
            "subsections": []
        }
    },
    "summary": "MARC::File - Base class for files of MARC records",
    "flags": [],
    "examples": [],
    "see_also": []
}