| 1 | # ========================================== | ||
| 2 | # Copyright (C) 2004 kyle dawkins | ||
| 3 | # kyle-at-centralparksoftware.com | ||
| 4 | # ObjectivePerl is free software; you can | ||
| 5 | # redistribute and/or modify it under the | ||
| 6 | # same terms as perl itself. | ||
| 7 | # ========================================== | ||
| 8 | |||
| 9 | package ObjectivePerl; | ||
| 10 | |||
| 11 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 1 | ▶ | use vars qw($DEBUG_SOURCE $DEBUG_MESSAGING $DEBUG_ALL); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 1 | ▶ | use Filter::Simple; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use ObjectivePerl::Runtime; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | use ObjectivePerl::Parser; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 17 | use ObjectivePerl::InstanceVariable; | ||
| 18 | |||
| 19 | our $VERSION = '0.04'; | ||
| 20 | |||
| 21 | # debug levels; these are a bitmask | ||
| 22 | # so you can combine more than one using the | operator | ||
| 23 | $DEBUG_SOURCE = 0x0001; | ||
| 24 | $DEBUG_MESSAGING = 0x0002; | ||
| 25 | $DEBUG_ALL = 0xffff; | ||
| 26 | |||
| 27 | my $parser = ObjectivePerl::Parser->new(); | ||
| 28 | |||
| 29 | FILTER { | ||
| 30 | $parser->initWithString($_); | ||
| 31 | $_ = join("", @{$parser->content()}); | ||
| 32 | }; | ||
| 33 | |||
| 34 | sub import { | ||
| 35 | my $module = shift; | ||
| 36 | my %params = @_; | ||
| 37 | |||
| 38 | while (my ($key, $value) = each %params) { | ||
| 39 | if ($key eq "class") { | ||
| 40 | $parser->{_currentClass} = $value; | ||
| 41 | next; | ||
| 42 | } | ||
| 43 | if ($key eq "debug") { | ||
| 44 | my $debugLevel = $value || $DEBUG_ALL; | ||
| 45 | $parser->setDebug($debugLevel); | ||
| 46 | ObjectivePerl::Runtime->runtime()->setDebug($debugLevel); | ||
| 47 | } | ||
| 48 | if ($key eq "CamelBones" && $value) { | ||
| 49 | $parser->setCamelBonesCompatibility(1); | ||
| 50 | ObjectivePerl::Runtime->runtime()->setCamelBonesCompatibility(1); #needed? | ||
| 51 | } | ||
| 52 | # TODO: allow user to change start/end regexps, etc. | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | 1; | ||
| 57 | __END__ | ||