CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [rovf] Use subroutine instead die message: Edit Log



waldauf
Novice

Aug 23, 2012, 5:58 AM


Views: 1284
Re: [rovf] Use subroutine instead die message

I was talking about Perl of course but I bad wrote Python (now it is fixed) :]. I found out solution which was very simply so I wanted to remove my topic but I removed only first post. I'll fix it.

I couldn't run subroutine instead of "die message" because I removed word "die". Now it is working fine.

My previous line:

Code
GetOptions ('channel=s' => \$channel, 'state=s' => \$state) or BadInputParam_s(@ARGV);


And the solution:

Code
GetOptions ('channel=s' => \$channel, 'state=s' => \$state) or die BadInputParam_s(@ARGV);





Now I have problem with handover variable/scalar to subroutine. Permit parameters are -s|--state and -c|--channel.

Code
sub BadInputParam_s { 
print <<EOF;
Input parameter: @_ is not allowed. For more information use help screen.

EOF
exit 1;
}


#GetOptions ('channel=s' => \$channel, 'state=s' => \$state, 'help' => \$help) or die "Uncorrect usege!\n";
GetOptions ('channel=s' => \$channel, 'state=s' => \$state, 'help' => \$help) or die BadInputParam_s(@ARGV);


Output:

Code
 ~ $ ./remote_channel_ctrl.pl -a 
Input parameter: is not allowed. For more information use help screen.



(This post was edited by waldauf on Aug 23, 2012, 6:11 AM)


Edit Log:
Post edited by waldauf (Novice) on Aug 23, 2012, 6:10 AM
Post edited by waldauf (Novice) on Aug 23, 2012, 6:11 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives