Changeset 2650a10 for perlwrap.pm
- Timestamp:
- Apr 29, 2008, 1:21:17 AM (17 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:
- 811ad93
- Parents:
- 52f8dd6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perlwrap.pm
rb67ab6b r2650a10 685 685 # Internal startup/shutdown routines called by the C code 686 686 687 sub _load_perl_commands { 688 # Load builtin perl commands 689 BarnOwl::new_command(style => \&BarnOwl::Style::style_command, 690 { 691 summary => "creates a new style", 692 usage => "style <name> perl <function_name>", 693 description => 694 "A style named <name> will be created that will\n" . 695 "format messages using the perl function <function_name>.\n\n" . 696 "SEE ALSO: show styles, view -s, filter -s\n\n" . 697 "DEPRECATED in favor of BarnOwl::create_style(NAME, OBJECT)", 698 }); 699 } 700 687 701 sub _load_owlconf { 688 702 # load the config file … … 710 724 711 725 sub _startup { 726 _load_perl_commands(); 712 727 _load_owlconf(); 713 728 … … 991 1006 } 992 1007 1008 sub style_command { 1009 my $command = shift; 1010 if(scalar @_ != 3 || $_[1] ne 'perl') { 1011 die("Usage: style <name> perl <function>\n"); 1012 } 1013 my $name = shift; 1014 my $perl = shift; 1015 my $fn = shift; 1016 { 1017 no strict 'refs'; 1018 unless(*{$fn}{CODE}) { 1019 die("Unable to create style '$name': no perl function '$fn'\n"); 1020 } 1021 } 1022 BarnOwl::create_style($name, BarnOwl::Style::Legacy->new($fn)); 1023 } 1024 993 1025 package BarnOwl::Style::Legacy; 994 1026 … … 1004 1036 } 1005 1037 1006 sub description {shift->{description}}; 1038 sub description { 1039 my $self = shift; 1040 return $self->{description} || 1041 ("User-defined perl style that calls " . $self->{function}); 1042 }; 1007 1043 1008 1044 sub format_message {
Note: See TracChangeset
for help on using the changeset viewer.