raiserror( { msg_id | msg_string }, severity, state)
msg_id typically >=50000
severity 0..16
state 0..255 (location identifier)
Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )
Thursday, September 23, 2010
Thursday, September 16, 2010
Perl package 'constants'
If you use variables as 'constants', and you want to use them in a package, they should be defined in a BEGIN block inside the package, which (I think) is run as soon as the package is parsed by Perl.
package Map;
{
use Carp;
local ($s);
BEGIN {
$s = sqrt(2);
}
} I think this is the same problem I recently came across here - if you define your 'constants' in the outermost scope of the package, you won't find them set when your script runs. It seems like they get re-initialised to undef at some point after they're defined. (Btw in modern versions of Perl the 'use constant' pragma is a much better way of defining constants.)
package Map;
{
use Carp;
local ($s);
BEGIN {
$s = sqrt(2);
}
} I think this is the same problem I recently came across here - if you define your 'constants' in the outermost scope of the package, you won't find them set when your script runs. It seems like they get re-initialised to undef at some point after they're defined. (Btw in modern versions of Perl the 'use constant' pragma is a much better way of defining constants.)
Subscribe to:
Comments (Atom)