Server IP : / Your IP : 10.244.4.16 [ Web Server : nginx/1.25.3 System : Linux escuela-portal-app-54f56585bc-kst6g 5.15.0-1084-azure #93-Ubuntu SMP Sat Mar 15 14:12:29 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.13 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, Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/share/perl/5.36/Math/BigRat/ |
Upload File : |
# -*- mode: perl; -*- package Math::BigRat::Trace; use strict; use warnings; use Exporter; use Math::BigRat; our @ISA = qw(Exporter Math::BigRat); our $VERSION = '0.65'; use overload; # inherit overload from Math::BigRat # Globals our $accuracy = undef; our $precision = undef; our $round_mode = 'even'; our $div_scale = 40; sub new { my $proto = shift; my $class = ref($proto) || $proto; my $value = shift; my $a = $accuracy; $a = $_[0] if defined $_[0]; my $p = $precision; $p = $_[1] if defined $_[1]; my $self = $class -> SUPER::new($value, $a, $p, $round_mode); printf "Math::BigRat new '%s' => '%s' (%s)\n", $value, $self, ref($self); return $self; } sub import { my $class = shift; printf "%s -> import(%s)\n", $class, join(", ", @_); # we catch the constants, the rest goes to parent my $constant = grep { $_ eq ':constant' } @_; my @a = grep { $_ ne ':constant' } @_; if ($constant) { overload::constant integer => sub { $class -> new(shift); }, float => sub { $class -> new(shift); }, binary => sub { # E.g., a literal 0377 shall result in an object whose value # is decimal 255, but new("0377") returns decimal 377. return $class -> from_oct($_[0]) if $_[0] =~ /^0_*[0-7]/; $class -> new(shift); }; } $class -> SUPER::import(@a); # need it for subclasses #$self -> export_to_level(1, $class, @_); # need this ? } 1;