NAME

StandupGenerator::Helper - provides functions to assist methods in other modules

DESCRIPTION

The Helper module contains methods not intended for use by the end user. Instead, these methods extracted code blocks that recurred in different top-level methods. The goal was to eliminate redundancy in the rest of the code base.

METHODS

find_last_file

This method returns the name of the last file within a given directory, after sorting the files alphabetically. This method will return a string of the name of a .txt file. It will either be the last .txt file within the directory specified by the argument, or it will be s0d0.txt if the directory contained no .txt files.

Parameters

$path

A string containing the full file path for the directory containing the standup files. It should begin with /Users/.

Examples

    use StandupGenerator::Helper;
    my $last_file = StandupGenerator::Helper::find_last_file('/Users/johndoe/projects/super-important-project/standups');

Assuming the standups directory contains standup files and that yesterday's standup file was s3d07.txt, then this command will set $last_file to the string s3d07.txt.

    use StandupGenerator::Helper;
    my $last_file = StandupGenerator::Helper::find_last_file('/Users/johndoe/projects/super-important-project');

This command will set $last_file to the string s0d0.txt since the super-important-project directory presumably contains no .txt files.

extract_identifiers

This method returns a hash containing the number of the standup's sprint and the last digit of the standup's two-digit day.

Parameters

$file

A string containing the name of the .txt file.

Examples

    use StandupGenerator::Helper;
    my %ids = StandupGenerator::Helper::extract_identifiers('s2d07.txt');

This command will set %ids to a hash with a sprint key equal to 2 and a day key equal to 7.

    use StandupGenerator::Helper;
    my %ids = StandupGenerator::Helper::extract_identifiers('s2d10.txt');

This command will set %ids to a hash with a sprint key equal to 2 and a day key equal to 0, since only the last digit of the day is stored.