]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Shm.pl
- added weather from Nathan Moschkin <logeist@guinerd.myip.org>. Thanks!
[infobot.git] / src / Shm.pl
index 6a29ff4b6aa85f0f1e12159d2bea4d8c8bce13a6..34b68f2f1e7d1d3314f330cb4809fd15c835f97e 100644 (file)
@@ -12,6 +12,11 @@ sub openSHM {
     my $IPC_PRIVATE = 0;
     my $size = 2000;
 
+    if (&IsParam("noSHM")) {
+       &status("Created shared memory: disabled. [bot may become  unreliable]");
+       return 0;
+    }
+
     if (defined( $_ = shmget($IPC_PRIVATE, $size, 0777) )) {
        &status("Created shared memory (shm) key: [$_]");
        return $_;
@@ -39,6 +44,8 @@ sub shmRead {
     my $size = 3*80;
     my $retval = '';
 
+    return '' if (&IsParam("noSHM"));
+
     if (shmread($key,$retval,$position,$size)) {
        return $retval;
     } else {
@@ -54,6 +61,8 @@ sub shmWrite {
     my $position = 0;
     my $size = 80*3;
 
+    return if (&IsParam("noSHM"));
+
     # NULL hack.
     ### TODO: create shmClear to deal with this.
     if ($str !~ /^$/) {