Creating the DLF Converter Skeleton
Prev | Chapter 2. Writing a New DLF Converter | Next

## Creating the DLF Converter Skeleton

Put simply, a DLF converter is a perl object which implements a set of predefined methods (aka an “interface” in the object-oriented jargon).

Since a DLF converter is a perl object, it must be instantiated from a class. Classes in perl are defined in packages. We'll name the package which implements our converter `MyConverters::SyslogCommonConverter`. To create such a package, you need to create a file named `MyConverters/SyslogCommonConverter.pm` in a directory searched by perl.

### Note

- You can obtain perl's default search list by running the command ``$` perl -V`.

- This search list can be modified by setting the `PERL5LIB` environment variables.

Here is a first cut of our DLF converter:

    package MyConverters::SyslogCommonConverter;

    use base qw/Lire::DlfConverter/;

    1;

The first line declare that the code is in the `MyConvertersw::SyslogCommonConverter` package. The second one specifies that objects in this package are subclasses of the `Lire::DlfConverter` packages. The last line fullfill perl's requirement that package returns a true value once they are initialized.

This is a complete DLF, altough useless, DLF Converter. In fact, it isn't complete because if you tried to register an instance of that class, you'll get “unimplemented method” errors. Besides, we don't even yet have a formal way to create instance of our converter. This is our next task.

Prev | Up | Next
The common_syslog Log Format | Home | Adding a Constructor