Q&A

Q1: My one-liners don't work in MacPerl.
A1: Make sure in the Edit, Peferences, Scripts dialog that you have “Run Scripts Opened from Finder” selected. If you've chosen “Edit” here your one-liners won't work (“One Liner” is itself a MacPerl script).
Q2:My one-liners don't work in Windows.
A2: Notions of quotes are different in the Windows/DOS command line than they are on Unix. You can use both single and double-quotes in Unix; in Windows you can only use double quotes. For one-liners in Windows, make sure that you surround the entire one-line script in double-quotes and that all quotes inside the actual script are back-slashed.
Q3:My one-liners don't work in Unix.
A3: They don't? Did you type the script all on one line with no returns? Did you surround the entire script with single-quotes? Did you remember the -e option to Perl? If you've checked all these things, make sure the same script works if you put it into a file of its own.
Q4:From your description, Perl doesn't appear to support the object-oriented programming notions of public and private data. What's to stop someone from using methods in your class that you didn't intend to be part of the public API?
A4: Nothing. Perl's object-oriented model doesn't enforce any notion of a public or private API; it assumes that you and the programmers who use your classes will behave decently as far as the API is concerned. As the developer of a class, you should be sure to document your API and which of your methods are public (POD is good for this) and assume that if someone is using your class that they'll stick to that API. Conversely, if you're using someone else's class, you should stick to their documented public API and use internal methods or data only at your own risk and if you're sure you know what you're doing.
Q5:Multiple inheritance is really confusing and error-prone. Why didn't Perl use single inheritance instead?
A5: What, and limit the power of the language? It should be apparent at this point in the book that Perl doesn't really ever try to limit what the programmer can do. Multiple inheritance may indeed often be confusing and difficult to debug, but it's also incredibly powerful when used in conjunction with a good design (and don't forget, a good design doesn't necessarily involve inheritance). The designers of Perl would rather err on the side of having too much rope to hang yourself than not enough to tie a good knot.
Q6:Where on earth did the terms I18N and L10N come from?
A6: There's eighteen letters between the I and the N in the word internationalization (and ten between the L and N in localization). Internationalization and localization are really long words to type. Programmers hate that.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset