OO Perl Project

Examples list, explanations, interactive Resources (including electronic form of project paper) "Main Page" - what this site may some day evolve into

List of Examples (click on each link to go its detailed description and/or download-view)

  • Simple Stoplight

  • Check Input

  • word count


  • Detailed Descriptions of Examples

  • Simple StopLight: (view in browser ) or (right click to download, 'save target' if using Internet Explorer, add the suffix ".pm" when saving)

    An example of a small Class that depends on good Data Hiding/Access Control and Modularity to get its job done right. Includes a "change" method which is ideally supposed to regulate the process of switching traffic lights on in the correct order.

  • checkInput: (view in browser ) or (right click to download, 'save target' if using Internet Explorer, add the suffix ".pl" when saving)

    This is a console implementation of a simple form validator, which demonstrates the use of regular expressions.

    usage: perl checkInput.pl

  • wordCount: (view in browser ) or (right click to download, 'save target' if using Internet Explorer, add the suffix ".pl" when saving)

    It is a common task to count the amount of occurrences of unique words in a document in the area of Information Retrieval. This script that takes a text file and outputs the word counts in a separate file could be used as a module for an indexer. The name of the output file is result.txt if not specified otherwise.

    usage: perl wordCount.pl inputFile [outputFile]


  • Interactive Demos

  • run testsl

    -Tests the Simple Stoplight and finds it to be susceptible to error. Here is what it does (click on view link below to see for yourself): first it creates a stoplight and prints out its color, the default of yellow. Then, it breaks encapsulation by reaching directly into the stoplight class and changing the color to green (which would be very bad if it happened at a real stoplight!) , then it uses change() to change the stoplight back to yellow, but really this change should have changed it to red, if not for the improper meddling above

    right click to download (standalone version, not modified to display results on the web) or (view in browser)

    right click to download (webified version - very similar, not here yet, but this is the one that is actually running above)


  • Resources:

  • online tutorials:

  • Object Oriented Perl - nice short introduction to OO Perl, not for Perl newbies and doesn't go into a lot of detail.

  • papers

    Conway, D.M. Object Oriented Perl Cyberdigest - a nice overview of Conway's book - with selected commented extracts

  • other lists of resources

    Perl Object Oriented Meta-Tutorial - from Perl Mongers - provides somewhat of an outline of how to get into Perl OO

    Perl Stuff - just some perl resources, including a list of tutorials - includes pointers on creating "static class variables" something I tried once myself (this points out a pitfall related to my approach)

    Object Oriented Language - Perl - lots of links - some just about Perl in general and not just OO, but many on OO. A category on the Cetus-links on Objects and Components resource site.

  • faqs

    PerlFaqPrime - still under development, but has a few useful answers already

  • commentaries, opinions, works in progress

    RFC 137 from dev.perl.org - this one is maintained by Damian Conway, discusses some deficiences/ future directions of Perl in the context of what appears to be a lot of praise for the current form of Perl OO..

  •