First of all, install Powerbuilder::ORCA (see annexes for all mentioned files)

Method 1: From sources.

Download and unpack the file PowerBuilder-ORCA-0.06.tar.gz file in your working directory, then

perl Makefile.pl & nmake & nmake install

Method 2: From binaries (active perl 5.8.8).

Download the files PowerBuilder-ORCA-0.06-PPM.tar.gz and PowerBuilder-ORCA-0.06.ppd, then

ppm install PowerBuilder-ORCA-0.06.ppd

At first, I have back ported the SeKi's Pbniregex project to pb10.5.

Here is a script which will output objects refenrences in a graphviz format:

#!/usr/perl
#usage: references-dep.pl  pborcaXXX.dll full-project-path project-file-name.pbt
use PowerBuilder::ORCA qw/:const/;
my ($dll, $cwd, $pbt) = @ARGV;
PowerBuilder::ORCA::LoadDll($dll);
print STDERR "Using ORCA DLL: $PowerBuilder::ORCA::ORCA_Dll \n";

my ($appName, $appLib);
my @libList;
open( PROJECT, $cwd.$pbt ) or die("Couldn't open PROJECT (${cwd}${pbt}) for reading.\n\n");
while(<PROJECT>){
  if($_=~/^appname "([^"]+)";$/gi){ $appName = $1; }
  if($_=~/applib "([^"]+)";$/gi){ $appLib = $1; }
  if($_=~/LibList "([^"]+)";$/gi){ @libList = split(/;/,$1); }
}
close PROJECT;

# concat to each lib the PATH $cwd !!!
for my $lib ( @libList ){ $lib = $cwd.$lib; }

my $ses=new PowerBuilder::ORCA(\@libList , $cwd.$appLib, $appName);
my %refMap;
$|++;  #Autoflush output
for $lib ( @libList ){
  my @objects;
  $ses->LibDir( $lib, \@objects);
  { $| = 1, print STDERR $lib . "\n"; }
  for $obj (@objects ){
    #~ print "\t$obj->{Type} : '$obj->{Name}'\n";
    my @references;
    $rc = $ses->ObjectQueryReference($lib,$obj->{Name},$obj->{Type},\@references);
    push( @{$refMap{$obj->{Name}}}, @references ) unless $rc;
  }
}

my $reflinks = "";
my $edgeop = "--";
print "\n";
for $key ( keys %refMap ){
  $reflinks .= "\t\"$key\" \n";  
  for $ref (@{$refMap{$key}}){
    $reflinks .= "\t\t\"$key\"$edgeop \"$ref->{Name}\";\n";
  }
}

print <<"HEADER" ;
/* (c) GeNi Powerbuilder Project analyser */
graph unix {  
  $reflinks
}
HEADER
$ses->Close();

Run this script with something like : perl references-dep.pl pborc105.dll "c:\developpement\perl\PowerBuilder-ORCA-0.05\samples\orca\PbniRegex105\\" regexdemo105.pbt > pbniregex_references.txt

And it should produce a file pbniregex_references.txt containg:

