summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-06-15 12:19:54 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-06-15 12:19:54 +0000
commitd76dfe7aa74070390030d8ede89e1bf9ba658d0b (patch)
treec115c4296275ff30555623f8a5d92246b711aac4
parent3ba817c693079205e971c4f8277bf72629da4ba5 (diff)
downloadperl-MDK-Common-d76dfe7aa74070390030d8ede89e1bf9ba658d0b.tar
perl-MDK-Common-d76dfe7aa74070390030d8ede89e1bf9ba658d0b.tar.gz
perl-MDK-Common-d76dfe7aa74070390030d8ede89e1bf9ba658d0b.tar.bz2
perl-MDK-Common-d76dfe7aa74070390030d8ede89e1bf9ba658d0b.tar.xz
perl-MDK-Common-d76dfe7aa74070390030d8ede89e1bf9ba658d0b.zip
handle "use base ..."
-rw-r--r--perl_checker.spec1
-rw-r--r--perl_checker.src/tree.ml8
2 files changed, 8 insertions, 1 deletions
diff --git a/perl_checker.spec b/perl_checker.spec
index f12b6a0..9087cb9 100644
--- a/perl_checker.spec
+++ b/perl_checker.spec
@@ -56,6 +56,7 @@ rm -rf $RPM_BUILD_ROOT
# MODIFY IN THE CVS: cvs.mandrakesoft.com:/cooker soft/perl-MDK-Common
%changelog
* Thu Jun 15 2006 Pixel <pixel@mandriva.com> 1.1.25-1mdv2007.0
+- handle "use base ..."
- add a fake packdrake.pm
* Wed Jun 14 2006 Pixel <pixel@mandriva.com> 1.1.24-1mdv2007.0
diff --git a/perl_checker.src/tree.ml b/perl_checker.src/tree.ml
index 47daf14..16fd0e4 100644
--- a/perl_checker.src/tree.ml
+++ b/perl_checker.src/tree.ml
@@ -186,6 +186,9 @@ let get_uses t =
| Use(Ident(None, "lib", _), [libs]) ->
use_lib := List.map Info.file_to_absolute_file (List.map snd (from_qw libs)) @ !use_lib ;
uses
+ | Use(Ident(None, "base", _), classes) ->
+ let l = List.map (fun (pkg, pos) -> (pkg, (None, pos))) (collect from_qw_raw classes) in
+ l @ uses
| Use(Ident(_, _, pos) as pkg, l) ->
let package = string_of_fromparser pkg in
if uses_external_package package then
@@ -203,9 +206,12 @@ let get_uses t =
let get_isa t =
List.fold_left (fun (isa, exporter) e ->
match e with
+ | Use(Ident(None, "base", pos), classes) ->
+ if isa <> None || exporter <> None then die_with_pos pos "\"use base\" and \"@ISA\" must be used once only";
+ Some (collect from_qw_raw classes), None
| List [ Call_op("=", [ Deref(I_array, Ident(None, "ISA", pos)) ; classes ], _) ]
| List [ Call_op("=", [ My_our("our", [ I_array, "ISA" ], pos) ; classes ], _) ] ->
- if isa <> None || exporter <> None then die_with_pos pos "@ISA set twice";
+ if isa <> None || exporter <> None then die_with_pos pos "\"use base\" and \"@ISA\" must be used once only";
let special, l = List.partition (fun (s, _) -> s = "DynaLoader" || s = "Exporter") (from_qw_raw classes) in
let exporter = if List.mem_assoc "Exporter" special then Some pos else None in
let isa = if l = [] && special <> [] then None else Some l in