From the course: Perl 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Perl's object model

Perl's object model - Perl Tutorial

From the course: Perl 5 Essential Training

Start my 1-month free trial

Perl's object model

- [Voiceover] Strictly speaking Perl doesn't have an object model per se, in Perl an object is simply reference a class is a pack and a method is a function. Here's a working copy of hello.pl from Chapter 14 of the exercise files, all that said, the object model in Perl actually does work remarkably well. Let's go ahead and we'll start here by importing a module, I'm going to say use BW::Simple; and so that imports the module Simple from the BW directory or folder. Now, in Perl, a module, I'm gonna go here and open this up the name of a module is its directory path from the beginning of the import directory and in this case Perl is set up to import from it's current directory and so as usual you use by default and so it finds this BW folder and then under that it finds this Simple.pm. Modules are named with .pm rather than .pl for Perl scripts. And so this module is actually BW::Simple and it's actually really recommended it's good practice in Perl to name your modules under a…

Contents