<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Writing commandlets with parameters in Perl in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Writing-commandlets-with-parameters-in-Perl/m-p/132450#M24038</link>
    <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/60838"&gt;@MartinRohrbach&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Discover Parameters' is not available for Perl commands. You would need to manually add parameters in 'Parameter Definitions' tab.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You code looks fine and it works fine at my end with WFA too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Export your command in .dar file and post here. lets see if that gives any clue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sinhaa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jul 2017 08:55:59 GMT</pubDate>
    <dc:creator>sinhaa</dc:creator>
    <dc:date>2017-07-03T08:55:59Z</dc:date>
    <item>
      <title>Writing commandlets with parameters in Perl</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Writing-commandlets-with-parameters-in-Perl/m-p/132447#M24037</link>
      <description>&lt;P&gt;Summary: I've noticed a strange behaviour (in WFA 4.0 and 4.1) when writing a Perl commandlet. Although I define the parameters correctly (I think), they are not passed to the perl code properly unless I actually craft a Powershell param() equivalent and use that to discover the parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Take this simple example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;use strict;
use warnings;
use Getopt::Long;
use WFAUtil;
use Data::Dumper;

my $wfa_util = WFAUtil-&amp;gt;new();

my $success = 'true';
GetOptions(
  "success:s" =&amp;gt; \$success
) or die 'Illegal command parameters\n';

$wfa_util-&amp;gt;sendLog('INFO', 'Success: ' . $success);&lt;/PRE&gt;&lt;P&gt;I define a parameter "success" as a boolean on the "Parameters Definition" tab and the "Parameters Mapping" tab is populated automatically. Now when I run this commandlet, I always get "Success: true" despite what value I select on the test. Diving into the perl specifics, it looks like the parameter is passed only after a '--' argument which causes GetOptions to ignore the parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only way to get aroud this seems to be to define a minimal PowerShell script which can be used to discover the same parameter (i.e. the config tabs look exactly the same as before after the discovery):&lt;/P&gt;&lt;PRE&gt;param (
  [parameter (Mandatory=$False, HelpMessage="None")]
  [boolean]$success
)&lt;/PRE&gt;&lt;P&gt;And then suddenly the Perl code works as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, maybe I missed something obvious and this is not a bug which is why I post it here before opening up a ticket with support. Any ideas anyone?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 14:53:52 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Writing-commandlets-with-parameters-in-Perl/m-p/132447#M24037</guid>
      <dc:creator>MartinRohrbach</dc:creator>
      <dc:date>2025-06-04T14:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Writing commandlets with parameters in Perl</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Writing-commandlets-with-parameters-in-Perl/m-p/132450#M24038</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/60838"&gt;@MartinRohrbach&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Discover Parameters' is not available for Perl commands. You would need to manually add parameters in 'Parameter Definitions' tab.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You code looks fine and it works fine at my end with WFA too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Export your command in .dar file and post here. lets see if that gives any clue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sinhaa&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 08:55:59 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Writing-commandlets-with-parameters-in-Perl/m-p/132450#M24038</guid>
      <dc:creator>sinhaa</dc:creator>
      <dc:date>2017-07-03T08:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Writing commandlets with parameters in Perl</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Writing-commandlets-with-parameters-in-Perl/m-p/132473#M24051</link>
      <description>&lt;P&gt;Thanks for looking into this. And I've found the problem as well. Why not write your first ever post based on a rookie mistake, kinda makes sense ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was about to recreate the commad one more time in order to export to dar as you requested. This is when I finally realized my mistake. When adding the parameters manually, you press "Add Parameter" to add a blank line. I then double (!) clicked the name column of that blank line to fill it in -- not realizing that a double click will put the cursor behind a single space character. So I ended up adding a parameter called " success" rather than "success" everytime which obviously cannot work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies for the rookie mistake, but at least posting here helped me solve my personal problem. Yay for the community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe there are technical reasons for putting in the single space character for new parameters - if not, it might make sense to remove it in future versions to avoid my mistake?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jul 2017 08:51:59 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Writing-commandlets-with-parameters-in-Perl/m-p/132473#M24051</guid>
      <dc:creator>MartinRohrbach</dc:creator>
      <dc:date>2017-07-04T08:51:59Z</dc:date>
    </item>
  </channel>
</rss>

