########################################## #Perl file myDebugger.pm ########################################## package myDebugger; use strict; use warnings; use Win32::OLE; use Win32::OLE::Const "Microsoft Excel"; use Win32::OLE qw(in with); use Win32::OLE::Variant; use vars qw($VERSION $HEADER @ISA @EXPORT); use Exporter; $VERSION = q$Revision: 1.1 $; $HEADER = q$Header: Some CMS data... $; @ISA = qw(Exporter); @EXPORT = qw( GetInstance ); # export subs my $debugger = undef; sub GetInstance { if ( defined $debugger ) { return $debugger; } else { DebuggerInit(); defined $debugger ? return $debugger : print " Init error!"; return 0; } } sub DebuggerInit { # Instead of an Debugger, I use here the Excel-Application. # Both excel and the debugger application are interfaced by OLE # Thus I think its a good replacement as an example. # Also the way how the OLE Application is the same # as the originally used UDE PLS Debugger. $debugger = Win32::OLE->GetActiveObject('Excel.Application'); unless ($debugger) { $debugger = new Win32::OLE( 'Excel.Application', \&main::QuitApp ); } } sub main::QuitApp { exit(); } 1;