Perl variables can be given nonstandard characteristics, such as persistence so that they won't be lost when you exit from a program and then start it again. There are a number of exciting things you can do with this facility, known as tieing, but you also need to be careful that the code you write is easy to understand and maintain too.
This topic is presented on public course
Perl for Larger Projects
Examples from our training material
| ac2 | Using a tie class to force lower case |
| ac3 | Using a tie class to force lower case |
| acm2 | tieing a text file to a hash |
| acmagic | Persistant hash - NOT lost when the program exits |
| acnlook | Tieing a database file to a hash |
| acnset1 | Crreating a database file through tie |
| acnset2 | Tying a text file to a hash |
| alias_list | Accessing Unix's aliases database directly |
| allcodes | tied hash, unique key solution |
| aphash.pm | tie class definition - an appending hash |
| codes | location lookup |
| codes2 | Place lookup without tie - variables are cas sensitive |
| flash.pm | Appending hash tie class definition |
| game | Appliaction that uses a scalar as a stack |
| lower.pm | Tie class to force all strings to lower case |
| persist | Persistant variable via a tie class |
| pwl2 | Looking up user accounts, case insensitive |
| pwlook | Looking up users, case sensitive |
| stack.pm | Tie class that hides a stack under a scalar |
| textfile.pm | tie class that treats a file as a scalar |
| thash.pm | Tie class to access a disc file as a hash, with caching |
Opentalk forum discussions related to this topic
Authentication problems
Pictures
Trying out the subject taught in the last lecture
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
http://www.training-notes.co.uk.
Topics covered in this module
Tieing to scalars, hashes and lists.
Tieing to a scalar.
Tieing to a hash.
Tieing to make data more permanent.
Tieing a text file to a scalar.
Tieing a text file to a hash.
Tieing to database files.
Accessing system databases.
Tieing lists.
Tieing File Handles.
Course links
The following web pages are used as references / examples in this module
[
Link] New page location
(at http://www.firstalt.co.uk/drive/_stdfind.html)
We check these links from time to time with a spider written in PHP. Latest full check was on Saturday, 12th June 2004. Titles are extracted from the web pages listed.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 600 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.