Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Parameter Asserts - How do you use them?

by demerphq (Chancellor)
on Apr 16, 2003 at 22:04 UTC ( [id://251064]=note: print w/replies, xml ) Need Help??


in reply to Parameter Asserts - How do you use them?

    assertion

    1. \As*ser"tion\, n. [L. assertio, fr. asserere.] The act of asserting, or that which is asserted; positive declaration or averment; affirmation; statement asserted; position advanced.
    2. <programming> An expression which, if false, indicates an error. Assertions are used for debugging by catching can't happen errors.
    3. <programming> In logic programming, a new fact or rule added to the database by the program at run time. This is an extralogical or impure feature of logic programming languages.

    Dictionary.com

Id just like to note that in newer versions of perl (5.10) there will be a much more extensive and powerful assertion/debugging interface than was available in earlier versions. You will be able to use a switch to compile time remove all asssertion code, as well as a number of other features. Carp::Assert will at that time become obsolete, or perhaps a wrapper for cross version compatibility.

BTW: whenever you say something like

sub do_something { my $with_x=shift or die "Must have an x to do_something with!"; }

you are doing an assertion.


---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://251064]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-26 06:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found