NAME
Data::Presenter::SampleSchedule
VERSION
This document refers to version 0.61 of Data::Presenter::SampleSchedule, released April 12, 2003.
SYNOPSIS
Create a Data::Presenter::SampleSchedule object. The first argument passed to the constructor for this object is a reference to an anonymous hash which has been created outside of Data::Presenter for heuristic purposes only. For illustrative purposes, this variable is contained in a separate file which is require
d into the script.
use Data::Presenter;
use Data::Presenter::SampleSchedule;
our ($ms);
my $hashfile = 'reprocessible.txt';
require $hashfile;
Then do the usual preparation for a Data::Presenter::[subclass] object.
our @fields = ();
our %parameters = ();
our $index = '';
my ($fieldsfile, $count, $outputfile, $title, $separator);
my @columns_selected = ();
my $sorted_data = '';
my @objects = ();
my ($column, $relation);
my @choices = ();
$fieldsfile = 'fields_schedule.data';
do $fieldsfile;
Finally, create a Data::Presenter::SampleSchedule object, passing the hash reference as the first argument.
my $dp = Data::Presenter::SampleSchedule->new(
$ms, \@fields, \%parameters, $index);
To use sorting, selecting and output methods on a Data::Presenter::SampleSchedule object, please consult the Data::Presenter documentation.
DESCRIPTION
This package is a subclass of Data::Presenter intended to illustrate how certain Data::Presenter methods provide additional functionality. These subroutines include:
&writeformat_with_reprocessing
&writeformat_deluxe
&writedelimited_with_reprocessing
&writedelimited_deluxe
To learn how to use Data::Presenter::SampleSchedule, please first consult the Data::Presenter documentation.
INTERNAL FEATURES
The Data::Presenter::SampleSchedule Object
Unlike some other Data::Presenter::[package1] subclasses (e.g., Data::Presenter::Census), the source of the data processed by Data::Presenter::SampleSchedule is not a database report coming from a legacy database system through a filehandle. Rather, it is a hash of arrays representing the current state of an object at a particular point in a script (suitably modified to carry Data::Presenter metadata). The hash of arrays used for illustrative purposes in this distribution was generated by the author from a module, Mall::Schedule, which is not part of the Data::Presenter distribution. Mall::Schedule schedules therapeutic treatment groups into particular rooms and time slots and with particular instructors. The time slots and instructors are identified in the underlying database by unique IDs, but it is often preferable to have more human-readable strings appear in output rather than these IDs. The IDs need to be 'reprocessed' into more readable strings. This is the task solved by Data::Presenter::SampleSchedule. Since we are not here concerned with the creation of a Mall::Schedule object, all we need is the anonymous hash blessed into that object and the reprocessing methods.
Data::Presenter::SampleSchedule Internal Subroutines
Like all Data::Presenter::[package1] classes, Data::Presenter::SampleSchedule necessarily contains two subroutines:
&_init
: Initializes the Data::Presenter::SampleSchedule object by processing data contained in the Mall::SampleSchedule object and returning a reference to a hash which is then further processed and blessed by the Data::Presenter constructor.&_extract_rows
: Customizes the operation of&Data::Presenter::select_rows
to the data found in theData::Presenter::SampleSchedule
object.
Like many Data::Presenter::[package1] classes, Data::Presenter::SampleSchedule offers the possibility of using &Data::Presenter::writeformat_with_reprocessing
and &Data::Presenter::writeformat_deluxe
. As such Data::Presenter::SampleSchedule defines the following additional internal subroutines:
&_reprocessor
: Customizes the operation of&Data::Presenter::writeformat_with_reprocessing
to the data found in theData::Presenter::SampleSchedule
object.&reprocess_timeslot
: Takes a timeslot code (as found in@{$ms{'options'}{'sources'}{'timeslot'}
) and substitutes for it a string containing the day of the week and the starting time.&reprocess_instructor
: Takes an instructor's unique ID (as found in@{$ms{'options'}{'sources'}{'instructor'}}
) and substitutes for it a string containing the instructor's last name and first name.&reprocess_room
: Takes a room number (as found in@{$ms{'options'}{'sources'}{'room'}}
) and substitutes for it a string containing mall number and the room number.&reprocess_discipline
: Takes the code number for a discipline (as found in@{$ms{'options'}{'sources'}{'discipline'}}
) and substitutes for it a string containing name of the discipline.&reprocess_ward_department
: Takes the code number for a ward or department (as found in@{$ms{'options'}{'sources'}{'ward_department'}}
) and substitutes for it a string containing name of the ward or department.
In addition, Data::Presenter::SampleSchedule now offers the possibility of using &Data::Presenter::writedelimit_with_reprocessing
. As such Data::Presenter::SampleSchedule defines the following additional internal subroutines:
&_reprocessor_delimit
: Customizes the operation of&Data::Presenter::writedelimit_with_reprocessing
to the data found in theData::Presenter::SampleSchedule
object.&reprocess_delimit_instructor
: Takes an instructor's unique ID (as found in@{$ms{'options'}{'sources'}{'instructor'}}
) and substitutes for it a string containing the instructor's last name and first name.&reprocess_delimit_timeslot
: Takes a timeslot code (as found in@{$ms{'options'}{'sources'}{'timeslot'}}
) and substitutes for it a string containing the day of the week and the starting time.&reprocess_delimit_room
: Takes a room number (as found in@{$ms{'options'}{'sources'}{'room'}}
) and substitutes for it a string containing mall number and the room number.
PREREQUISITES
None.
HISTORY AND DEVELOPMENT
History
v0.60 (4/6/03): Version number was advanced to 0.60 to be consistent with steps taken to prepare Data::Presenter for public distribution.
AUTHOR
James E. Keenan (jkeenan@cpan.org).
Creation date: October 18, 2002. Last modification date: April 12, 2003. Copyright (c) 2002-3 James E. Keenan. United States. All rights reserved.
All data presented in this documentation or in the sample files in the archive accompanying this documentation are dummy copy. The data was entirely fabricated by the author for heuristic purposes. Any resemblance to any person, living or dead, is coincidental.
This is free software which you may distribute under the same terms as Perl itself.