| Spreadsheet-Engine documentation | Contained in the Spreadsheet-Engine distribution. |
Spreadsheet::Engine::Value - A value/type combination
my $op = Spreadsheet::Engine::Value->new(
type => 'n',
value => 10,
);
my $type = $op->type;
my $value = $op->value;
if ($op->is_txt) { ... }
if ($op->is_num) { ... }
if ($op->is_number) { ... }
if ($op->is_blank) { ... }
if ($op->is_logical) { ... }
if ($op->is_error) { ... }
if ($op->is_na) { ... }
In a spreadsheet, values also have an accompanying type. This class represents such a value/type combination.
Instantiate with a type and value.
The value and type.
Does this have a textual type (of any subtype)?
Does this have a numberic type (of any subtype)?
Is this a number (type 'n', no subtype)?
Is this blank?
Is this a logical value (true/false)?
Is this an error?
Is this N/A?
This code was created for Spreadsheet::Engine 0.11
Copyright (c) 2007, 2008 Tony Bowden
The contents of this file are subject to the Artistic License 2.0; you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.perlfoundation.org/artistic_license_2_0
| Spreadsheet-Engine documentation | Contained in the Spreadsheet-Engine distribution. |
package Spreadsheet::Engine::Value;
use strict; use warnings;
use Class::Struct; struct type => '$', value => '$';
sub is_txt { my $self = shift; substr($self->type, 0, 1) eq 't'; }
sub is_num { my $self = shift; substr($self->type, 0, 1) eq 'n'; }
sub is_number { my $self = shift; $self->type eq 'n'; }
sub is_blank { my $self = shift; $self->type eq 'b'; }
sub is_logical { my $self = shift; $self->type eq 'nl'; }
sub is_error { my $self = shift; substr($self->type, 0, 1) eq 'e'; }
sub is_na { my $self = shift; $self->type eq 'e#N/A'; } 1;