NAME ^

classes/perlundef.pmc - Perl Undef

DESCRIPTION ^

PerlUndef extends PerlInt to provide a class with the behaviour of the Perl undef value.

Methods ^

INTVAL get_integer()

Warns of the use of an unitialized value, and returns 0.

FLOATVAL get_number()

Warns of the use of an unitialized value, and returns 0.0.

STRING *get_string()

Warns of the use of an initialized value and returns an empty Parrot string.

PMC *get_pmc()

Warns of the use of an initialized value and returns itself.

INTVAL get_bool()

Returns false.

Note that no warning is raised, as per:

    my $a; print $a if $a;
INTVAL is_same(PMC *pmc2)

Returns whether *pmc2 shares the same vtable.

void set_integer_native(INTVAL value)

Morphs to a PerlInt with value value.

void set_integer_same(PMC *value)

All undefs have the same value, so this does nothing.

void set_string_native(STRING *value)

Morphs to a PerlString with the value of *value.

PMC *add(PMC *value, PMC *dest)

PMC *add_int(INTVAL value, PMC *dest)

PMC *add_float(FLOATVAL value, PMC *dest)

PMC *subtract(PMC *value, PMC *dest)

PMC *subtract_int(INTVAL value, PMC *dest)

PMC *subtract_float(FLOATVAL value, PMC *dest)

PMC *multiply(PMC *value, PMC *dest)

PMC *multiply_int(INTVAL value, PMC *dest)

PMC *multiply_float(FLOATVAL value, PMC *dest)

void divide(PMC *value, PMC *dest)

PMC *divide_int(INTVAL value, PMC *dest)

PMC *divide_float(FLOATVAL value, PMC *dest)

PMC *modulus(PMC *value, PMC *dest)

PMC *modulus_int(INTVAL value, PMC *dest)

PMC *modulus_float(FLOATVAL value, PMC *dest)

INTVAL is_equal(PMC *value)

Warns of the use of an undefined value and returns whether the boolean value of *value is false.

PMC *logical_or(PMC *value, PMC *dest)

PMC *logical_and(PMC *value, PMC *dest)

PMC *logical_xor(PMC *value, PMC *dest)

void i_logical_xor(PMC *value, PMC *dest)

PMC logical_not(PMC *dest)

void i_logical_not()

Since we know that we're false, the logical ops are particularly simple, and there's no need to use the versions in PerlScalar.

All these methods simply return undef itself.

INTVAL defined()

Returns false, of course.

void increment()

Morphs to a PerlInt with value 1.

void decrement()

Morphs to a PerlInt with value -1.


parrot