summaryrefslogtreecommitdiffstats
path: root/lib/Resource/Pack/JSON/URL.pm
blob: 441ce2db410d37cf8f56678d95b38662059d39aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package Resource::Pack::JSON::URL;
use Moose;

extends 'Resource::Pack::URL';

=head1 NAME

Resource::Pack::JSON::URL - subclass of Resource::Pack::URL to clean up the json2.js souce

=head1 DESCRIPTION

This modifies the install process to strip out the alert that json2.js includes
at the top of the file.

=cut

after install => sub {
    my $self = shift;
    my $installed = $self->install_to_absolute;
    my $contents = $installed->slurp;
    $contents =~ s/^\Qalert('IMPORTANT: Remove this line from json2.js before deployment.');\E\n//;
    my $fh = $installed->openw;
    $fh->print($contents);
    $fh->close;
};

__PACKAGE__->meta->make_immutable;
no Moose;

=head1 AUTHOR

  Jesse Luehrs <doy at tozt dot net>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Jesse Luehrs.

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

=cut

1;