Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Jan 14, 2015
0 parents commit 643c105
Show file tree
Hide file tree
Showing 9 changed files with 281 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .travis.yml
@@ -0,0 +1,46 @@
# DO NOT EDIT
#
# This .travis.yml file generated by Zilla::Dist. To upgrade it, run:
#
# > make update
#

language: perl

perl:
- '5.20'
- '5.18'
- '5.16'
- '5.14'
- '5.12'
- '5.10'
- '5.8'

install:
- cpanm --quiet --notest
Devel::Cover::Report::Coveralls
Inline
Inline::C

script:
- test -e test &&
PERL5OPT=-MDevel::Cover=-coverage,statement,branch,condition,path,subroutine
prove -lv test/
|| true
- test -e test && cover || true

after_success:
- cover -report coveralls

notifications:
irc:
channels:
- irc.perl.org#inline
on_success: change
on_failure: always
skip_join: true

# Hack to not run on tag pushes:
branches:
except:
- /^v?[0-9]+\.[0-9]+/
5 changes: 5 additions & 0 deletions Changes
@@ -0,0 +1,5 @@
---
version: 0.0.1
date: Tue Jan 13 18:09:21 PST 2015
changes:
- First Release
8 changes: 8 additions & 0 deletions MANIFEST.SKIP
@@ -0,0 +1,8 @@
.git/
.travis.yml$
_build/
Build
Makefile$
MANIFEST.SKIP$
MANIFEST.bak$
MYMETA
39 changes: 39 additions & 0 deletions Makefile.PL
@@ -0,0 +1,39 @@
use 5.008001; use strict; use warnings; use utf8;

use lib 'inc';
use ExtUtils::MakeMaker;
use Inline::Module;

my $alt = $ENV{PERL_ALT_INSTALL} || '';
WriteMakefile(
NAME => 'Alt::Acme::Math::XS::EUMM',
VERSION => '0.0.16',
ABSTRACT => 'Math is HARD (faster!)',
AUTHOR => 'Ingy döt Net <ingy@cpan.org>',
LICENSE => 'perl',
MIN_PERL_VERSION => '5.008001',
test => { TESTS => 't/*.t' },
postamble => {
inline => {
module => 'Acme::Math::XS',
makestub => 1,
},
},
META_MERGE => {
'meta-spec' => { version => 2 },
prereqs => {
develop => {
requires => {
'Inline::C' => '0.68',
},
},
},
no_index => {
directory => [
'inc',
'lib/Acme',
],
},
},
DESTDIR => $alt ? $alt eq 'OVERWRITE' ? '' : $alt : 'no-install-alt',
);
59 changes: 59 additions & 0 deletions README
@@ -0,0 +1,59 @@
NAME
Acme::Math::XS - Math is HARD (faster!)

SYNOPSIS
use Acme::Math::XS;

print "2 + 2 = ${\add(2, 2)}\n";

DESCRIPTION
This is a tiny example "XS" module. It was written to show how one would
write the same thing using Inline::Module, Inline, Inline::C and
Inline::CPP.

It has a pure "XS" version and "Alt"(ternate) modules for all the common
CPAN module frameworks.

The source code for all these modules is in one git repository, on
separate branches: <https://github.com/ingydotnet/acme-math-xs-pm>

SEE
Acme::Math::XS
Pure XS version, shipped with ExtUtils::MakeMaker.

Alt::Acme::Math::XS::EUMM
Inline::Module (using Inline::C) version shipped with plain old
ExtUtils::MakeMaker.

Alt::Acme::Math::XS::DistZilla
Inline::Module version shipped with Dist::Zilla and
Dist::Zilla::Plugin::InlineModule.

Alt::Acme::Math::XS::ZillaDist
Inline::Module version shipped with Zilla::Dist.

Alt::Acme::Math::XS::ModuleBuild
Inline::Module version shipped with Module::Build and
Module::Build::InlineModule.

Alt::Acme::Math::XS::ModuleInstall
Inline::Module version shipped with Module::Build and
Module::Build::InlineModule.

