source: perl/lib/BarnOwl/Style/Legacy.pm @ ee183be

release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since ee183be was ee183be, checked in by Nelson Elhage <nelhage@mit.edu>, 12 years ago
Break perlwrap.pm into multiple files. Break perlwrap.pm out into .pm files in perl/lib. With this commit, we keep perlwrap.pm around and still load it as before. The next commit will delete perlwrap.pm and start loading perl files directly from disk at runtime.
  • Property mode set to 100644
File size: 715 bytes
Line 
1use strict;
2use warnings;
3
4package BarnOwl::Style::Legacy;
5
6sub new {
7    my $class = shift;
8    my $func  = shift;
9    my $desc  = shift;
10    my $useglobals = shift;
11    $useglobals = 0 unless defined($useglobals);
12    return bless {function    => $func,
13                  description => $desc,
14                  useglobals  => $useglobals}, $class;
15}
16
17sub description {
18    my $self = shift;
19    return $self->{description} ||
20    ("User-defined perl style that calls " . $self->{function});
21};
22
23sub format_message {
24    my $self = shift;
25    if($self->{useglobals}) {
26        $_[0]->legacy_populate_global();
27    }
28    {
29      package main;
30      no strict 'refs';
31      goto \&{$self->{function}};
32    }
33}
34
35
361;
Note: See TracBrowser for help on using the repository browser.