summaryrefslogtreecommitdiff
path: root/xpp/perl_modules/Dahdi.pm
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-03-02 18:07:37 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-03-02 18:07:37 +0000
commitee0e06c99e2cf44c23984e84b592ff82af68b19b (patch)
treee3c8fc7310253671fcc7d1b77a4b308013da72dd /xpp/perl_modules/Dahdi.pm
parentff09b1ff474333d8f7e51a8f4ef84a2f9cd9e395 (diff)
DAHDI-perl: allow setting base of system files with DAHDI_VIRT_TOP
If the user set DAHDI_VIRT_TOP in the environment, consider it as a path under which to look for ProcFS and SysFS files. This allows running the DAHDI-perl tools on filesystem dumps generated by build_tools/dump_sys_state . To reduce the number of dependencies between various modules, the 'xpd' member of a Dahdi::Span is removed. Dahdi::Xpp::xpd_of_span() can be used if needed. git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@8215 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp/perl_modules/Dahdi.pm')
-rw-r--r--xpp/perl_modules/Dahdi.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/xpp/perl_modules/Dahdi.pm b/xpp/perl_modules/Dahdi.pm
index fa5955a..e17b939 100644
--- a/xpp/perl_modules/Dahdi.pm
+++ b/xpp/perl_modules/Dahdi.pm
@@ -32,7 +32,11 @@ hardware and loaded Dahdi devices.
}
=cut
-my $proc_base = "/proc/dahdi";
+our $virt_base;
+our $proc_dahdi_base;
+our $proc_xpp_base;
+our $proc_usb_base;
+our $sys_base;
=head1 spans()
@@ -43,10 +47,9 @@ Returns a list of span objects, ordered by span number.
sub spans() {
my @spans;
- -d $proc_base or return ();
- foreach my $zfile (glob "$proc_base/*") {
- $zfile =~ s:$proc_base/::;
- next unless ($zfile =~ /^\d+$/);
+ -d $proc_dahdi_base or return ();
+ foreach my $zfile (glob "$proc_dahdi_base/*") {
+ next unless ($zfile =~ m{^$proc_dahdi_base/\d+$});
my $span = Dahdi::Span->new($zfile);
push(@spans, $span);
}
@@ -54,6 +57,13 @@ sub spans() {
return @spans;
}
+=head1 ENVIRONMENT
+
+If C<DAHDI_VIRT_TOP> is set in the environment, it will be considered
+as a path to a directory that holds a dump (copy) of all the required
+files from /proc and /sys . You can generate that directory using the
+script C<build_tools/dump_sys_state> .
+
=head1 SEE ALSO
Span objects: L<Dahdi::Span>.