NAME

FR24::Bot - Subroutines for FR24-Bot

VERSION

version 0.0.1

SYNOPSIS

use FR24::Bot;


my $result = FR24::Bot::parse_flights($json_text);

# Load configuration from a file
my $config = FR24::Bot::loadconfig("/path/to/config.ini");

# Save configuration to a file
FR24::Bot::saveconfig("/path/to/config.ini", $config);

# Parse flights from JSON data
my $json_text = '{"4067ef":["4067ef",0,0,0,37000,0,"0000",0,"","",1689143713,"","","",false,0,""]}';

DESCRIPTION

FR24::Bot provides subroutines for FR24-Bot.

SUBROUTINES

parse_flights

my $result = parse_flights($json_text, $test_bool);

Parses flights from JSON data and returns the result as a hash reference.

Parameters:

  • $json_text - The JSON data containing flight information.

Returns:

A hash reference with the following keys:

  • status - The status of the parsing operation.

  • total - The total number of flights parsed.

  • data - A hash reference containing flight information.

  • raw - A hash reference containing the raw flight data.

loadconfig

my $config = loadconfig($filename);

Loads configuration from a file and returns the configuration as a hash reference.

Parameters:

  • $filename - The name of the configuration file.

Returns:

A hash reference representing the loaded configuration.

saveconfig

saveconfig($filename, $config);

Saves configuration to a file.

Parameters:

  • $filename - The name of the configuration file.

  • $config - The configuration to be saved (a hash reference).

url_exists

my $exists = url_exists($url);

Checks if a URL exists by sending a HEAD request.

Parameters:

  • $url - The URL to check.

Returns:

1 if the URL exists, 0 otherwise.

EXPORTS

The following variables are exported by default:

  • $VERSION - The version of the FR24::Bot module.

The following variables can be optionally exported:

  • @EXPORT_OK - An array of additional variables that can be exported.

AUTHOR

Andrea Telatin <proch@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2023 by Andrea Telatin.

This is free software, licensed under:

The MIT (X11) License