I wrote Mock::Sub several years ago, apparently waiting for this exact problem!
use warnings; use strict; use feature 'say'; use Mock::Sub; use Tesla::Vehicle; my $mock = Mock::Sub->new; my $car = Tesla::Vehicle->new; my $speed_sub = $mock->mock('Tesla::Vehicle::speed'); $speed_sub->return_value(60); # No matter how fast I'm going, we'll always return 60! say $car->speed;
In reply to Re^2: I have finally done it; wrote a Tesla API library for Perl!
by stevieb
in thread I have finally done it; wrote a Tesla API library for Perl!
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |