summaryrefslogtreecommitdiff
path: root/scripts/vyatta-find-type.pl
blob: b6514f00fd713d7020a287e77a2ae4e373b8dac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

use strict;
use lib "/opt/vyatta/share/perl5/";
use VyattaTypeChecker;

# find the type of a value (from a list of candidates)
if ($#ARGV < 1) {
  print "usage: vyatta-find-type.pl <value> <type> [<type> ...]\n";
  exit 1;
}

if (my $type = VyattaTypeChecker::findType(@ARGV)) {
  # type found
  print "$type";
  exit 0;
}

# value not valid for any of the candidates
exit 1;