From: Brian R. <br...@pr...> - 2007-02-20 05:23:19
|
Hi folks, I'm in a bit of a quandary over how to implement a new MH module supporting an A/V crosspoint switch and wondered if anyone has some suggestions. What I am hoping to do is scan for a number of attached devices, and depending on the number detected, create Voice_Cmd's for a detected number of ports on each of the devices. Since the number of devices and ports are initially unknown, it isn't possible to define a static variable name for the references returned by 'new Voice_Cmd()'. So, I would like to do something like the following: for my $aa (1 .. $px_outputs) { ### Strict refs doesn't like the next line #${'\$v_px_output_' . $aa} = new Voice_Cmd("Set output $px_config_output_alias to [" . join(",", @px_config_input_aliases) . "]"); ### Strict refs doesn't complain about the next line, but it doesn't work either ${eval '\$v_px_output_' . $aa} = new Voice_Cmd("Set output $px_config_output_alias to [" . join(",", @px_config_input_aliases) . "]"); } However, neither seems to work. The first example isn't strict refs compliant. The second barfs at execution time with something strange: Weather_Item eval error: object=$TempOutdoor test=$::Weather{TempOutdoor} error=Global symbol "$v_px_output_16" requires explicit package name at (eval 1095) line 2. Weather_Item eval error: object=$TempOutdoorA test=$::Weather{TempOutdoorApparent} error=Global symbol "$v_px_output_16" requires explicit package name at (eval 1095) line 2. Weather_Item eval error: object=$TempIndoor test=$::Weather{TempIndoor} error=Global symbol "$v_px_output_16" requires explicit package name at (eval 1095) line 2. Weather_Item eval error: object=$DewIndoor test=$::Weather{DewIndoor} error=Global symbol "$v_px_output_16" requires explicit package name at (eval 1095) line 2. Weather_Item eval error: object=$DewOutoor test=$::Weather{DewOutdoor} error=Global symbol "$v_px_output_16" requires explicit package name at (eval 1095) line 2. Weather_Item eval error: object=$HumidOutdoor test=$::Weather{HumidOutdoor} error=Global symbol "$v_px_output_16" requires explicit package name at (eval 1095) line 2 Any suggestions? |