# Copyright 1999-2016. Parallels IP Holdings GmbH. All Rights Reserved.
package AgentConfig;

use strict;
use vars qw|$AUTOLOAD|;

my $instance;

sub init {
  if (eval "require SpecificConfig") {
    return 1 if $instance = SpecificConfig->new();
  } else {
    use CommonConfig;
    return 1 if $instance = CommonConfig->new();
  }
}

sub AUTOLOAD {
  my $name = $AUTOLOAD;
  $name =~ s/.*://;

  if (!$instance) {
    init() or die;
  }

  return $instance->$name(@_);
}

1;
