Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Win32::Mutex;
- my ($name) = ( $0 =~ /(.*)\.pl/ );
- $name =~ s/^(.*\\)//; # erase full path names, they give problems creating mutexes
- ($name) = ( $^X =~ /(.*)\.exe/ ) if ( $name eq '' ); # Compatibility for perl2exe
- my $mutex;
- Win32::Mutex::Create( $mutex, 0, $name );
- if (Win32::GetLastError) {
- # mutex already exists - another instance of this script is running
- exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement