Learn how to install the development environment on a Mac.
- [Voiceover] For this course, I'm using the free version of the Komodo editor from ActiveState. This editor is designed for use with Perl, and it's provided by one of the leading providers of Perl for desktop systems. So, here at komodoide.com/komodoedit, we find the Download page, and you'll notice that there's two download buttons. One of them says Try Komodo IDE and one is says Download Edit. Now, Komodo IDE is the pay-for-it version of the Komodo editor, costs $100 for personal use. There's a nice little comparison down here that you can look at, and, you know, if you're going to use a lot of these features, then it's probably worth it to spend $100 for personal use.
On the other hand, for our purposes, we're going to use the free version, which is called Edit, and you can download it with this download button. I've already downloaded the installer to my desktop, so I'll just double-click here on the DMG file for Komodo Edit, and drag the app into my Applications folder. And there we have it. For convenience, I'm going to open up Applications here, and I'm going to find the Komodo editor, there it is, and I'm going to drop that on my dock, and eject this, pressing Control and the mouse button.
And eject. And now I can run Komodo Edit from my dock. Now, for our purposes, because this screen is so small, you may not need to do this, you've probably got a larger screen than I do, but this is small for recording purposes, I'm going to Opt + click the green button there to maximize, and up here at the top, you'll see these pane buttons. These open up the various panes. There's the right pane, the bottom pane, and we're just going to open all these up for now. We'll close the right one a little bit later.
You probably have a bunch more things here than I have. I had installed this before, and moved some of the stuff to the Archive folder. You probably don't have that Archive folder. And, over here, on the Directory side, you notice there's two buttons. There's the Open Files button and the Directory button. You want to select the Directory button to display the directories. And then, you'll click on the gear here and say Open Directory. This is the way we can put our Exercise Files in here, so I'm going to go to my Desktop, and Exercise Files, and I just leave that selected, so that Exercise Files there is highlighted, and I select Open, and this will open up the Exercise Files here in my Directory Pane, and that is the way that I want that, and then I can open these up, and I see the files for my various chapters in my Exercise Files.
Now, on the right-side pane over here, I'm going to Ctrl + click on an empty space here, and I'm going to select Add and New Command, and this is going to create the command for running Perl. Now, this is a Mac, so Perl is already installed and it's already in the path, so all I have to put here for the command is Perl and the name of the file that we're going to run, which is a meta name, because it's just going to run whatever script is open in the editor, so I put in "%F".
So, those are double-quote marks, and I know they're really small on your screen there. But those are double-quote marks, you know, regular quotes, with %F inside of them, and then up here in the title, I'm just going to say Run and a dash and a capital R, and that reminds me that this is going to be bound to the Shift + Cmd + R key, and we'll get to that in a moment. First, down here in Start in, I need to put a % and a capital D, for Directory, so it'll start in the same directory, or the same folder, as the script itself, and that's actually important.
Some of our examples won't work if we don't do that. Then I'm going to come over here to the Key Binding tab, and under New Key Sequence, I'm going to put in Shift, Command, and R, and it'll say Meta + Shift + R, because the Command key comes up as Meta here, and that's all right. Click the Add button, it won't work if we don't do that, and select OK, and we now have, you notice, over here, it says Run. You'll have a longer list over here, probably, and Run will be somewhere in the middle of that. And that's okay, that's what we want, is the Run there.
And now, we can actually just close this pane, because we don't need it anymore, and we're going to open a script over here, but I don't want to open this one. I want to make a working copy, so I'm going to come out here to my Finder, and I'm going to open my desktop, and Exercise Files, and come into Chapter One, and I'm going to make a working copy of this Hello Version. So I Cmd + C to copy, Cmd + V to paste, and then I rename so it says -working, and then, over here, in my Exercise Files, you'll notice that there it is, it says hello-working, I'll open that up a little bit so we can see the whole thing, I can double-click on that and it actually opens it up in the editor.
Now, your color scheme will look different, and that's okay, we'll get to that in a moment. This is actually set up with a set up with a special color scheme that's just for the purpose of these recordings. Yours will probably be dark with white letters on it, and with much smaller text, but that's okay. I'm going to show you how to change that in just a moment. For right now, I want to run this, and make sure that everything is working. And so, with this up in my editor, I'm going to press Shift + Cmd + R. That runs our Run script over here, because we bound it to the Shift +Cmd + R, and now, you see down here in our Command Output, it says Perl version is 5.18.2.
And as long as it's 5.18 or later, or higher, you're good to go, but the version may be different on your machine, and that's just fine. Okay, so we have our editor installed and working, we have our command to run the scripts installed and working. I want to show you a little bit about customizing Komodo here. Come under Komodo and under Preferences, and there's a few things that you can customize here. Of course, you can customize the behavior of the indention and things in the editor, and that's all fine.
Then there's the color schemes. So, I have a special one loaded here for my recordings, and if you would actually like a copy of this one, it's on my website at perl.bw.org, and you're welcome to use it. Just keep in mind that the font that this uses is a special font, developed for large sizes here. It's called Calynda, and you will not have that font, and that's not publicly available. But, for your purposes, the Memo font on a Mac or Consolas on a PC is often a good choice, and that'll work just fine.
So, there's plenty of schemes here. You can try them all out, and then, once you've picked one out, you can change the colors of it and such. So, this is very customizable, and I'm sure you'll find a scheme that works for you. So now I'm going to go ahead and close this script, and I'm going to come back out to my Exercise Files, and I'm going to remove my working copy, and that's all there is to it. Your computer is now set up to run Perl scripts in Komodo Edit.
Watch to learn the details of the Perl syntax, from variables, conditionals, loops, and data structures to regular expressions, functions, and references. A quick-start guide is included for experienced developers who want to get up and running with Perl 5 fast, and the entire course is recommended for both new and experienced programmers alike. Later chapters cover file handling and reusing code with Perl modules, plus Perl best coding practices.
- Understanding Perl's general syntax and the anatomy of a Perl script
- Writing statements and expressions
- Creating assignments
- Working with variables and strings
- Using data types effectively
- Defining logical flow with conditionals and loops
- Using special variables
- Using Perl operators
- Performing simple Perl programming tasks with expressions
- Matching data
- Defining and calling functions
- Using references
- Handling files in the file I/O
- Using built-in functions
- Reusing code with modules
- Coding with Perl best practices