Server IP : 85.214.239.14 / Your IP : 3.144.109.147 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/root/proc/3/root/proc/3/cwd/lib/x86_64-linux-gnu/perl5/5.36/XML/LibXML/ |
Upload File : |
# $Id$ # # # This is free software, you may use it and distribute it under the same terms as # Perl itself. # # Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas # # package XML::LibXML::Boolean; use XML::LibXML::Number; use XML::LibXML::Literal; use strict; use warnings; use vars qw ($VERSION); $VERSION = "2.0134"; # VERSION TEMPLATE: DO NOT CHANGE use overload '""' => \&value, '<=>' => \&cmp; sub new { my $class = shift; my ($param) = @_; my $val = $param ? 1 : 0; bless \$val, $class; } sub True { my $class = shift; my $val = 1; bless \$val, $class; } sub False { my $class = shift; my $val = 0; bless \$val, $class; } sub value { my $self = shift; $$self; } sub cmp { my $self = shift; my ($other, $swap) = @_; if ($swap) { return $other <=> $$self; } return $$self <=> $other; } sub to_number { XML::LibXML::Number->new($_[0]->value); } sub to_boolean { $_[0]; } sub to_literal { XML::LibXML::Literal->new($_[0]->value ? "true" : "false"); } sub string_value { return $_[0]->to_literal->value; } 1; __END__ =head1 NAME XML::LibXML::Boolean - Boolean true/false values =head1 DESCRIPTION XML::LibXML::Boolean objects implement simple boolean true/false objects. =head1 API =head2 XML::LibXML::Boolean->True Creates a new Boolean object with a true value. =head2 XML::LibXML::Boolean->False Creates a new Boolean object with a false value. =head2 value() Returns true or false. =head2 to_literal() Returns the string "true" or "false". =cut