/* (c) GeNi Powerbuilder Project analyser */
graph unix {  
  	"nv_auto_resizer" 
		"nv_auto_resizer" -- "debug_message";
		"nv_auto_resizer" -- "hasmethod";
	"w_test" 
		"w_test" -- "w_anc_response";
		"w_test" -- "nv_auto_resizer";
		"w_test" -- "u_splitbar_vertical";
		"w_test" -- "u_splitbar_horizontal";
		"w_test" -- "uo_regex";
		"w_test" -- "hasmethod";
		"w_test" -- "fastreplaceall";
		"w_test" -- "m_main";
		"w_test" -- "w_unit_tests";
		"w_test" -- "fastreplaceall2";
		"w_test" -- "unvo_regexp";
		"w_test" -- "replaceall";
	"fastreplaceall" 
		"fastreplaceall" -- "syncparm";
	"u_splitbar_vertical" 
		"u_splitbar_vertical" -- "nv_auto_resizer";
	"replaceall" 
	"w_minihelp" 
	"hasmethod" 
	"w_unit_tests" 
		"w_unit_tests" -- "w_anc_response";
		"w_unit_tests" -- "nv_auto_resizer";
		"w_unit_tests" -- "uo_regex";
		"w_unit_tests" -- "iif";
		"w_unit_tests" -- "dw_unittests";
	"regexdemo105" 
		"regexdemo105" -- "w_test";
	"unvo_regexp" 
	"debug_message" 
	"w_anc_response" 
		"w_anc_response" -- "nv_auto_resizer";
	"m_main" 
		"m_main" -- "w_test";
		"m_main" -- "w_minihelp";
	"u_splitbar_horizontal" 
		"u_splitbar_horizontal" -- "nv_auto_resizer";
	"fastreplaceall2" 
		"fastreplaceall2" -- "syncparm";
	"uo_regex" 
		"uo_regex" -- "syncparm";
	"iif" 

}

We could transform this into a graph (require graphviz) dot -Tpng -orxrefsdot.png pbniregex_references.txt

pbniregex refs dot

Another script for retrieving objects hierarchy.

#!/usr/perl
#usage: ancestors-dep.pl  pborcaXXX.dll full-project-path project-file-name.pbt
use PowerBuilder::ORCA qw/:const/;
my ($dll, $cwd, $pbt) = @ARGV;

PowerBuilder::ORCA::LoadDll($dll);
print STDERR "Using ORCA DLL: $PowerBuilder::ORCA::ORCA_Dll \n";

my ($appName, $appLib);
my @libList;
open( PROJECT, $cwd.$pbt ) or die("Couldn't open PROJECT(${cwd}${pbt}) for reading.\n\n");
while(<PROJECT>){
  if($_=~/^appname "([^"]+)";$/gi){ $appName = $1; }
  if($_=~/applib "([^"]+)";$/gi){ $appLib = $1; }
  if($_=~/LibList "([^"]+)";$/gi){ @libList = split(/;/,$1); }
}
close PROJECT;
# concat to each lib the PATH $cwd !!!
for my $lib ( @libList ){ $lib = $cwd.$lib; }

my $ses=new PowerBuilder::ORCA(\@libList , $cwd.$appLib, $appName);
my %refMap;
for $lib ( @libList ){
  my @objects;
  $ses->LibDir( $lib, \@objects);
  { $| = 1, print STDERR $lib . "\n"; }
  for $obj (@objects ){
    my @references;
    $rc = $ses->ObjectQueryHierarchy($lib,$obj->{Name},$obj->{Type},\@references);    
    push( @{$refMap{$obj->{Name}}}, @references ) unless $rc;
  }
}

my $reflinks = "";
my $edgeop = "--";
print "\n";
for $key ( keys %refMap ){
  $reflinks .= "\t\"$key\"";
  for $ref (@{$refMap{$key}}){
    $reflinks.=" $edgeop \"$ref\""; 
  }
  $reflinks .= ";\n";
}

print <<"HEADER" ;
/* (c) GeNi Powerbuilder Project analyser */
graph unix {  
$reflinks
}
HEADER

$ses->Close();

print STDERR "\nend of scan...\n";

So, test with something like perl ancestors-dep.pl pborc105.dll "c:\developpement\perl\PowerBuilder-ORCA-0.05\samples\orca\PbniRegex105\\" regexdemo105.pbt > rxanc.txt

And it may produce this file:

/* (c) GeNi Powerbuilder Project analyser */
graph unix {
        "w_test" -- "w_anc_response";
        "w_unit_tests" -- "w_anc_response";

}

We could transform it too into a graph dot -Tpng -orxrefsanc.png rxanc.txt

pbniregex ancs dot

That's all for tonight ;)