Section A.15. Answer for Chapter 16


A.15. Answer for Chapter 16

A.15.1. Exercise

We don't have code to show you: it's just the stuff in Chapter 12. Lift that code and put it into a distribution. Most of the work is just typing.

There are a few different approaches, though. Once you have the distribution built with your favorite tool, you can split up the classes into separate module files. You can have an Animal.pm, Horse.pm, and so on. Put all the files in the same place as the original .pm that the module tool created. You also need to change the Makefile.PL or Build.PL to tell it about the new module files. Just follow the example of what is already there. Finally, make sure all the right files show up in MANIFEST.

Once you have all of the code in place, run the Makefile.PL, which you'll need to do every time you change that file. When you change the module files, you'll need to run make again too, although that happens when you run make test or make dist.

When you're ready, run make dist. You should find a new archive file in the current directory. You can also call make zipdist if you want a ZIP archive. Move that archive to another directory and unpack it. When you run Makefile.PL, you shouldn't get any errors or warnings if you did everything right. If you get a warning, fix that (it's probably a missing file, if anything) and try again.




Intermediate Perl
Intermediate Perl
ISBN: 0596102062
EAN: 2147483647
Year: N/A
Pages: 238

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net