The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

FR24::Utils - Subroutines for FR24-Bot

VERSION

version 0.0.3

SYNOPSIS

    use FR24::Utils;


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

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

    # Save configuration to a file
    FR24::Utils::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::Utils provides utility functions used by FR24-Bot. The module contains methods to check the status of the FR24 server, parse flight data, manage configuration, authorize users, and other utility tasks.

FUNCTIONS

fr24_installed()

This function checks if FR24 is installed on the system.

Returns 1 if installed, 0 otherwise.

fr24_info()

This function provides information about FR24.

Returns a hash reference containing status information such as radar, tracked AC, stats timestamp, link status, etc.

parse_flights($json_text, $test)

This function takes a JSON string as input and parses it to extract flight information. The JSON string should contain flight data in a specific format.

It returns a hash reference with the parsed information.

loadconfig($filename)

This function loads the configuration from a file. It returns a hash reference containing the configuration.

authorized($config, $user)

This function checks if a user is authorized. It takes a hash reference containing the configuration and a user name as input. It returns 1 if the user is authorized, 0 otherwise.

saveconfig($filename, $config)

This function saves the configuration to a file. It takes a filename and a hash reference containing the configuration as input.

url_exists($url)

This function checks if a URL exists. It takes a URL as input and returns 1 if the URL exists, 0 otherwise.

EXPORTS

@EXPORT

Exports the $VERSION variable.

@EXPORT_OK

Exports the following functions: loadconfig, saveconfig, url_exists, authorized, parse_flights, systeminfo.

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