The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lab::SCPI - Match SCPI headers and parameters against keywords.

This module exports a single function:

scpi_match($header, $keyword)

Return true, if $header matches the SCPI keyword expression $keyword.

Examples

The calls

 scpi_match($header, 'voltage[:APERture]')
 scpi_match($header, 'voltage|CURRENT|resistance')
 scpi_match($header, '[:abcdef]:ghi[:jkl]')

are convenient replacements for

 $header =~ /^(voltage:aperture|voltage:aper|voltage|volt:aperture|volt:aper|volt)$/i
 $header =~ /^(voltage|volt|current|curr|resistance|res)$/i
 $header =~ /^(:abcdef:ghi:jkl|:abcdef:ghi|:abcd:ghi:jkl|:abcd:ghi|:ghi:jkl|:ghi)$/i

respectively.

Leading and trailing whitespace is removed from the first argument, before matching against the keyword.

Keyword Structure

See Sec. 6 "Program Headers" in the SCPI spec. Always give the long form of a keyword; the short form will be derived automatically. The colon is optional for the first mnemonic. There must be at least one non-optional mnemonic in the keyword.

scpi_match will throw, if it is given an invalid keyword.