07-08-2010
@Franklin:
Thanks for pointing that out!!
I was under the impression that it will not throw an error if its zero. I still dont understand why it is not recognizing 0 as a valid number.Can you explain why it is behaving like that??
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
If I have a variable $X, how do I check it is a number?
Many thanks. (2 Replies)
Discussion started by: handak9
2 Replies
2. Shell Programming and Scripting
Hi ,
I am facing a problem .. which looks simple... but took 2 days of mine.. even now it is not solved completely..
I have one variable..., want to know whether that variable contains number... canbe +ve or -ve ...
Values
+35 --- number
-43 --- number
45A -- non number... (12 Replies)
Discussion started by: shihabvk
12 Replies
3. Shell Programming and Scripting
Hi,,
this is returning true in all cases..( other than 10 dig number also)
what could be wrong?? (2 Replies)
Discussion started by: shellwell
2 Replies
4. Shell Programming and Scripting
hi,
I would like to calculate number of character for a number,
for exemple : 1200 --> there are 4 characters , 120001 -> 5 characters (4 Replies)
Discussion started by: francis_tom
4 Replies
5. Shell Programming and Scripting
Hi,
I have one file like 00123. And this file name is generated as a sequence.
So how can I confirm the generated file name is a number, not a special character or alphabets.
Can anybody help me out.
Thanks in advance. (3 Replies)
Discussion started by: Kattoor
3 Replies
6. Shell Programming and Scripting
Hey,
I am trying to check if an integer is even in a tcsh script
This is what I am running now
set lattest = ` echo $latmin "%2" | bc -l `
echo $lattest
if ( $lattest == 0 ) then
echo "min is already even"
else if ( $lattest =! 0 ) then
set latmin = ` echo $latmin "+1" |... (2 Replies)
Discussion started by: travish12
2 Replies
7. Shell Programming and Scripting
I have 2 and three params, both I should make sure thay numbers at one single line insted of checking for each one .
Example I wroote the following way.. checking for 2 and three seperately but I shud be able to do it at on statement
echo $2 | egrep '^+$' >/dev/null 2>&1
if ; then
echo... (2 Replies)
Discussion started by: raopatwari
2 Replies
8. Shell Programming and Scripting
Hi,
We are getting a curios result in one of AIX script. Its executed using !/bin/ksh .
After following line we get result of 3 in in the variable instance_count.
instance_count=`ps -ef | grep "script_check_instances.sh" | grep -v "grep" | wc -l`
But once we do a "ps -aef | grep... (2 Replies)
Discussion started by: niba
2 Replies
9. Shell Programming and Scripting
Hi Gurus,
I need check existing number of file based on the list in file list.
for example:
in my file list. I have below:
abc, file1.txt
abc, file2.txt
abc, file3.txt
abc, file4.txt
cde, filea1.txt
cde, filea2.txt
cde, filea3.txt
...
in my current file direcotry, I have file:... (0 Replies)
Discussion started by: ken6503
0 Replies
10. UNIX for Dummies Questions & Answers
Hello,
May i please know how do i check if the given input argument is one of the listed numbers then success else failure. I am using bash shell.
if
then
echo "success"
else
echo "failure"
fi
Thank you. (2 Replies)
Discussion started by: Ariean
2 Replies
LEARN ABOUT DEBIAN
plack::middleware::httpexceptions
Plack::Middleware::HTTPExceptions(3pm) User Contributed Perl Documentation Plack::Middleware::HTTPExceptions(3pm)
NAME
Plack::Middleware::HTTPExceptions - Catch HTTP exceptions
SYNOPSIS
use HTTP::Exception;
my $app = sub {
# ...
HTTP::Exception::500->throw;
};
builder {
enable "HTTPExceptions", rethrow => 1;
$app;
};
DESCRIPTION
Plack::Middleware::HTTPExceptions is a PSGI middleware component to catch exceptions from applications that can be translated into HTTP
status codes.
Your application is supposed to throw an object that implements a "code" method which returns the HTTP status code, such as 501 or 404.
This middleware catches them and creates a valid response out of the code. If the "code" method returns a code that is not an HTTP redirect
or error code (3xx, 4xx, or 5xx), the exception will be rethrown.
The exception object may also implement "as_string" or overload stringification to represent the text of the error. The text defaults to
the status message of the error code, such as Service Unavailable for 503.
Finally, the exception object may implement "as_psgi", and the result of this will be returned directly as the PSGI response.
If the code is in the 3xx range and the exception implements the 'location' method (HTTP::Exception::3xx does), the Location header will be
set in the response, so you can do redirects this way.
There are CPAN modules HTTP::Exception and HTTP::Throwable, and they are perfect to throw from your application to let this middleware
catch and display, but you can also implement your own exception class to throw.
If the thrown exception is not an object that implements either a "code" or an "as_psgi" method, a 500 error will be returned.
Alternatively, you can pass a true value for the "rethrow" parameter for this middleware, and the exception will instead be rethrown. This
is enabled by default when "PLACK_ENV" is set to "development", so that the StackTrace middleware can catch it instead.
AUTHOR
Tatsuhiko Miyagawa
SEE ALSO
paste.httpexceptions HTTP::Exception HTTP::Throwable
perl v5.14.2 2011-06-22 Plack::Middleware::HTTPExceptions(3pm)