/usr/share/perl5/Dahdi/Utils.pm is in dahdi 1:2.7.0-1ubuntu1.
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 | package Dahdi::Utils;
# Accessors (miniperl does not have Class:Accessor)
our $AUTOLOAD;
sub AUTOLOAD {
my $self = shift;
my $name = $AUTOLOAD;
$name =~ s/.*://; # strip fully-qualified portion
return if $name =~ /^[A-Z_]+$/; # ignore special methods (DESTROY)
my $key = uc($name);
my $val = shift;
if (defined $val) {
#print STDERR "set: $key = $val\n";
return $self->{$key} = $val;
} else {
if(!exists $self->{$key}) {
#$self->xpp_dump;
#die "Trying to get uninitialized '$key'";
}
my $val = $self->{$key};
#print STDERR "get: $key ($val)\n";
return $val;
}
}
# Initialize ProcFS and SysFS pathes, in case the user set
# DAHDI_VIRT_TOP
BEGIN {
if (exists $ENV{DAHDI_VIRT_TOP}) {
$Dahdi::virt_base = $ENV{DAHDI_VIRT_TOP};
} else {
$Dahdi::virt_base = '';
}
$Dahdi::proc_dahdi_base = "$Dahdi::virt_base/proc/dahdi";
$Dahdi::proc_usb_base = "$Dahdi::virt_base/proc/bus/usb";
$Dahdi::sys_base = "$Dahdi::virt_base/sys";
}
sub xpp_dump($) {
my $self = shift || die;
printf STDERR "Dump a %s\n", ref($self);
foreach my $k (sort keys %{$self}) {
my $val = $self->{$k};
$val = '**UNDEF**' if !defined $val;
printf STDERR " %-20s %s\n", $k, $val;
}
}
# Based on Autoloader
sub import {
my $pkg = shift;
my $callpkg = caller;
#print STDERR "import: $pkg, $callpkg\n";
#
# Export symbols, but not by accident of inheritance.
#
die "Sombody inherited Dahdi::Utils" if $pkg ne 'Dahdi::Utils';
no strict 'refs';
*{ $callpkg . '::AUTOLOAD' } = \&AUTOLOAD;
*{ $callpkg . '::xpp_dump' } = \&xpp_dump;
}
1;
|