Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #14744
| From | Amine Moulay Ramdane <aminer68@gmail.com> |
|---|---|
| Newsgroups | comp.programming, comp.programming.threads |
| Subject | Perl Win32 MemMap |
| Date | 2022-03-26 02:58 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <t1lvg6$1fov$3@gioia.aioe.org> (permalink) |
| References | <t1lvc9$1fov$1@gioia.aioe.org> |
Cross-posted to 2 groups.
use Win32::MemMap qw(ENABLE_MAPPING DISABLE_MAPPING);
print "\n Using Win32::MemMap version ", $Win32::MemMap::VERSION, "\n";
print " By Amine Moulay Ramdane <aminer\@generation.net>\n";
print " Please hit any key to start the Demo...";
<STDIN>;
my $obj=new Win32::MemMap;
$FileMap=$obj->OpenFile("morocco.gif","//MemMap/test",ENABLE_MAPPING);
print "\n";
$obj->LastError;
$FileMap->Read(\$str,0,$FileMap->{Size});
my $mem=$obj->OpenMem("//MemMap/PerlWin32",$FileMap->{Size});
$mem->Write(\$str,0);
undef $str;
$mem->Read(\$str,0,$FileMap->{Size});
print "\nThis small script will map a file [morocco.gif] to a shared memory,\n";
print "a second process [prog2.pl] will get it directly from the sharedmem and\n";
print "copy the data to a new file named [new.gif], please run now the second script\n";
print "[prog2.pl], and when all is done hit enter to close the sharedmem: ";
<stdin>;
print "\nThe actual shared memory data size is: ".$mem->GetDataSize."\n";
print "The shared memory size is: ".$mem->GetSize."\n";
print "The shared memory name is: ".$mem->GetName."\n";
$obj->LastError;
$mem->Close;
$FileMap->Close;
Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread
Perl Win32 MemMap Amine Moulay Ramdane Amine Moulay Ramdane <aminer68@gmail.com> - 2022-03-26 02:56 +0000 Perl Win32 MemMap Amine Moulay Ramdane <aminer68@gmail.com> - 2022-03-26 02:58 +0000
csiph-web