If you are looking for a way to "mimic" a PVEH on the same machine where the publicVariable command was executed, it is a little more work, but here is one way to do it. The script and variable names are just for the example. You can use anything. Please excuse any typos.
First initialize your PV and add the PVEH. The PVEH will send the name of the variable and its value to a script called event.sqf that will execute any code we want run when the PVEH fires:
// init.sqf
// Set the initial value of the PV only if it is nil in order to not override a JIP update or other updated value assignment.
if {!isNil "myPublicVariable"} then {myPublicVariable = false;};
// Create a PVEH that will send the name of the variable and its value to event.sqf whenever the value of the PV changes.
"myPublicVariable" addPublicVariableEventHandler {[(_this select 0), (_this select 1)] execVM "event.sqf"};
Next for example, create a script that uses the publicVariable command. Here I am calling it monitor.sqf, it doesn't matter where/how you send the PV. This script sets the PV to true (initial false) and then broadcasts the PV. However, it also "mimics" a PVEH by also sending the name and value of the variable to event.sqf
// monitor.sqf
// Wait until something happens...
waitUntil{...};
// Set the PV to true and broadcast it to all other machines.
myPublicVariable = true;
publicVariable "myPublicVariable";
// Send the name of variable and its value to event.sqf directly on this machine since the PVEH won't fire on the same machine that broadcasts it.
_nul = ["myPublicVariable", true] execVM "event.sqf"
Finally here is event.sqf that runs some sample code (just a simple hint here but shows how the variable
// event.sqf
// Scope //
private ["_var", "_val"];
// Parameter(s) //
_var = (_this select 0); // Name of public variable that has changed value (string).
_val = (_this select 1); // The current value of the public variable after being changed (any).
hint format [ "The PV %1 is %2!", _var, _val]; // Output: The PV "myPublicVariable" is true!.