Open evgenyigumnov opened 2 days ago
Launch example
rustsn --lang=perl
Example query:
take 2 params and add them and return result
Example generation:
Makefile.PL
use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Solution', VERSION_FROM => 'lib/Solution.pm', # finds $VERSION AUTHOR => 'Your Name <you@example.com>', ABSTRACT => 'Minimalistic Perl project', TESTS => 't/*.t', PREREQ_PM => { 'Test::More' => 0, }, );
lib/Solution.pm
package Solution; use strict; use warnings; use Exporter 'import'; our @EXPORT_OK = ('add'); sub add { my ($a, $b) = @_; return $a + $b; } 1;
t/solution.t
use strict; use warnings; use Test::More tests => 3; use Solution qw(add); is(add(1, 2), 3, 'add(1, 2) should return 3'); is(add(-1, -2), -3, 'add(-1, -2) should return -3'); is(add('1', 2), '12', 'add("1", 2) should return "12"');
Example install dependencies and build
perl Makefile.PL make make test make install
Example launch test
prove -l t/
Launch example
Example query:
Example generation:
Makefile.PL
lib/Solution.pm
t/solution.t
Example install dependencies and build
Example launch test