# IHeartFortran.pm package IHeartFortran; use strict; use warnings; require Exporter; our @ISA = qw( Exporter ); our @EXPORT = qw/ EQV NEQV /; use overload '.' => \&_do_op; sub _do_op { my ($self, $y, $reverse) = @_; $$self{ $reverse ? 'left' : 'right' } = $y; if (exists($$self{left}) and exists($$self{right})) { return $$self{op}->(@$self{qw/ left right /}); } return $self; } sub new { my ($class, $op) = @_; bless { op => $op }, $class; } sub EQV() { __PACKAGE__->new( sub { $_[0] == $_[1] ? 1 : 0 } ) } sub NEQV() { __PACKAGE__->new( sub { $_[0] != $_[1] ? 1 : 0 } ) }