Ticket #5319: myth_timezone.pl

File myth_timezone.pl, 779 bytes (added by sphery <mtdean@…>, 16 years ago)

Perl-bindings-based test script

Line 
1#!/usr/bin/perl -w
2#
3# Queries the timezone on the MythTV master backend
4#
5# Automatically detects database settings.
6#
7
8# Includes
9    use DBI;
10    use Getopt::Long;
11    use MythTV;
12
13# Some variables we'll use here
14    our ($usage);
15    our $BACKEND_SEP_rx = qr/\[\]:\[\]/;
16
17# Load the cli options
18    GetOptions('usage|help|h'                  => \$usage
19              );
20
21# Print usage
22    if ($usage) {
23        print <<EOF;
24$0 usage:
25
26options:
27
28--help
29
30    Show this help text.
31
32EOF
33        exit;
34    }
35
36# Connect to mythbackend
37    my $Myth = new MythTV();
38
39# Query the timezone
40    my $response = $Myth->backend_command('QUERY_TIMEZONE');
41
42    my ($offset, $name) = split($BACKEND_SEP_rx, $response);
43
44    print("Current Timezone\n  offset: $offset\n    name: $name\n");
45
46