The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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. It only takes one parameter:

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

Assuming the standups directory contains standup files and that yesterday's standup file was s3d07.txt, then the below 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/standups');

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. It only takes one parameter:

  • $file -- A string containing the name of the .txt file.

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

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