NAME
Data::Presenter::Sample::Schedule
VERSION
This document refers to version 1.03 of Data::Presenter::Sample::Schedule, released February 10, 2008.
SYNOPSIS
Create a Data::Presenter::Sample::Schedule 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 required into the script.
use Data::Presenter;
use Data::Presenter::Sample::Schedule;
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::Sample::Schedule object, passing the hash reference as the first argument.
my $dp = Data::Presenter::Sample::Schedule->new(
$ms, \@fields, \%parameters, $index);
To use sorting, selecting and output methods on a Data::Presenter::Sample::Schedule 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::Sample::Schedule, please first consult the Data::Presenter documentation.
INTERNAL FEATURES
The Data::Presenter::Sample::Schedule Object
Unlike some other Data::Presenter::[package1] subclasses (e.g., Data::Presenter::Census), the source of the data processed by Data::Presenter::Sample::Schedule 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::Sample::Schedule. 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::Sample::Schedule Internal Subroutines
Like all Data::Presenter::[package1] classes, Data::Presenter::Sample::Schedule necessarily contains two subroutines:
&_init: Initializes the Data::Presenter::Sample::Schedule object by processing data contained in the Mall::Sample::Schedule 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_rowsto the data found in theData::Presenter::Sample::Scheduleobject.
Like many Data::Presenter::[package1] classes, Data::Presenter::Sample::Schedule offers the possibility of using &Data::Presenter::writeformat_with_reprocessing and &Data::Presenter::writeformat_deluxe. As such Data::Presenter::Sample::Schedule defines the following additional internal subroutines:
&_reprocessor: Customizes the operation of&Data::Presenter::writeformat_with_reprocessingto the data found in theData::Presenter::Sample::Scheduleobject.&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::Sample::Schedule now offers the possibility of using &Data::Presenter::writedelimit_with_reprocessing. As such Data::Presenter::Sample::Schedule defines the following additional internal subroutines:
&_reprocessor_delimit: Customizes the operation of&Data::Presenter::writedelimit_with_reprocessingto the data found in theData::Presenter::Sample::Scheduleobject.&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.
v0.61 (4/12/03): First version uploaded to CPAN.
AUTHOR
James E. Keenan (jkeenan@cpan.org).
Creation date: October 25, 2001. Last modification date: February 10, 2008. Copyright (c) 2001-08 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.