| 1 | package Regexp::MultiLanguage::Perl; | ||
| 2 | |||
| 3 | use base qw(Regexp::MultiLanguage::BaseDialect); | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Regexp::MultiLanguage::Perl - Perl dialect for Regexp::MultiLanguage. | ||
| 10 | |||
| 11 | =head1 VERSION | ||
| 12 | |||
| 13 | Version 0.03 | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | our $VERSION = 0.03; | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | This module should not be used directly. Please read the documentation | ||
| 22 | for L<Regexp::MultiLanguage> | ||
| 23 | |||
| 24 | =cut | ||
| 25 | |||
| 26 | sub wrap { | ||
| 27 | my ($this, $code) = @_; | ||
| 28 | my $ret = ''; | ||
| 29 | if ( defined( $this->{'package'} ) ) { | ||
| 30 | $ret .= 'package ' . $this->{'package'} . ";\n\n"; | ||
| 31 | } | ||
| 32 | $ret .= $code . "\n1;\n"; | ||
| 33 | } | ||
| 34 | |||
| 35 | sub match_regex { | ||
| 36 | my ($this, $regex) = @_; | ||
| 37 | |||
| 38 | return '($_[0] =~ ' . $regex . ')'; | ||
| 39 | } | ||
| 40 | |||
| 41 | sub comment_start { | ||
| 42 | return '#'; | ||
| 43 | } | ||
| 44 | |||
| 45 | sub make_function { | ||
| 46 | my ($this,$name,$expr) = @_; | ||
| 47 | my $prefix = $this->{'prefix'}; | ||
| 48 | return "sub $prefix$name { $expr }\n"; | ||
| 49 | } | ||
| 50 | |||
| 51 | sub function_call { | ||
| 52 | my ($this,$name) = @_; | ||
| 53 | my $prefix = $this->{'prefix'}; | ||
| 54 | return "$prefix$name(\$_[0])"; | ||
| 55 | } | ||
| 56 | |||
| 57 | =head1 AUTHOR | ||
| 58 | |||
| 59 | Robby Walker, robwalker@cpan.org | ||
| 60 | |||
| 61 | =head1 COPYRIGHT & LICENSE | ||
| 62 | |||
| 63 | Copyright 2006 Robby Walker, all rights reserved. | ||
| 64 | |||
| 65 | This program is free software; you can redistribute it and/or modify it | ||
| 66 | under the same terms as Perl itself. | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | 1; |