/[Frey]/trunk/lib/Frey/JSON.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/Frey/JSON.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 455 - (show annotations)
Wed Nov 19 15:28:23 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 316 byte(s)
rename invocable events with prefix as_ with fallback in Frey::Web

This started with brute-force rename using:

  perl -p -i -n -e 's/sub markup/sub as_markup/'  `grep -lr 'sub markup' lib t`
  perl -p -i -n -e 's/sub data/sub as_data/'      `grep -lr 'sub data' lib t`
  perl -p -i -n -e 's/sub sponge/sub as_sponge/'  `grep -lr 'sub sponge' lib t`

  perl -p -i -n -e 's/->markup/->as_markup/'      `grep -lr -- '->markup' lib t`
  perl -p -i -n -e 's/->data/->as_data/'          `grep -lr -- '->data' lib t`
  perl -p -i -n -e 's/->sponge/->as_sponge/'      `grep -lr -- '->sponge' lib t`

  perl -p -i -n -e 's!/markup!/as_markup!'        `grep -lr -- '/markup' lib t etc`
  perl -p -i -n -e 's!/data!/as_data!'            `grep -lr -- '/data' lib t etc`
  perl -p -i -n -e 's!/sponge!/as_sponge!'        `grep -lr -- '/sponge' lib t etc`

1 package Frey::JSON;
2 use Moose;
3
4 extends 'Frey';
5 with 'Frey::Web';
6
7 =head1 DESCRIPTION
8
9 dump perl data as json
10
11 =cut
12
13 use JSON;
14
15 has data => (
16 is => 'rw',
17 required => 1,
18 );
19
20 sub as_markup {
21 my ($self) = @_;
22 $self->content_type('application/javascript');
23 JSON->new->allow_nonref(1)->encode($self->as_data);
24 }
25
26 1;

  ViewVC Help
Powered by ViewVC 1.1.26