in reply to CGI::App catch and email database errors

You are assigning an array to a scalar, which means the $error variable is going to contain the number of arguments to the sub, which is probably not what you intended.

Replies are listed 'Best First'.
Re^2: CGI::App catch and email database errors
by Anonymous Monk on Apr 12, 2010 at 10:57 UTC
    Also using warn as a way to send email is doubly weird
      it is only an example, to prove that I'm not geting passed what I thought. As you can see from the example sub, there is no email sent.

        So, if sending email works, why do you show us only the working part of your code? I would think it is far more likely that the error is in some other part instead of the part of the code which you know works.

        So, consider going back to reducing your program to a small, self-contained sample that fails to work.

Re^2: CGI::App catch and email database errors
by Anonymous Monk on Apr 12, 2010 at 12:17 UTC
    HOw do I do this properly then?

      You could try:

      my ($error, $next_arg)=@_; # Grab multiple items at once my $error2 = $_[0]; # Access the item you want my $error3 = shift; # Shift it off the argument list

      ...roboticus

      perlintro
      foo(1,2,3,9); sub foo { my $scalar = @_; my( $one, $two, $three, $four ) = @_; warn $scalar; warn "$one $two $three $four "; } __END__ 4 at - line 6. 1 2 3 9 at - line 7.