Python Annotated Archives

This book is intended to be a guide to scripting with the Python language. It is not, however, a complete guide to the Python language, nor is it an attempt to demonstrate the only way to achieve a particular result in Python. Instead, this book a…

This book is intended to be a guide to scripting with the Python language. It is not, however, a complete guide to the Python language, nor is it an attempt to demonstrate the only way to achieve a particular result in Python. Instead, this book aims to demonstrate ways of using Python in real world situations. I show you real world scripts and annotate them to describe both the logic being used and the Python-specific features being employed to achieve a goal.About PythonPython is an interpreted language that employs an object-oriented approach. It’s a high-level programming language, which means that it separates the user from the underlying operating system as much as possible. However, unlike other languages, Python provides you with the ability to access the OS at a lower level if you desire. Because of this ability, Python is often pitched somewhere between such languages as Visual Basic and Perl and the system language of C.Although it is classed as an interpreted language, like Perl it employs a compilation stage that translates the raw Python script into a series of byte codes, which are then executed. These byte codes can be saved into a new file to enable faster execution of Python problems. The use of the compilation and byte code stages helps to improve performance and makes Python much faster than pure interpreters.Python also has the added benefit of providing rapid application development on the MacOS, Windows (95/98/NT), and Unix platforms. Python is supplied with a module to the Tk interface builder, and it’s possible to write an application on one platform and use it on all three platforms without making any modifications. In addition to the core platforms, Python also runs on MS-DOS, Amiga, BeOS, OS/2, VMS, QNX, and many more operating systems.Python has been around for many years now and has a strong following from a number of well-known companies for many different purposes. These companies include NASA, which uses it for their Integrated Planning System; Infoseek, which sells a Python-based search engine product called Ultraseek Server; and Red Hat, which uses it in their Linux product for configuration and administration tasks.One final note for those wondering what “Python” stands for: basically it doesn’t. Guido van Rossum selected the word because he is a big fan of Monty Python, a popular comedy group consisting of the talents of John Cleese, Eric Idle, Michael Palin, Terry Jones, Terry Gilliam, and Graham Chapman. Although I will admit to also being a huge fan of Monty Python, this connection has in no way influenced my love of Python. Well, not much…Who This Book Is ForUnlike many other programming books, this title is not designed to be a reference or language guide, nor is it targeted at a particular set of users. If you program in Python, or think you might like to program in Python, you should find this book useful.If you’re evaluating or just starting to learn Python, this book provides you with some examples and guidance on how to make the best use of Python and what it can be used for. All of the scripts in the book work straight off of the page (or the supplied CD-ROM) and demonstrate the range of features and abilities of the Python language.If you’re an intermediate programmer, this book helps to serve as a guide for improving your programming skills. It also provides a wider view of the available modules and extensions for the Python language and how they can be employed in your current development projects.If you’re a more advanced programmer, the scripts contained in the book can help augment or form the core of Python development efforts. They might even provide you with examples and ideas for using Python that you hadn’t before considered.In all cases, and for all programmers, the scripts provided here are intended to demonstrate the different features of the Python language and the ways in which you can use different methods to achieve the same or a similar result. All of the scripts can be taken from the supplied CD-ROM and used on your machine. You may have to account for minor differences, such as filenames and locations, but otherwise the scripts should work unmodified. If not, please let me know.

Perl Programmers Reference

Perl Programmers is the quick desktop tool for checking up on different Perl features. Split into 6 sections it includes the basics (syntax, variables, functions, references, regular expressions, formats and POD document formats), a complete funct…

Perl Programmers is the quick desktop tool for checking up on different Perl features. Split into 6 sections it includes the basics (syntax, variables, functions, references, regular expressions, formats and POD document formats), a complete functional reference, comprehensive guide to the Perl standard library, a suite of example scripts, information on using Perl on the command line, threads, the Perl Compiler and the Perl debugger.

Perl: The Complete Reference

As the title suggests, this book is a complete reference to the Perl programming language. As such, it includes details of everything you want to know about statements, expressions, functions, and regular expressions within Perl. Some highlights o…

As the title suggests, this book is a complete reference to the Perl programming language. As such, it includes details of everything you want to know about statements, expressions, functions, and regular expressions within Perl. Some highlights of the book include the creation of useful packages and modules, using Perl on the command line and Tk as a cross-platform user interface solution. There are also several chapters dedicated to the design and use of the supported data structures within Perl, and to the processes available for accessing external data structures and databases.Interprocess communication, either between processes on the same machine or between processes on different machines, is also a topic for discussion. The former is handled by a number of tricks and some system-dependent features. For the latter machine communication, you can use network sockets. An alternative solution to the problems of processing between multiple processes is to use threads, which are small, “lightweight” execution sequences that are still owned in their entirety by their parent process, and we also look at how threads can be used to solve these problems.A large portion of the book is given over to the process of getting inside Perl. We examine how Perl works as it parses a Perl script and how that process can be modified with compiler pragmas. Then we move on to the process of extending Perl by writing an interface between Perl and a C function. This allows Perl to use and access an unlimited number of extensions and enhancements to the core Perl language. You can also do the reverse. You can embed the Perl interpreter into a C program, allowing you to use the advanced features of Perl within a C program. You could even build the interpreter into an application to provide a built-in scripting language.A recent development in the Perl interpreter has allowed the creation of a Perl compiler (which is in itself a bit of a misnomer; see Chapter 1 for details). With the compiler you can do many things, including produce some detailed output on the real structure and execution path that your script takes. One of the most significant and useful features, though, is that you can take a Perl script and produce a stand-alone executable program.Perl is also a good cross-platform development tool. See Chapter 1 for a list of some of the platforms that Perl has been ported to. We take a close look at the three main platforms-Unix, Windows, and MacOS-and how they differ, before taking a more generalized view of how to program with Perl in a cross-platform world and ensure the cross-platform compatibility.Finally, the appendixes provide a quick and detailed reference to the Perl functions, error messages, and the standard Perl library that comes with every distribution. Of course, even with the best intentions, it’s possible to have forgotten some element, or not to have gone through a particular element to a deep enough degree, although I hope this won’t be the case for most readers.Who Is the Book For?I haven’t targeted the book at any specific group of Perl users. To put it simply, if you program in Perl, you will find this book useful. As a reference, most people should find it useful to keep on the desk or the shelf just as a quick means of looking up a particular function or feature. For learners and expert users alike, the information in this book will be invaluable.You should also find the book useful if you want to know how to do a particular task in Perl, since you’ll also find working, real-world examples of the different features of Perl within the book. If you are looking for more examples, you might want to look at Perl Annotated Archives, which contains over 100 scripts to solve a myriad of different problems.How to Use This BookPick it up, look up the feature you want to get more information on from the contents or the index, and read! The scripts and script fragments included in the book should all work without modification on your machine. Be aware though that not all platforms support all Perl features. Use Chapters 21 through 24 if you are unsure of a feature.If you want purely reference information-that is, you want to look up the arguments and return values to a function-then use the appendixes at the back. For discussion, examples, and detailed information on a particular feature, use one of the earlier chapters. You should find references between the chapters and appendixes in both directions to help you get more information.The bulk of the book covers the core version of Perl as it is supported and developed under Unix. See Chapter 21 for details on using Perl on the Unix platform. If you are programming under Windows or MacOS, then please read Chapter 22 or 23, respectively, for details on how to obtain, compile, and program Perl on those two platforms.

Perl Annotated Archives

This book does not aim to teach you every aspect and function that is available within the Perl environment. Nor is it intended to be an example of the perfect path to a particular goal using Perl. There are a number of ways and methods in which d…

This book does not aim to teach you every aspect and function that is available within the Perl environment. Nor is it intended to be an example of the perfect path to a particular goal using Perl. There are a number of ways and methods in which different goals can be achieved in any language, and Perl is no exception to this rule. Instead, my aim is to demonstrate the use of Perl in real-world situations, showing examples and detailed reasons as to why the programmer followed a certain path and structure for the script.Many of the scripts in this book are taken directly from my own toolkit of scripts and utilities that I have been using for many years. Others have been taken from the Internet, with the author’s permission, and are included in this book in the same consistent style, with the same level of annotations. In all cases, I’d like to make it clear that the scripts are not taken to be the ultimate or perfect method of achieving a particular goal. What I can say is that all of the scripts work, and they all do what they set out to do.Who the book is forI’ve not targeted the book at any one specific group of Perl users. To put it simply, if you program in Perl, then you will find this book useful. For beginners, the book provides a useful introduction to how programs are structured and how the different functions and constructs in Perl allow you to do both simple and more complex tasks.For the intermediate programmer, this book should give you ideas and pointers to improving your Perl programming, and what tools and modules to use when approaching different problems with Perl. For the more advanced user, these scripts can help augment and form the basis of other projects you are working on, and they may even open doors to other solutions for particular problems that you had not originally considered.In all cases, I have designed the scripts to be standalone examples of how to achieve different goals. All of the scripts can be taken directly from the book’s CD-ROM and used within your own systems, albeit with minor modifications to take account of your local setup. Any required modules and extensions are supplied. The latest versions of the chapter scripts are available here for download – use the download panel on the right hand side of the window.How to use Perl Annotated ArchivesThere is no natural progression through the book, so you can pick it up at any point in any chapter, and you should be able to follow the scripts. Keep in mind, though, that a number of the chapters include a module as one of the first annotations. Although reading one of the later scripts without having first studied the module may leave some gaps in your understanding, the script ought to make sense.Where applicable, the annotations include possible script modifications and updates so you can customize it for your own environment or expand its capabilities and features. Alternatively, if the script does exactly what you want, and you are not interested in the annotations, just go ahead and use the script!

BeOS: Porting Unix Applications

When the BeOS was first released it was obvious to me and many others that it would be a platform that suited both the GUI lover, and the Unix style command line interface geek. Developing for the former requires you to learn the BeOS API, includi…

When the BeOS was first released it was obvious to me and many others that it would be a platform that suited both the GUI lover, and the Unix style command line interface geek. Developing for the former requires you to learn the BeOS API, including the client/server system, BMessages and the objects and classes that make up the BeOS interface.But if you want to take advantage of the POSIX support included with the BeOS and use the wide range of open source software such as that from GNU and many others. However, there are problems with the BeOS when it comes to porting Unix applications. Not all of the features, functions and programs are supported, and those that are have bugs, gaps, or just plain dont work.The idea behind BeOS: Porting Unix Applications was therefore to guide the reader from downloading the source code to using the application. This involves how to extract the archives you’ve downloaded, how to use the configuration systems, including how to make them work with the BeOS, and how to plug the gaps and missing areas of the BeOS functionality.Features

  • Supports BeOS Release 3.
  • Provides a step-by-step guide to the porting process, from download the source to installing the application.
  • Explains how to port off the shelf utilities like Emacs and Perl as well as your own programs and tools to the BeOS.
  • Offers a comprehensive Unix/POSIX vs. BeOS reference for anyone who is porting or writing software for the BeOS.
  • Furnishes a simple catalog of tools and features available on the BeOS.

A Note About CompatibilityAlthough the book was written at a time when PPC was the main version of the BeOS, much of the content is still relevant both to the older Intel implementations using Metrowerks development tools, and the newer GNU based development toolkit. This is because the development tool differences make very little difference to the core OS libraries and functions provided by the BeOS.