Files, errors and modules

This part leaves the single script: files opened with three arguments, the file tests and directories around them, die and eval, and the modules that turn a script into a program: Exporter, CPAN, bless and Moo.

6.1 Read and write files open with three arguments, read line by line, write and append safely, and set the encoding layer Open 6.2 File tests and metadata the dash operators, size and emptiness, and timestamps and permissions from stat Open 6.3 Directories and paths readdir and glob, File::Basename and File::Spec, and a browsable tree Open 6.4 die, warn and eval stop with die, warn, catch with eval, and let autodie check every system call Open 6.5 Modules and Exporter a package in the right path, functions exported with Exporter, and the file loaded with use Open 6.6 CPAN and cpanm install a module with cpanm, keep it in a local library, and record the dependency in a cpanfile Open 6.7 Objects with bless a hash reference blessed into a class, methods and accessors, isa, and cleanup in DESTROY Open 6.8 Modern objects with Moo a class declared with has, attributes validated, and inheritance with extends Open

Lessons