Changeset b67ab6b for perlwrap.pm
- Timestamp:
- Apr 29, 2008, 1:21:15 AM (16 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 52f8dd6
- Parents:
- 864ed35
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perlwrap.pm
r864ed35 rb67ab6b 153 153 } 154 154 $configfile ||= $ENV{HOME}."/.owlconf"; 155 156 # populate global variable space for legacy owlconf files157 sub _format_msg_legacy_wrap {158 my ($m) = @_;159 $m->legacy_populate_global();160 return &BarnOwl::format_msg($m);161 }162 155 163 156 # populate global variable space for legacy owlconf files … … 702 695 if(*BarnOwl::format_msg{CODE}) { 703 696 # if the config defines a legacy formatting function, add 'perl' as a style 704 # BarnOwl::_create_style("perl", "BarnOwl::_format_msg_legacy_wrap", 705 # "User-defined perl style that calls BarnOwl::format_msg" 706 # . " with legacy global variable support"); 707 # BarnOwl::set("-q default_style perl"); 697 BarnOwl::create_style("perl", BarnOwl::Style::Legacy->new( 698 "BarnOwl::format_msg", 699 "User-defined perl style that calls BarnOwl::format_msg" 700 . " with legacy global variable support", 701 1)); 702 BarnOwl::set("-q default_style perl"); 708 703 } 709 704 } … … 779 774 sub description {"Default style";} 780 775 781 BarnOwl:: _create_style("default", "BarnOwl::Style::Default");776 BarnOwl::create_style("default", "BarnOwl::Style::Default"); 782 777 783 778 ################################################################################ … … 869 864 sub description {"Compatability alias for the default style";} 870 865 871 BarnOwl:: _create_style("basic", "BarnOwl::Style::Basic");866 BarnOwl::create_style("basic", "BarnOwl::Style::Basic"); 872 867 873 868 package BarnOwl::Style::OneLine; … … 896 891 sub description {"Formats for one-line-per-message"} 897 892 898 BarnOwl:: _create_style("oneline", "BarnOwl::Style::OneLine");893 BarnOwl::create_style("oneline", "BarnOwl::Style::OneLine"); 899 894 900 895 ################################################################################ … … 996 991 } 997 992 993 package BarnOwl::Style::Legacy; 994 995 sub new { 996 my $class = shift; 997 my $func = shift; 998 my $desc = shift; 999 my $useglobals = shift; 1000 $useglobals = 0 unless defined($useglobals); 1001 return bless {function => $func, 1002 description => $desc, 1003 useglobals => $useglobals}, $class; 1004 } 1005 1006 sub description {shift->{description}}; 1007 1008 sub format_message { 1009 my $self = shift; 1010 if($self->{useglobals}) { 1011 $_[0]->legacy_populate_global(); 1012 } 1013 no strict 'refs'; 1014 goto \&{$self->{function}}; 1015 } 1016 998 1017 999 1018 # switch to package main when we're done
Note: See TracChangeset
for help on using the changeset viewer.