NAME

Comiclib.pm


SYNOPSIS

config file and subroutines for comics


DESCRIPTION

This is a library of functions and data structures for the ComicMan web comic downloading system.


AUTHOR

Jay Scott Raymond


BUGS

None known as yet.


SEE ALSO

inf-doc.txt


COPYRIGHT

Copyright 2006, Jay Scott Raymond. All Rights Reserved

This program is free software. You may copy or redistribute it under the same terms as Perl itself.

FUNCTION: get_safe_home

Parameters: none.

Returns: string.

The get_safe_home() function returns an untainted copy of the Home directory path.

DATA STRUCTURE: %comicman_data

A hash containing various configuration variables.

FUNCTION: write_to_logfile

Parameter 0: log message

Returns: none.

The write_to_logfile() function writes a log message to the file defined in $comicman_data{dload_log_file}.

FUNCTION: debug_print

Parameter 0: the debug level setting (0: no output, 1: failure, 2: serious problem, 3: minor problem, 4: trace mode)

Parameter 1: The debug message.

Returns: none.

The debug_print() function prints with multiple debug levels to regulate the amount of output.

FUNCTION: get_cm_data

Parameter 0: the member of comicman_data to get

Returns: The requested data item or 0 on error.

The get_cm_data() function is an accessor for the comicman_data hash.

FUNCTION: set_cm_data

Parameter 0: the member of comicman_data to set

Parameter 1: what to set the member to

Returns: 1 = success, 0 = failure.

The set_cm_data() function is an accessor for the comicman_data hash.

FUNCTION: make_user_dir

Parameters: none

Returns: 0: failure 1: success

The make_user_dir() function sets up a new user's data directories

FUNCTION: comicman_setup

Parameters: none

Returns: none

The comicman_setup() function sets up a new user's data directories via make_user_dir and which comics to download

FUNCTION: update_cm_settings

Parameter 0: Path to config file

Parameter 1: Reference to a list of updatable fields

Returns: 1=success, 0=failure.

The update_cm_settings() function updates %comicman_data with settings from a file.

FUNCTION: init_cm_data

Parameters: none

Returns: 0: failure 1: success

The init_cm_data() function initializes the comicman_data hash with the user settings

FUNCTION: get_webpage

Parameter 0: URL of webpage to download

Returns: The text of the webpage.

The get_webpage() function gets the text of a webpage.

FUNCTION: get_old_data

Parameter 0: data filename

Returns: array of last downloaded comics

The get_old_data() function gets data of the last comic downloaded.

FUNCTION: parse_filename

Parameter 0: webpage text

Parameter 1: regular expression to parse the webpage with

Returns: array of filenames

The parse_filename() function parses a webpage using the provided regEx.

FUNCTION: name_fixup

Parameter 0: search part of regEx

Parameter 1: replace part of regEx

Parameter 2: reference to array of filenames

Returns: array of filenames

The name_fixup() function performs adjustments to an array of filenames with a search-replace regEx.

FUNCTION: update_comics_file

Parameter 0: datfile name

Parameter 1: reference to an array of comic identifier(s) (could be filenames, numbers or checksums)

Returns: 1=success, 0=failure

The update_comics_file() function updates the data file for a comic.

FUNCTION: prefix_comic

Parameter 0: prefix

Parameter 1: reference to an array of comic(s)

Returns: none

The prefix_comic() function adds a prefix to the comic name(s).

FUNCTION: rename_comic

Parameter 0: text or regEx to be replaced

Parameter 1: replacement text

Parameter 2: reference to an array of comic(s)

Returns: none

Replacement codes: #orig# = original filename

The rename_comic() function renames the comic(s).

FUNCTION: get_named_comics

Parameter 0: Referer URL

Parameter 1: URL to append comic names to

Parameter 2: Data file to update if new comic downloaded

Parameter 3: reference to an Array of new comic data

Returns: none

The get_named_comics() function gets the named new comic(s), if any.

FUNCTION: get_cksum_comics

Parameter 0: Referer URL

Parameter 1: URL to append comic names to

Parameter 2: Data file to update if new comic downloaded

Parameter 3: reference to an Array of new comic data

Returns: none

The get_cksum_comics() function gets the checksumed new comic(s), if any.

FUNCTION: acquired_data

Parameter 0: comic id

Parameter 1: reference to an array of old comic ids

Returns: 1=found, 0=not found

The acquired_data() function checks if a comic id is in the dat file.

FUNCTION: fetch_inf_data

Parameter 0: inf file name

Returns: comic data hash

The fetch_inf_data() function gets a comic's inf data.

FUNCTION: get_inf_list

Parameter 0: inf directory

Returns: array of filenames

The get_inf_list() function gets a list of inf files.

FUNCTION: get_chosen_list

Parameters: none

Returns: array of filenames

The get_chosen_list() function gets a list of chosen inf files.

FUNCTION: save_chosen_list

Parameter 0: a reference to an array of filenames

Returns: none

The save_chosen_list() function sets a list of chosen inf files.

FUNCTION: missing_fields

Parameter 0: array reference of required field names

Parameter 1: hash reference from inf file

Returns: 1=missing, 0=OK

The missing_fields() function checks inf data for required fields.

FUNCTION: make_new_inf

Parameters: none

Returns: none

The make_new_inf() function makes a new inf file with data from the user.