]> git.proxmox.com Git - proxmox-perl-rs.git/blob - Proxmox/Lib/Common.pm
bump proxmox-tfa to 4
[proxmox-perl-rs.git] / Proxmox / Lib / Common.pm
1 package Proxmox::Lib::Common;
2
3 =head1 NAME
4
5 Proxmox::Lib::Common - base module for rust bindings common between PVE and PMG
6
7 =head1 SYNOPSIS
8
9 package Proxmox::RS::CalendarEvent;
10
11 use base 'Proxmox::Lib::Common';
12
13 BEGIN { __PACKAGE__->bootstrap(); }
14
15 1;
16
17 =head1 DESCRIPTION
18
19 This is the base modules for bindings which are provided by both PVE and PMG. This will ensure that
20 either Proxmox::Lib::PVE or Proxmox::Lib::PMG have been loaded (in that order) and then use
21 whichever was loaded.
22
23 =cut
24
25 use vars qw(@ISA);
26
27 sub library {
28 return '-current';
29 }
30
31 BEGIN {
32 my $data = ($::{'proxmox-rs-library'} //= {});
33 my $base = $data->{-package};
34 if ($base) {
35 push @ISA, $base;
36 } else {
37 eval { require Proxmox::Lib::PVE and push @ISA, 'Proxmox::Lib::PVE'; };
38 eval { require Proxmox::Lib::PMG and push @ISA, 'Proxmox::Lib::PMG'; } if $@;
39 die $@ if $@;
40 }
41 }
42
43 1;