Alt::Acme::Math::XS::CPP
Inline::Module (using Inline::CPP) version shipped with
ExtUtils::MakeMaker.

AUTHORS
* Ingy döt Net <ingy@cpan.org>

* David Oswald <davido@cpan.org>

COPYRIGHT
Copyright 2014. Ingy döt Net.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See <http://www.perl.com/perl/misc/Artistic.html>

22 changes: 22 additions & 0 deletions lib/Acme/Math/XS.pm
@@ -0,0 +1,22 @@
use strict; use warnings;
package Acme::Math::XS;
# our $VERSION = 'x.x.x';
use Alt::Acme::Math::XS::EUMM;

use Exporter 'import';
our @EXPORT = qw(
add
subtract
);

use Inline::Module::LeanDist C => <<'...';
long add(long a, long b) {
return a + b;
}
long subtract(long a, long b) {
return a - b;
}
...

1;
92 changes: 92 additions & 0 deletions lib/Acme/Math/XS.pod
@@ -0,0 +1,92 @@
=pod

=for comment
DO NOT EDIT. This Pod was generated by Swim v0.1.31.
See http://github.com/ingydotnet/swim-pm#readme

=encoding utf8

=head1 NAME

Acme::Math::XS - Math is HARD (faster!)

=for html
<a href="https://travis-ci.org/ingydotnet/acme-math-xs-pm"><img src="https://travis-ci.org/ingydotnet/acme-math-xs-pm.png" alt="acme-math-xs-pm"></a>

=head1 SYNOPSIS

use Acme::Math::XS;

print "2 + 2 = ${\add(2, 2)}\n";

=head1 DESCRIPTION

This is a tiny example "XS" module. It was written to show how one would write
the same thing using L<Inline::Module>, L<Inline>, L<Inline::C> and
L<Inline::CPP>.

It has a pure "XS" version and "Alt"(ternate) modules for all the common CPAN
module frameworks.

The source code for all these modules is in one git repository, on separate
branches: <https://github.com/ingydotnet/acme-math-xs-pm>

=head1 SEE

=over

=item L<Acme::Math::XS>

Pure XS version, shipped with L<ExtUtils::MakeMaker>.

=item L<Alt::Acme::Math::XS::EUMM>

L<Inline::Module> (using L<Inline::C>) version shipped with plain old
L<ExtUtils::MakeMaker>.

=item L<Alt::Acme::Math::XS::DistZilla>

L<Inline::Module> version shipped with L<Dist::Zilla> and
L<Dist::Zilla::Plugin::InlineModule>.

=item L<Alt::Acme::Math::XS::ZillaDist>

L<Inline::Module> version shipped with L<Zilla::Dist>.

=item L<Alt::Acme::Math::XS::ModuleBuild>

L<Inline::Module> version shipped with L<Module::Build> and
L<Module::Build::InlineModule>.

=item L<Alt::Acme::Math::XS::ModuleInstall>

L<Inline::Module> version shipped with L<Module::Build> and
L<Module::Build::InlineModule>.

=item L<Alt::Acme::Math::XS::CPP>

L<Inline::Module> (using L<Inline::CPP>) version shipped with
L<ExtUtils::MakeMaker>.

=back

=head1 AUTHORS

=over

=item * Ingy döt Net <ingy@cpan.org>

=item * David Oswald <davido@cpan.org>

=back

=head1 COPYRIGHT

Copyright 2014-2015. Ingy döt Net.

This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.

See L<http://www.perl.com/perl/misc/Artistic.html>

=cut
2 changes: 2 additions & 0 deletions lib/Alt/Acme/Math/XS/LeanDist.pm
@@ -0,0 +1,2 @@
package Alt::Acme::Math::XS::LeanDist;
our $VERSION = '0.0.1';
8 changes: 8 additions & 0 deletions t/test.t
@@ -0,0 +1,8 @@
use Test::More;

use Acme::Math::XS;

is add(2, 2), 4, 'Addition works';
is subtract(3, 2), 1, 'Subtraction works';

done_testing;

0 comments on commit 643c105

Please sign in to comment.