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 unitialized value, and returns an empty Parrot string.

PMC *get_pmc()

Warns of the use of an unitialized 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.

void add(PMC *value, PMC *dest)

void add_int(INTVAL value, PMC *dest)

void add_float(FLOATVAL value, PMC *dest)

void subtract(PMC *value, PMC *dest)

void subtract_int(INTVAL value, PMC *dest)

void subtract_float(FLOATVAL value, PMC *dest)

void multiply(PMC *value, PMC *dest)

void multiply_int(INTVAL value, PMC *dest)

void multiply_float(FLOATVAL value, PMC *dest)

void divide(PMC *value, PMC *dest)

void divide_int(INTVAL value, PMC *dest)

void divide_float(FLOATVAL value, PMC *dest)

void modulus(PMC *value, PMC *dest)

void modulus_int(INTVAL value, PMC *dest)

void modulus_float(FLOATVAL value, PMC *dest)

void bitwise_or(PMC *value, PMC *dest)

void bitwise_or_int(INTVAL value, PMC *dest)

void bitwise_and(PMC *value, PMC *dest)

void bitwise_and_int(INTVAL value, PMC *dest)

void bitwise_xor(PMC *value, PMC *dest)

void bitwise_xor_int(INTVAL value, PMC *dest)

void bitwise_not(PMC *dest)

void concatenate(PMC *value, PMC *dest)

void concatenate_str(STRING *value, PMC *dest)

All these methods warn of the use of an unitialized value, and return the calculated result in *dest.

In the division methods exceptions are raised for division by zero, if appropriate.

INTVAL is_equal(PMC *value)

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

void logical_or(PMC *value, PMC *dest)

void logical_and(PMC *value, PMC *dest)

void logical_xor(PMC *value, PMC *dest)

void logical_not(PMC *dest)

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.

void repeat(PMC *value, PMC *dest)

void repeat_int(INTVAL value, PMC *dest)

Warns of the use of an undefined value and returns an empty PerlString in *dest.

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