This module symplifies the DDE link to the great PFE (Programmer's File Editor). It provides all DDE functions mentioned in PFE's DDE help plus some more. It takes care of spawning PFE if it's not already running.
use Win32::Editor::PFE; $pfe = new Win32::Editor::PFE; $pfe->Open('script.pl'); $id = $pfe->Get('WindowID'); $pfe->Pos(23,10); $pfe->EditInsert("<THIS TEXT WAS INSERTED BY A SCRIPT>"); $pfe->WindowActivate($id); $pfe->ComeToForeground(); undef $pfe;
$pfe = new Win32::Editor::PFE; $pfe = new Win32::Editor::PFE (@files_to_open);
This constructor creates a new Win32::Editor::PFE object and connects it to an instance of PFE. If PFE is not running at the moment, this function starts it.
This functions connects the object to an instance of PFE if it's not already connected. This function is called by almost all methods to ensure there is a PFE to send the command to.
Disconnects the object from PFE. You should call this method as soon as posible after virtualy each method call. The thing is that PFE is able to take only one open connection at a time, so if you keep the connection you block out other programs and scripts.
$isConnected = $pfe->Connected()
Checks if the object is connected to an instance of PFE.
$pfe->Open(@list_of_filenames); $pfe->Open(@list_of_filenames, $use_saved_position);
Opens all the files in the list and returns the number of successfuly
opened files. If $use_saved_position=1, PFE tries to open the files using
saved possitions. See
FileOpen() in DDE Commands in PFE's
You do not have to use absolute paths for the filenames, the function takes care of this automaticaly.
$pfe->OpenAt( $filename, $line_number [, $column_number]); $pfe->OpenAt( $filename, $position_specification);
Opens a file and possitions the cursor on a particular line and column.
See the PFE's help for file position specifications.
This function is exactly as described in PFE's help, except the fact that it converts relative paths to absolute.
$value = $pfe->Get("property name");
You may get the value of all data items mentioned in PFE's help, ``DDE Data Items'' topic.
$line_number = $pfe->Pos(); ($line_number, $column_number) = $pfe->Pos(); $pfe->Pos( $line_number); $pfe->Pos( $line_number, $column_number); $pfe->Pos( $position_specification);
Using this function you may get the current position in the active window and/or change it. If you change the position, the function returns the original position.
This function sends the specified command to PFE. You may either enter the command directly as is (``[FileNew()]'', ``[CaretDown(3,1)]'', ``[FileOpen(''c:\autoexec.bat``)]'', etc.) or specify the function name and the parameters. The functions takes care of the quoting, I hope it does it right.
You should not have to use this function, use the AUTOLOADing feature instead and write
$pfe->CaretDown(3,1); instead of $pfe->Execute('CaretDown','3','1');
Gives you the result of the last command executed over the DDE link. The reply will be one of the strings ``OK'' or ``Error'' if a result is available, and ``Busy'' if the server is currently processing a DDE link command. The results of commands executed from the keyboard, menu or toolbar cannot be read by this method.