File: VR8.pm

package info (click to toggle)
razor 1%3A2.85-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 848 kB
  • sloc: perl: 4,694; ansic: 178; makefile: 19; sh: 3
file content (45 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (8)
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
44
45
package Razor2::Engine::VR8;
use Razor2::Signature::Whiplash;
use Razor2::String qw(hextobase64);
use Data::Dumper;

sub new {
    
    my ($class, %args) = @_;

    my $self = bless {
        description      => 'whiplash',
        has_greet_param  => 0,
        whiplash         => new Razor2::Signature::Whiplash,
        rm               => $args{RM},
    }, $class;

    die unless $self;

    return $self;

}


sub signature { 

    my ($self, $text) = @_;
    my ($sigs, $meta) = $self->{whiplash}->whiplash($$text);

    my @sigs_to_return;
    return unless $sigs;

    if (scalar @$sigs) { 
        for (@$sigs) { 
            push @sigs_to_return, hextobase64($_); 
        }
    } else { 
        return;
    } 

    return \@sigs_to_return; 
    
}

1;