Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a subroutine defined

sub sadk_flap_mx_ifd_laser { my $r = shift; my $sub = sub_name; return $r->error_handler('S', "$sub: MX-VC does not support laser +off/on") if (exists $r->{MX_VC_CHASSIS} && $r->{MX_VC_CHASSIS}); my $args = get_args(["FLAP", "IFD"],@_); return $r->error_handler('S',"$sub: FAIL. Missing mandatory argume +nt 'IFD' in API call") unless (defined $args->{IFD}); $args->{IFD} = [$args->{IFD}] unless (ref $args->{IFD} ne "ARRAY") +; return $r->error_handler('S', "$sub: Empty list in argument 'IFD'" +) if (@{$args->{IFD}} == 0); $args->{FLAP} = 1 unless (defined $args->{FLAP}); my ($i,$ifd, $fpc); foreach $ifd (@{$args->{IFD}}) { ($fpc) = $ifd =~ /\w+-(\d+)\/\d+\/\d+/; $r->mode_shell; put_log("\n\n"); $r->put_log("Turn off/on laser on interface $ifd $args->{FLAP} + times"); foreach $i (1..$args->{FLAP}) { $r->shell(cmd => "cprod -A fpc$fpc -c \"test ifdev $ifd la +ser off\""); sleep 20; $r->shell(cmd => "cprod -A fpc$fpc -c \"test ifdev $ifd la +ser on\""); sleep 20; } } put_log("\n\n"); $r->mode_cli; return 1; }

I am trying to call this subroutine from a different file

$t->sadk_flap_mx_ifd_laser(ifd=>@child_interfaces, flap=>$flaps);

While executing the code, I see there are errors. I doubt am not passing the correct value . @childinterfaces have the valures, et-14/1/1, et-5/1/ that till 10 interfaces.

Sep 13 06:27:05 ERROR JT::get_args: Argument "ET-5/1/0" is invalid JT::error_handler HARD at /volume/labtools/lib/ line 2739. JT::get_args('ARRAY(0x11ce6c00)', 'ifd', 'et-14/1/1', 'et-5/1/0', 'et-1/0/0', 'flap', 10) called at /volume/labtools/lib/Testsuites/PDT/lib/ line 1032 Testsuites::PDT::lib::SADK::sadk_flap_mx_ifd_laser('JT::Test=HASH(0xdde63d0)', 'ifd', 'et-14/1/1', 'et-5/1/0', 'et-1/0/0', 'flap', 10) called at line 267 UC705_FT_testcases::ae_child_link_flap_remote_lasers called at (eval 704) line 1

canu help here