in reply to Perl Parser to Handle Any File Format

There are some things about your code that should probably be done another way, in particular using subroutine prototypes is not necessary and usually not desirable. Also, consider using a dispatch table instead of the switch structure using *goto*. Have a look at Implementing Dispatch Tables. I'll leave further comment on this to more experienced monks.

Your code appears incomplete, so I cant really tell what you're doing. Offhand, my solution would be to parse each type of file into a common Perl data structure, then generate the XML from there. I think I would write a separate module to parse each type of input file, so if/when you get a new file type you could just write a new module for it without changing your main program. The configuration file could be used to associate whatever signature you use to identify the file type so you can *require* the appropriate parsing module.

Update: Take a look at module::pluggable

  • Comment on Re: Perl Parser to Handle Any File Format