Some further information...

The error I get is:
Can't locate object method "postorder" via package "Graph::DFS" at
Graph/Base.pm line 1629.

Looking into Base.pm, I find the 'toposort' method that my code calls:
sub toposort {
    my $G = shift;
    my $d = Graph::DFS->new($G);

    reverse $d->postorder; # That's it.
}

This 'toposort' is being called on a Graph::DFS object... so I look into
DFS.pm:
sub new {
    my $class = shift;
    my $graph = shift;

    Graph::Traversal::new( $class,
                           $graph,
                           current =>
                           sub { $_[0]->{ active_list }->[ -1 ] },
                           finish  =>
                           sub { pop @{ $_[0]->{ active_list } } },
                           @_);
}

There is no 'postorder' method in Graph::DFS.  Rather, that method is a
part of Graph::Traversal:
sub postorder {
    my $S = shift;

    1 while defined $S->next_postorder; # Process entire graph.

    return @{ $S->{ postorder_list } };
}

Sooo... the error I'm getting stems from the fact that the method call
is further up the object tree.

Am I doing something wrong?

Clay.


> -----Original Message-----
> From: Clay Harmony
> Sent: Wednesday, February 25, 2004 12:40 PM
> To: [EMAIL PROTECTED]
> Subject: Modules don't get included
> 
> Hello all,
> 
> I am having trouble packaging some scripts.  I find that some modules
> don't get included into the PAR exe.
> 
> Consider the following code:
> [Begin code]
> #!/usr/bin/perl -w
> 
> use strict;
> use Data::Dumper;
> use Graph::Directed;
> require Graph::DFS;
> 
> my @GUIDs = ([1, 2, 3, 4],[2, 3, 4, 5],[1, 3, 4, 5]);
> print Dumper(@GUIDs);
> 
> my $graph = Graph::Directed->new();
> for (0..$#GUIDs) {
>       $graph->add_path(@{$GUIDs[$_]});
> }
> 
> my @GUIDs_ordered = $graph->toposort;
> 
> print Dumper(@GUIDs_ordered);
> 
> [End code]
> 
> When run on its own, it executes fine.  When I package it with pp,
using
> the following command:
> pp -o test.exe test.pl
> 
> ... the resulting executable returns this error when run:
> Can't locate object method "postorder" via package "Graph::DFS" at
> Graph/Base.pm line 1629.
> 
> Then, I tried adding the module, like this:
> pp -M Graph::DFS -o test.exe test.pl
> 
> ... but, the executable returns this error when run:
> Can't locate Graph/DFS.pm in @INC (@INC contains: CODE(0xb9780c)
> CODE(0xc8a5fc) .) at Graph/Base.pm line 1603.
> BEGIN failed--compilation aborted at Graph/Base.pm line 1603.
> Compilation failed in require at Graph/Directed.pm line 6.
> BEGIN failed--compilation aborted at Graph/Directed.pm line 6.
> Compilation failed in require at script/test.pl line 5.
> BEGIN failed--compilation aborted at script/test.pl line 5.
> 
> Examining the contents of the exe, I find that the DFS.pm module is
not
> in there.
> 
> The problem is, Graph::DFS is needed by Graph::Directed, but I don't
> ever call it directly.  I am having the same problems when I use
> XML::Simple... it returns errors with XML::Parser.
> 
> Am I doing something wrong here?  Is there a way around this?
> 
> Thanks for your help,
> Clay.

Reply via email to