File: GDTestApp.pm

package info (click to toggle)
libcatalyst-view-gd-perl 0.1-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 116 kB
  • ctags: 7
  • sloc: perl: 128; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (3)
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 GDTestApp;

use strict;
use warnings;

use Catalyst;
use GD;

use GDTestApp::View::GD;

__PACKAGE__->config({
    name       => 'GDTestApp',
    'View::GD' => {} # go with the defaults for now
});

__PACKAGE__->setup;

sub create_image : Private {
    my $self = shift;
    
    my $img   = GD::Image->new(100, 100);

    my $white = $img->colorAllocate(255, 255, 255);
    my $black = $img->colorAllocate(0, 0, 0);       
    my $red   = $img->colorAllocate(255, 0, 0);      

    $img->rectangle(0, 0, 20, 20, $black);    
    $img->rectangle(20, 20, 50, 50, $red);    
    
    return $img;    
}

sub test_one : Global {
    my ($self, $c) = @_;

    $c->stash->{gd_image} = $self->create_image;
    
    $c->forward('GDTestApp::View::GD');
}

1;

__END__