/usr/share/perl5/ElixirFM/Exec.pm is in libelixirfm-perl 1.1.976-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | # ########################################################################## Otakar Smrz, 2009/03/21
#
# ElixirFM Executable ##############################################################################
# $Id: Exec.pm 946 2010-04-12 19:27:23Z smrz $
package ElixirFM::Exec;
use strict;
our $VERSION = join '.', '1.1', q $Revision: 946 $ =~ /(\d+)/;
use Encode;
use File::Spec;
use File::Temp;
use File::Which;
our $elixir = 'elixir';
our %elixir = ();
sub import {
my $caller = caller 0;
if (@_ > 1 and $_[1] ne '') {
my @path = File::Spec->splitpath($_[1]);
if ($path[0] . $path[1] eq '' and $path[2] ne '.' and $path[2] ne '..') {
if (defined which $_[1]) {
$elixir{$caller} = $_[1];
}
else {
$elixir{$caller} = File::Spec->join($_[1], $elixir);
warn "No program like '$_[1]' or '$elixir{$caller}' can be executed"
unless grep { -x $elixir{$caller} . $_ } '', split ';', $ENV{'PATHEXT'} || '.exe;.com;.bat';
}
}
else {
$elixir{$caller} = -d $_[1] ? File::Spec->join($_[1], $elixir) : $_[1];
warn "No program like '$elixir{$caller}' can be executed"
unless grep { -x $elixir{$caller} . $_ } '', split ';', $ENV{'PATHEXT'} || '.exe;.com;.bat';
}
}
else {
delete $elixir{$caller};
warn "No program like '$elixir' can be executed" unless defined which $elixir;
}
return exists $elixir{$caller} ? $elixir{$caller} : $elixir;
}
sub elixir {
my $mode = defined $_[0] && ! ref $_[0] ? shift : '';
my $opts = defined $_[0] && ref $_[0] eq 'ARRAY' ? shift : [];
my $text = join "", map { $_ =~ /\n$/ ? $_ : $_ . "\n" } @_;
my $code = Encode::is_utf8($text);
my $caller = caller 0;
$caller = caller 1 if $caller eq __PACKAGE__;
my $system = exists $elixir{$caller} ? $elixir{$caller} : $elixir;
my $params = join " ", $mode, map { '"' . $_ . '"' } @{$opts};
my $handle = new File::Temp;
print $handle $code ? encode "utf8", $text : $text;
my $data = scalar `"$system" $params < "$handle"`;
return $code ? decode "utf8", $data : $data;
}
sub main {
return elixir @_;
}
sub resolve {
return elixir 'resolve', @_;
}
sub inflect {
return elixir 'inflect', @_;
}
sub derive {
return elixir 'derive', @_;
}
sub lookup {
return elixir 'lookup', @_;
}
1;
__END__
=head1 NAME
ElixirFM::Exec - Interface to the ElixirFM executable
=head1 REVISION
$Revision: 946 $ $Date: 2010-04-12 21:27:23 +0200 (Mon, 12 Apr 2010) $
=head1 SYNOPSIS
use ElixirFM::Exec; # 'elixir' will be tried out
use ElixirFM::Exec '.'; # './elixir' will be invoked
use ElixirFM::Exec './elixir'; # './elixir' will be invoked
use ElixirFM::Exec 'some/other'; # 'some/other/elixir' unless
# 'some/other' is executable
ElixirFM::Exec::elixir 'help';
import ElixirFM::Exec 'other/elixir'; # switching to 'other/elixir'
ElixirFM::Exec::elixir 'inflect', ['(1320,1)'], "V[PI]---3MS--", "N------P-[IRD]";
ElixirFM::Exec::inflect ['(1320,1)'], "V[PI]---3MS--", "N------P-[IRD]";
=head1 DESCRIPTION
The L<ElixirFM::Exec|ElixirFM::Exec> module provides a simple interface for invoking the
ElixirFM executable, which you need to install on your system yourself.
The download and further information are at L<http://sourceforge.net/projects/elixir-fm/>.
=head1 AUTHOR
Otakar Smrz C<< <otakar smrz mff cuni cz> >>, L<http://ufal.mff.cuni.cz/~smrz/>
=head1 COPYRIGHT & LICENSE
Copyright (C) 2005-2010 Otakar Smrz
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3.
=cut
|