Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: I have finally done it; wrote a Tesla API library for Perl!

by stevieb (Canon)
on Mar 18, 2022 at 22:46 UTC ( [id://11142249]=note: print w/replies, xml ) Need Help??


in reply to Re: I have finally done it; wrote a Tesla API library for Perl!
in thread I have finally done it; wrote a Tesla API library for Perl!

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;

Replies are listed 'Best First'.
Re^3: I have finally done it; wrote a Tesla API library for Perl!
by perldigious (Priest) on Mar 21, 2022 at 17:22 UTC

    In that instance was it best designated as Mock::Sub, or should it have been designated Mock::HighwayPatrol? :-)

    Just another Perl hooker - My clients appreciate that I keep my code clean but my comments dirty.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142249]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-28 21:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found