Curses-Devkit
view release on metacpan or search on metacpan
demos/workman view on Meta::CPAN
#!../../../perl
#
# Initialize Cdk.
#
use Cdk;
Cdk::init();
# Pop up the opening label.
popupLabel (["<C></16/B>Workman Database Editor.", "",
"<C></24/B>Written By Mike Glover"]);
# Set a default name for the workman database.
my $workmandb = $ENV{'HOME'} . "/.workmandb";
# Open up the database and read in the contents.
my @cdList = readWorkmanDatabase ($workmandb);
# Let the user play with the given information.
playWithWorkManDatabase (@cdList);
#
# This allows the user to manipulate the workman database.
#
sub playWithWorkManDatabase
{
}
#
# This reads in the current contents of the workman database.
#
sub readWorkmanDatabase
{
my $filename = shift;
my @contents = ();
my $count = 0;
my $x = 0;
# Return if we can't open the file.
return if !(open (FILE, $filename));
# Slurp in the file.
my @workmandb = <FILE>;
chomp @workmandb;
# Strip out the contents of the database.
for ($x=0; $x < $#workmandb; $x++)
{
# Remove comments and empty lines.
next if $workmandb[$x] =~ /^#/;
next if $workmandb[$x] =~ /^$/;
# Is this a start of a CD listing.
if ($workmandb[$x] =~ /^tracks (\d*)/)
{
my $trackCount = $1;
my $trackLine = $workmandb[$x++];
my $cdName = $workmandb[$x++];
my $artist = $workmandb[$x++];
my @tracks = ();
my $current = 0;
# Get each track from the database.
for ($current=0; $current < $trackCount; $current++)
{
push (@tracks, $workmandb[$x++]);
}
$x--;
# Create the database object and put it onto the stack.
( run in 1.268 second using v1.01-cache-2.11-cpan-364913b4093 )