1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use File::Find::Rule;
7use Getopt::Long;
8use Test::Inline;
9
10use lib 'inc';
11use MyInline;
12
13my $quiet;
14GetOptions( 'quiet' => \$quiet );
15
16my $inline = Test::Inline->new(
17    verbose        => !$quiet,
18    ExtractHandler => 'My::Extract',
19    ContentHandler => 'My::Content',
20    OutputHandler  => 'My::Output',
21);
22
23for my $pod (
24    File::Find::Rule->file->name(qr/\.pod$/)->in('lib/Moose/Cookbook') ) {
25    $inline->add($pod);
26}
27
28$inline->save;
29
30{
31
32    package My::Output;
33
34    use Path::Tiny;
35
36    sub write {
37        my $class   = shift;
38        my $name    = shift;
39        my $content = shift;
40
41        $name =~ s/^moose_cookbook_//;
42
43        path( "t/recipes/$name" )->spew( $content );
44
45        return 1;
46    }
47}
48