/usr/share/perl5/Tangram/Compat.pm is in libtangram-perl 2.10-2.
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 184 185 186 187 | # package for compatilibity with older Tangram APIs.
# first major change: Tangram::Scalar => Tangram::Type::Scalar, etc
package Tangram::Compat;
use Set::Object qw(refaddr set);
use Tangram::Compat::Stub;
use constant REMAPPED =>
qw( Tangram::Scalar Tangram::Type::Scalar
Tangram::String Tangram::Type::String
Tangram::Integer Tangram::Type::Integer
Tangram::Real Tangram::Type::Real
Tangram::Number Tangram::Type::Number
Tangram::RawTime Tangram::Type::Time
Tangram::RawDate Tangram::Type::Date
Tangram::RawDateTime Tangram::Type::TimeAndDate
Tangram::CookedDateTime Tangram::Type::Date::Cooked
Tangram::DMDateTime Tangram::Type::Date::Manip
Tangram::TimePiece Tangram::Type::Date::TimePiece
Tangram::DateTime Tangram::Type::Date::DateTime
Tangram::Coll Tangram::Type::Abstract::Coll
Tangram::AbstractSet Tangram::Type::Abstract::Set
Tangram::AbstractHash Tangram::Type::Abstract::Hash
Tangram::AbstractArray Tangram::Type::Abstract::Array
Tangram::Set Tangram::Type::Set::FromMany
Tangram::Hash Tangram::Type::Hash::FromMany
Tangram::Array Tangram::Type::Array::FromMany
Tangram::Ref Tangram::Type::Ref::FromMany
Tangram::IntrSet Tangram::Type::Set::FromOne
Tangram::IntrHash Tangram::Type::Hash::FromOne
Tangram::IntrArray Tangram::Type::Array::FromOne
Tangram::IntrRef Tangram::Type::Ref::FromOne
Tangram::BackRef Tangram::Type::BackRef
Tangram::FlatHash Tangram::Type::Hash::Scalar
Tangram::FlatArray Tangram::Type::Array::Scalar
Tangram::Alias Tangram::Expr::TableAlias
Tangram::CollCursor Tangram::Cursor::Coll
Tangram::Dump Tangram::Type::Dump
Tangram::IDBIF Tangram::Type::Dump::Any
Tangram::PerlDump Tangram::Type::Dump::Perl
Tangram::Storable Tangram::Type::Dump::Storable
Tangram::YAML Tangram::Type::Dump::YAML
Tangram::Filter Tangram::Expr::Filter
Tangram::CursorObject Tangram::Expr::CursorObject
Tangram::QueryObject Tangram::Expr::QueryObject
Tangram::RDBObject Tangram::Expr::RDBObject
Tangram::Select Tangram::Expr::Select
Tangram::Table Tangram::Expr::Table
Tangram::Oracle Tangram::Driver::Oracle
Tangram::mysql Tangram::Driver::mysql
Tangram::Pg Tangram::Driver::Pg
Tangram::SQLite Tangram::Driver::SQLite
Tangram::SQLite2 Tangram::Driver::SQLite2
Tangram::Sybase Tangram::Driver::Sybase
);
use strict 'vars', 'subs';
use Carp qw(cluck confess croak carp);
sub DEBUG() { 0 }
sub debug_out { print STDERR __PACKAGE__.": @_\n" }
our $stub;
BEGIN { $stub = $INC{'Tangram/Compat/Stub.pm'} };
# this method is called when you "use" something. This is a "Chain of
# Command Patte<ETOOMUCHBS>
our $PKG_NOWARN = set();
sub quiet {
my $pkg = shift;
#print SDTERR "$pkg is quiet\n";
$PKG_NOWARN->insert($pkg);
}
sub Tangram::Compat::INC {
my $self = shift;
my $fn = shift;
(my $pkg = $fn) =~ s{/}{::}g;
$pkg =~ s{.pm$}{};
(DEBUG) && debug_out "saw include for $pkg";
if (exists $self->{map}->{$pkg}) {
$self->setup($pkg);
open DEVNULL, "<$stub" or die $!;
return \*DEVNULL;
}
else {
return undef;
}
}
sub setup {
debug_out("setup(@_)") if (DEBUG);
my $self = shift;
my $pkg = shift or confess ("no pkg!");
undef &{"${pkg}::AUTOLOAD"};
my $target = $self->{map}{$pkg} or return;
my @c = caller();
my $n;
while ( $c[0] and $c[0] =~ m/^(Tangram::Compat|base)/ ) {
@c = caller(++$n);
}
@c = caller($n-1) unless @c;
carp("deprecated package $pkg used by $c[0] ($c[1]:$c[2]); "
."auto-loading $target")
if $^W and !$PKG_NOWARN->includes($c[0]);
debug_out("using $target") if (DEBUG);
#kill 2, $$;
eval "use $target";
#kill 2, $$;
debug_out("using $target yielded \$\@ = '$@'") if DEBUG;
die $@ if $@;
@{"${pkg}::ISA"} = $target;
#debug_out("creating package yielded \$\@ = '$@'") if DEBUG;
if ( @_ ) {
my $method = shift;
($pkg, $method) = $method =~ m{(.*)::(.*)};
@_ = @{(shift)};
my $code = $pkg->can($method)
or do {
debug_out("pkg is $pkg, its ISA is ".join(",",@{"${pkg}::ISA"})) if (DEBUG);
croak "$pkg->can't($method)";
};
debug_out("Calling $pkg->$method(@_)") if DEBUG;
goto $code;
}
}
our $AUTOLOAD;
sub new {
my $inv = shift;
my $self = bless { map => { @_ },
}, (ref $inv||$inv);
for my $pkg ( keys %{$self->{map}} ) {
debug_out "setting up $pkg => $self->{map}{$pkg}" if DEBUG;
*{"${pkg}::AUTOLOAD"} = sub {
return if $AUTOLOAD =~ /::DESTROY$/;
debug_out "pkg is $pkg, AUTOLOAD is $AUTOLOAD" if DEBUG;
my $stack = [ @_ ];
@_ = ($self, $pkg, $AUTOLOAD, $stack);
goto &setup;
};
}
return $self;
}
sub DESTROY {
my $self = shift;
@INC = grep { defined and
(!ref($_) or refaddr($_) ne refaddr($self)) }
@INC;
}
#use Devel::Symdump;
BEGIN {
my $loader = __PACKAGE__->new(REMAPPED);
#unshift @INC, __PACKAGE__->new( REMAPPED );
#print STDERR "INC is now: @INC\n";
#my $sd = Devel::Symdump->new("Tangram::Compat");
#print STDERR "Compat is: ".$sd->as_string;
unshift @INC, $loader;
}
1;
|