r28992 - in /branches/upstream/libsys-gamin-perl: ./ current/ current/lib/ current/lib/Sys/ current/t/

ceros-guest at users.alioth.debian.org ceros-guest at users.alioth.debian.org
Thu Jan 1 06:31:06 UTC 2009


Author: ceros-guest
Date: Thu Jan  1 06:30:55 2009
New Revision: 28992

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=28992
Log:
[svn-inject] Installing original source of libsys-gamin-perl

Added:
    branches/upstream/libsys-gamin-perl/
    branches/upstream/libsys-gamin-perl/current/
    branches/upstream/libsys-gamin-perl/current/CHANGES
    branches/upstream/libsys-gamin-perl/current/Gamin.xs
    branches/upstream/libsys-gamin-perl/current/MANIFEST
    branches/upstream/libsys-gamin-perl/current/MANIFEST.SKIP
    branches/upstream/libsys-gamin-perl/current/META.yml
    branches/upstream/libsys-gamin-perl/current/Makefile.PL   (with props)
    branches/upstream/libsys-gamin-perl/current/README
    branches/upstream/libsys-gamin-perl/current/TODO
    branches/upstream/libsys-gamin-perl/current/lib/
    branches/upstream/libsys-gamin-perl/current/lib/Sys/
    branches/upstream/libsys-gamin-perl/current/lib/Sys/Gamin.pm
    branches/upstream/libsys-gamin-perl/current/monitor   (with props)
    branches/upstream/libsys-gamin-perl/current/t/
    branches/upstream/libsys-gamin-perl/current/t/gamin.t
    branches/upstream/libsys-gamin-perl/current/typemap

Added: branches/upstream/libsys-gamin-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/CHANGES?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/CHANGES (added)
+++ branches/upstream/libsys-gamin-perl/current/CHANGES Thu Jan  1 06:30:55 2009
@@ -1,0 +1,5 @@
+2005-05-04  Carlos Garnacho Parro
+
+	* Taken SGI::FAM perl module, fixed some bugs and adapted it to use 
+	Gamin
+

Added: branches/upstream/libsys-gamin-perl/current/Gamin.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/Gamin.xs?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/Gamin.xs (added)
+++ branches/upstream/libsys-gamin-perl/current/Gamin.xs Thu Jan  1 06:30:55 2009
@@ -1,0 +1,358 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#ifdef __cplusplus
+}
+#endif
+
+#include <fam.h>
+#include <string.h>
+#include <errno.h>
+
+static int
+constant(name)
+char *name;
+{
+    errno = 0;
+    switch (*name) {
+    case 'A':
+	break;
+    case 'B':
+	break;
+    case 'C':
+	break;
+    case 'D':
+	break;
+    case 'E':
+	break;
+    case 'F':
+	if (strEQ(name, "FAM_DEBUG_OFF"))
+#ifdef FAM_DEBUG_OFF
+	    return FAM_DEBUG_OFF;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "FAM_DEBUG_ON"))
+#ifdef FAM_DEBUG_ON
+	    return FAM_DEBUG_ON;
+#else
+	    goto not_there;
+#endif
+	if (strEQ(name, "FAM_DEBUG_VERBOSE"))
+#ifdef FAM_DEBUG_VERBOSE
+	    return FAM_DEBUG_VERBOSE;
+#else
+	    goto not_there;
+#endif
+	    /* enum FAMCodes--added by hand */
+        if (strEQ(name, "FAMChanged")) {
+          return FAMChanged;
+        } else if (strEQ(name, "FAMDeleted")) {
+          return FAMDeleted;
+        } else if (strEQ(name, "FAMStartExecuting")) {
+          return FAMStartExecuting;
+        } else if (strEQ(name, "FAMStopExecuting")) {
+          return FAMStopExecuting;
+        } else if (strEQ(name, "FAMCreated")) {
+          return FAMCreated;
+        } else if (strEQ(name, "FAMMoved")) {
+          return FAMMoved;
+        } else if (strEQ(name, "FAMAcknowledge")) {
+          return FAMAcknowledge;
+        } else if (strEQ(name, "FAMExists")) {
+          return FAMExists;
+        } else if (strEQ(name, "FAMEndExist")) {
+	  return FAMEndExist;
+        }
+	break;
+    case 'G':
+	break;
+    case 'H':
+	break;
+    case 'I':
+	break;
+    case 'J':
+	break;
+    case 'K':
+	break;
+    case 'L':
+	break;
+    case 'M':
+	break;
+    case 'N':
+	break;
+    case 'O':
+	break;
+    case 'P':
+	break;
+    case 'Q':
+	break;
+    case 'R':
+	break;
+    case 'S':
+	break;
+    case 'T':
+	break;
+    case 'U':
+	break;
+    case 'V':
+	break;
+    case 'W':
+	break;
+    case 'X':
+	break;
+    case 'Y':
+	break;
+    case 'Z':
+	break;
+    case '_':
+	break;
+    }
+    errno = EINVAL;
+    return 0;
+
+not_there:
+    errno = ENOENT;
+    return 0;
+}
+
+static char *famerror() {
+  return FAMErrno ? (char *) FamErrlist[FAMErrno] : "";
+}
+
+static void famwarn(code, what)
+int code;
+char *what;
+{
+  if (code==-1)
+    warn("Sys::Gamin: %s: %s", what,
+	 FAMErrno ? FamErrlist[FAMErrno] :
+	 errno ? strerror(errno) :
+	 "(unidentified)");
+}
+
+
+MODULE = Sys::Gamin		PACKAGE = Sys::Gamin
+
+PROTOTYPES: ENABLE
+
+int
+constant(name)
+	char *		name
+
+char *
+famerror()
+
+
+MODULE = Sys::Gamin		PACKAGE = FAMConnectionPtr		PREFIX = FAM
+
+PROTOTYPES: ENABLE
+
+# int
+# FAMOpen(fc)
+# 	FAMConnection *	fc
+
+int
+FAMOpen2(fc, appName)
+	FAMConnection *	fc
+	char *	appName
+
+int
+FAMClose(fc)
+	FAMConnection *	fc
+
+# int
+# FAMMonitorDirectory(fc, filename, fr, userData)
+# 	FAMConnection *	fc
+# 	char *	filename
+# 	FAMRequest *	fr
+# 	void *	userData
+# 
+# int
+# FAMMonitorFile(fc, filename, fr, userData)
+# 	FAMConnection *	fc
+# 	char *	filename
+# 	FAMRequest *	fr
+# 	void *	userData
+
+int
+FAMMonitorCollection(fc, filename, fr, userData, depth, mask)
+	FAMConnection *	fc
+	char *	filename
+	FAMRequest *	fr
+	void *	userData
+	int	depth
+	char *	mask
+
+int
+FAMMonitorDirectory2(fc, filename, fr)
+	FAMConnection *	fc
+	char *	filename
+	FAMRequest *	fr
+
+int
+FAMMonitorFile2(fc, filename, fr)
+	FAMConnection *	fc
+	char *	filename
+	FAMRequest *	fr
+
+int
+FAMSuspendMonitor(fc, fr)
+	FAMConnection *	fc
+	FAMRequest *	fr
+
+int
+FAMResumeMonitor(fc, fr)
+	FAMConnection *	fc
+	FAMRequest *	fr
+
+int
+FAMCancelMonitor(fc, fr)
+	FAMConnection *	fc
+	FAMRequest *	fr
+
+int
+FAMNextEvent(fc, fe)
+	FAMConnection *	fc
+	FAMEvent *	fe
+
+int
+FAMPending(fc)
+	FAMConnection *	fc
+
+MODULE = Sys::Gamin		PACKAGE = FAMConnectionPtr		PREFIX = fc_
+
+PROTOTYPES: ENABLE
+
+void
+fc_DESTROY(fc)
+ FAMConnection * fc
+ CODE:
+# warn("Freeing FAMConnection %p\n", (void *)fc);
+ famwarn(FAMClose(fc), "Closing connection");
+ Safefree(fc);
+
+FAMConnection *
+fc_new(class)
+ char * class
+ CODE:
+ New(0, RETVAL, 1, FAMConnection);
+# warn("Created FAMConnection %p\n", (void *)RETVAL);
+ OUTPUT:
+ RETVAL
+
+int
+fc_fd(fc)
+ FAMConnection * fc
+ CODE:
+ RETVAL=FAMCONNECTION_GETFD(fc);
+ OUTPUT:
+ RETVAL
+
+
+MODULE = Sys::Gamin		PACKAGE = FAMRequestPtr			PREFIX = fr_
+
+PROTOTYPES: ENABLE
+
+void
+fr_DESTROY(fr)
+ FAMRequest * fr
+ CODE:
+# warn("Freeing FAMRequest %p\n", (void *)fr);
+ Safefree(fr);
+
+FAMRequest *
+fr_new(class)
+ char * class
+ CODE:
+ New(0, RETVAL, 1, FAMRequest);
+# warn("Created FAMRequest %p\n", (void *)RETVAL);
+ OUTPUT:
+ RETVAL
+
+int
+fr_reqnum(fr)
+ FAMRequest * fr
+ CODE:
+ RETVAL=FAMREQUEST_GETREQNUM(fr);
+ OUTPUT:
+ RETVAL
+
+void
+fr_setreqnum(fr, new)
+ FAMRequest * fr
+ int new
+ CODE:
+ FAMREQUEST_GETREQNUM(fr)=new;
+
+
+MODULE = Sys::Gamin		PACKAGE = FAMEventPtr			PREFIX = fe_
+
+PROTOTYPES: ENABLE
+
+void
+fe_DESTROY(fe)
+ FAMEvent * fe
+ CODE:
+# warn("Freeing FAMEvent %p\n", (void *)fe);
+ Safefree(fe);
+
+FAMEvent *
+fe_new(class)
+ char * class
+ CODE:
+ New(0, RETVAL, 1, FAMEvent);
+# warn("Created FAMEvent %p\n", (void *)RETVAL);
+ OUTPUT:
+ RETVAL
+
+# /*
+# Properly, these next two should inc. the REFCNT of ST(0), once I
+# figure out how to do something like that, and return the original
+# object. Until then, we do not want gratuitous freeing.
+# */
+
+FAMConnection *
+fe_fc(fe)
+ FAMEvent * fe
+ CODE:
+ New(0, RETVAL, 1, FAMConnection);
+ *RETVAL=*(fe->fc);
+ OUTPUT:
+ RETVAL
+
+FAMRequest *
+fe_fr(fe)
+ FAMEvent * fe
+ CODE:
+ New(0, RETVAL, 1, FAMRequest);
+ *RETVAL=fe->fr;
+ OUTPUT:
+ RETVAL
+
+char *
+fe_hostname(fe)
+ FAMEvent * fe
+ CODE:
+ RETVAL=fe->hostname;
+ OUTPUT:
+ RETVAL
+
+char *
+fe_filename(fe)
+ FAMEvent * fe
+ CODE:
+ RETVAL=fe->filename;
+ OUTPUT:
+ RETVAL
+
+FAMCodes
+fe_code(fe)
+ FAMEvent * fe
+ CODE:
+ RETVAL=fe->code;
+ OUTPUT:
+ RETVAL

Added: branches/upstream/libsys-gamin-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/MANIFEST?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/MANIFEST (added)
+++ branches/upstream/libsys-gamin-perl/current/MANIFEST Thu Jan  1 06:30:55 2009
@@ -1,0 +1,12 @@
+CHANGES
+Gamin.xs
+lib/Sys/Gamin.pm
+Makefile.PL
+MANIFEST
+MANIFEST.SKIP
+META.yml			Module meta-data (added by MakeMaker)
+monitor
+README
+t/gamin.t
+TODO
+typemap

Added: branches/upstream/libsys-gamin-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/MANIFEST.SKIP?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libsys-gamin-perl/current/MANIFEST.SKIP Thu Jan  1 06:30:55 2009
@@ -1,0 +1,18 @@
+CVS/.*
+\.bs$
+\.c$
+\.o$
+\.bak$
+\.sw[a-z]$
+\.tar$
+\.tgz$
+\.tar\.gz$
+^mess/
+^tmp/
+^blib/
+^Makefile$
+^Makefile\.[a-z]+$
+^pm_to_blib$
+~$
+~
+

Added: branches/upstream/libsys-gamin-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/META.yml?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/META.yml (added)
+++ branches/upstream/libsys-gamin-perl/current/META.yml Thu Jan  1 06:30:55 2009
@@ -1,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Sys-Gamin
+version:      0.1
+version_from: 
+installdirs:  site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: branches/upstream/libsys-gamin-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/Makefile.PL?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/Makefile.PL (added)
+++ branches/upstream/libsys-gamin-perl/current/Makefile.PL Thu Jan  1 06:30:55 2009
@@ -1,0 +1,21 @@
+#!/sig/local/bin/perl5 -w
+
+use ExtUtils::MakeMaker;
+BEGIN {
+  eval {
+    require ExtUtils::MM_PRCS;
+    import ExtUtils::MM_PRCS;
+  };
+  if ($@ and $@ =~ /Can\'t locate/) {
+    print STDERR "Ignore \"Not a known parameter name\" warnings.\n";
+  } elsif ($@) {
+    die;
+  }
+}
+
+WriteMakefile(
+  VERSION => '0.1',
+  LIBS => [q[-lfam]],
+  NAME => q(Sys::Gamin),
+  EXE_FILES => [qw(monitor)]
+);

Propchange: branches/upstream/libsys-gamin-perl/current/Makefile.PL
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libsys-gamin-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/README?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/README (added)
+++ branches/upstream/libsys-gamin-perl/current/README Thu Jan  1 06:30:55 2009
@@ -1,0 +1,25 @@
+-*- Outline -*- $Format: "* Version $ProjectRelease$"$
+* Version 1.002
+
+* FAM <-> Perl Interface
+This is a pretty standard XSUB, for Irix only. See SGI::FAM(3) for more.
+
+* Installation
+
+perl Makefile.PL; make all test install
+
+Also try out `perl -Mblib monitor DIRECTORY' on some interesting directory.
+
+* Scripts
+
+** monitor
+
+monitor - monitor filesystem activity with FAM
+
+** magicrcs
+
+magicrcs - automatically monitor directories & files and keep them under RCS
+
+* Summaries
+
+SGI::FAM		Interface to SGI FAM (file-monitor) API.		adcO

Added: branches/upstream/libsys-gamin-perl/current/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/TODO?rev=28992&op=file
==============================================================================
    (empty)

Added: branches/upstream/libsys-gamin-perl/current/lib/Sys/Gamin.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/lib/Sys/Gamin.pm?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/lib/Sys/Gamin.pm (added)
+++ branches/upstream/libsys-gamin-perl/current/lib/Sys/Gamin.pm Thu Jan  1 06:30:55 2009
@@ -1,0 +1,358 @@
+package Sys::Gamin;
+
+use strict;
+use Carp;
+use Cwd;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
+
+require Exporter;
+require DynaLoader;
+require AutoLoader;
+
+ at ISA = qw(Exporter DynaLoader);
+$VERSION='0.1';
+
+sub AUTOLOAD {
+  my $constname;
+  ($constname = $AUTOLOAD) =~ s/.*:://;
+  my $val = constant($constname);
+  if ($! != 0) {
+    if ($! =~ /Invalid/ || $!{EINVAL}) {
+      $AutoLoader::AUTOLOAD = $AUTOLOAD;
+      goto &AutoLoader::AUTOLOAD;
+    } else {
+      croak "Your vendor has not defined Sys::Gamin macro $constname";
+    }
+  }
+  eval "sub $AUTOLOAD { $val }";
+  goto &$AUTOLOAD;
+}
+
+sub DESTROY {}			# Bypass AUTOLOAD
+
+bootstrap Sys::Gamin $VERSION;
+
+sub err(;$) {
+  return $_[0] if @_ and $_[0] != -1;
+  my $err=famerror();
+  croak 'Sys::Gamin: ' . ($err ? $err : $! ? "$!" : 'unknown error');
+}
+
+{
+  my %mapping=(
+	       FAMChanged() => 'change',
+	       FAMDeleted() => 'delete',
+	       FAMStartExecuting() => 'start_exec',
+	       FAMStopExecuting() => 'stop_exec',
+	       FAMCreated() => 'create',
+	       FAMMoved() => 'move',
+	       FAMAcknowledge() => 'ack',
+	       FAMExists() => 'exist',
+	       FAMEndExist() => 'end_exist',
+	      );
+  sub FAMEventPtr::type {
+    my ($self)=@_;
+    my $code=err $self->code;
+    $mapping{$code} or die "Sys::Gamin: Unknown event code $code";
+  }
+}
+
+use vars qw($reqcnt);
+$reqcnt=0;
+
+sub abspath($;) {
+  my ($path)=@_;
+
+  Cwd::abs_path ($path)
+	 or die "Sys::Gamin: could not resolve path $path";
+}
+
+1;
+__END__
+
+=head1 NAME
+
+B<Sys::Gamin> - Perl interface to Gamin (File Access Monitor implementation)
+
+=head1 SYNOPSIS
+
+  use Sys::Gamin;
+  my $fm=new Sys::Gamin;
+  $fm->monitor('/foo');
+  $fm->monitor('/foo/bar.txt');
+  while (1) {
+    my $event=$fm->next_event;	# Blocks
+    print "Pathname: ", $event->filename,
+      " Event: ", $event->type, "\n";
+  }
+
+Asynchronous mode:
+
+  while ($fm->pending) {
+    my $event=$fm->next_event; # Immediate
+    ...
+  }
+  # Do something else
+
+=head1 DESCRIPTION
+
+Provides a somewhat higher-level and friendlier interface to the Gamin File Access
+Monitor API. This allows one to monitor both local and remote (NFS-mounted) files and
+directories for common filesystem events. To do so, you must register "monitors" on
+specified pathnames and wait for events to arrive pertaining to them.
+
+Since FAM only deals with absolute pathnames, all paths are canonicalized internally
+and monitors are held on canonical paths. Whenever a path is returned from this module,
+howvever, via B<which> or B<monitored> with no arguments, the originally specified path
+is given for convenience.
+
+=head1 MAIN METHODS
+
+=head2 B<new> [ I<appname> ]
+
+Create a new FAM connection. An application name may be given.
+
+=cut
+
+sub new {
+  my ($class, $appname)=@_;
+  my $rawconn=new FAMConnectionPtr;
+  err $rawconn->Open2($appname or $0);
+  bless {conn => $rawconn, monitors => {},
+	 suspended => {}, reqnums => {}}, $class;
+}
+
+=head2 B<pending>
+
+True if there is an event waiting. Returns immediately.
+
+=cut
+
+sub pending {
+  my ($self)=@_;
+  err $self->{conn}->Pending;
+}
+
+=head2 B<next_event>
+
+Returns next event in queue, as an event object. Blocks if necessary until one is
+available.
+
+=cut
+
+sub next_event {
+  my ($self)=@_;
+  my $rawev=new FAMEventPtr;
+  err $self->{conn}->NextEvent($rawev);
+  $rawev;
+}
+
+=head2 B<monitor> I<path> [ I<unique> [ I<type> [ I<depth> I<mask> ] ] ]
+
+Monitor the specified file or directory. Expect a slew of events immediately (B<exist>
+and B<end_exist>) which may not interest you.
+
+I<unique>, if specified and true, will produce a warning if the monitored path is not
+unique among those already being monitored. This can be helpful for debugging, but
+normally this is harmless.
+
+I<type> may be B<file>, B<dir> or B<coll>; it defaults to B<file> or B<dir> according
+to an I<existing> filesystem entry. If you specify B<coll> (collection), pass
+additional depth and mask arguments, if you ever figure out what that does (SGI does
+not say).
+
+=cut
+
+sub monitor {
+  my ($self, $_path, $unique, $type, $depth, $mask)=@_;
+  my $path=abspath($_path);
+  die "Sys::Gamin: `$_path' does not currently exist" unless $type or -e $_path;
+  if (exists $self->{monitors}{$path}) {
+    warn "Sys::Gamin: attempt to re-monitor $_path (canon. $path)" if $unique;
+    return;
+  }
+  my $conn=$self->{conn};
+  $type=(-d $path ? 'dir' : 'file') unless $type;
+  my $rawreq=new FAMRequestPtr;
+  $rawreq->setreqnum(++$reqcnt);
+  $self->{monitors}{$path}=$rawreq;
+  if ($type eq 'file') {
+    err $conn->MonitorFile2($path, $rawreq);
+  } elsif ($type eq 'dir') {
+    err $conn->MonitorDirectory2($path, $rawreq);
+  } elsif ($type eq 'coll') {
+    err $conn->MonitorCollection($path, $rawreq, undef, $depth, $mask);
+  } else {
+    die "Sys::Gamin: unknown monitor style $type";
+  }
+  my $reqnum=$rawreq->reqnum;
+  my $orig=$self->{reqnums}{$reqnum};
+  die "Sys::Gamin: attempt to reuse request numbers from $orig to $_path" if $orig;
+  $self->{reqnums}{$reqnum}=$_path;
+}
+
+=head2 B<cancel> I<path>
+
+Stop monitoring this path.
+
+=cut
+
+sub check_monitored {
+  my ($self, $path)=@_;
+  die "Sys::Gamin: `$path' is not monitored"
+    unless exists $self->{monitors}{abspath($path)};
+}
+
+sub cancel {
+  my ($self, $_path)=@_;
+  my $path=abspath($_path);
+  $self->check_monitored($path);
+  err $self->{conn}->CancelMonitor($self->{monitors}{$path});
+  delete $self->{monitors}{$path};
+}
+
+=head2 B<monitored> [ I<path> ]
+
+List all currently monitored paths, or check if a specific one is being monitored. Does
+not check if a monitor is suspended.
+
+=cut
+
+sub monitored {
+  my ($self, $_path)=@_;
+  if ($_path) {
+    exists $self->{monitors}{abspath($_path)};
+  } else {
+    my $reqnums=$self->{reqnums};
+    sort map {$reqnums->{$_->reqnum}} values %{$self->{monitors}};
+  }
+}
+
+=head2 B<suspended> I<path>
+
+True if the specified monitor is suspended.
+
+=cut
+
+sub suspended {
+  my ($self, $_path)=@_;
+  my $path=abspath($_path);
+  $self->check_monitored($path);
+  $self->{suspended}{$path};
+}
+
+=head2 B<suspend> [ I<path> ]
+
+Suspend monitoring of a path, or all paths if unspecified.
+
+=cut
+
+sub suspend {
+  my ($self, $_path)=@_;
+  if ($_path) {
+    my $path=abspath($_path);
+    $self->check_monitored($path);
+    return if $self->{suspended}{$path};
+    err $self->{conn}->SuspendMonitor($self->{monitors}{$path});
+    $self->{suspended}{$path}=1;
+  } else {
+    foreach (keys %{$self->{monitors}}) {
+      unless ($self->{suspended}{$_}) {
+	err $self->{conn}->SuspendMonitor($self->{monitors}{$_});
+	$self->{suspended}{$_}=1;
+      }
+    }
+  }
+}
+
+=head2 B<resume> [ I<path> ]
+
+Resume monitoring of a path, or all paths if unspecified.
+
+=cut
+
+sub resume {
+  my ($self, $_path)=@_;
+  if ($_path) {
+    my $path=abspath($_path);
+    $self->check_monitored($path);
+    return unless $self->{suspended}{$path};
+    err $self->{conn}->ResumeMonitor($self->{monitors}{$path});
+    delete $self->{suspended}{$path};
+  } else {
+    foreach (keys %{$self->{suspended}}) {
+      err $self->{conn}->ResumeMonitor($self->{monitors}{$path});
+      delete $self->{suspended}{$_};
+    }
+  }
+}
+
+=head2 B<which> I<event>
+
+Gives the pathname for the monitor generating this event. Often this will be the same
+as C<$event-E<gt>filename>, but will differ in some cases, e.g. in B<create> events
+where B<filename> will yield the basename of the new file while the B<which> method
+must be invoked to determine the directory of creation, if more than one is being
+monitored.
+
+=cut
+
+sub which {
+  my ($self, $event)=@_;
+  my $reqnum=$event->fr->reqnum;
+  $self->{reqnums}{$reqnum}
+  or die "Sys::Gamin: Monitor \x23$reqnum not found for this connection";
+}
+
+=head1 EVENT METHODS
+
+=head2 B<hostname>
+
+Host of event. Does not seem to work, actually.
+
+=head2 B<filename>
+
+Path of event, according to FAM.
+
+=head2 B<type>
+
+Type of event; one of the following strings: B<change>, B<delete>, B<start_exec>,
+B<stop_exec>, B<create>, B<move>, B<ack>, B<exist>, B<end_exist>.
+
+=head1 BUGS
+
+Most of these can be observed with F<monitor>.
+
+=over 4
+
+=item Hostnames
+
+Do not seem to be supplied at all.
+
+=item Timing
+
+Is somewhat erratic. For example, creating a file that had been monitored and deleted
+will signal a B<create> event on it, after about a second pause.
+
+=item Execute Events
+
+Are not sent, as far as the author can determine.
+
+=back
+
+=head1 SEE ALSO
+
+For the raw SGI interface (rather poorly documented), see L<fam(3x)>.
+
+=head1 AUTHORS
+
+J. Glick B<jglick at sig.bsh.com>: Original SGI::FAM code, in which this module is based.
+
+Carlos Garnacho B<carlosg at gnome.org>.
+
+=head1 REVISION
+
+X<$Format: "F<$Source$> last modified $Date$ release $ProjectRelease$. $Copyright$"$>
+F<lib/SGI/FAM.pm> last modified Thu, 04 Mar 2005 22:05:42 -0100 release 0.1. Original SGI::FAM module: Copyright (c) 1997 Strategic Interactive Group. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+=cut

Added: branches/upstream/libsys-gamin-perl/current/monitor
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/monitor?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/monitor (added)
+++ branches/upstream/libsys-gamin-perl/current/monitor Thu Jan  1 06:30:55 2009
@@ -1,0 +1,62 @@
+#!/usr/bin/env perl
+use Sys::Gamin;
+use autouse Pod::Usage => qw(pod2usage);
+pod2usage(VERBOSE => 1) unless @ARGV;
+
+my $fm=new Sys::Gamin;
+foreach (@ARGV) {
+  $fm->monitor($_);
+}
+my $ev;
+
+format STDOUT_TOP=
+TYPE        MONITOR                          FILE
+-----------------------------------------------------------------------------
+.
+format=
+@<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+$ev->type,  $fm->which($ev),           $ev->filename
+.
+
+while (1) {
+  do {
+    $ev=$fm->next_event;
+    write;
+  } while $fm->pending;
+  print <<EOL;
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+EOL
+}
+
+__END__
+
+=head1 NAME
+
+B<monitor> - monitor filesystem activity with FAM
+
+=head1 SYNOPSIS
+
+F<monitor> I<directory> | I<file> ...
+
+=head1 DESCRIPTION
+
+Provides a running tally of FAM events affecting the specified files or
+directories. Blocks separated by dotted lines indicate contiguous chunks of events in
+the event queue. Should be self-explanatory.
+
+Hit interrupt to stop the monitoring.
+
+=head1 SEE ALSO
+
+See L<SGI::FAM(3)> for the workings.
+
+=head1 AUTHORS
+
+J. Glick B<jglick at sig.bsh.com>.
+
+=head1 REVISION
+
+X<$Format: "F<$Source$> last modified $Date$ release $ProjectRelease$. $Copyright$"$>
+F<monitor> last modified Thu, 25 Sep 1997 22:56:42 -0400 release 1.002. Copyright (c) 1997 Strategic Interactive Group. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+=cut

Propchange: branches/upstream/libsys-gamin-perl/current/monitor
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libsys-gamin-perl/current/t/gamin.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/t/gamin.t?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/t/gamin.t (added)
+++ branches/upstream/libsys-gamin-perl/current/t/gamin.t Thu Jan  1 06:30:55 2009
@@ -1,0 +1,6 @@
+use Test;
+use SGI::FAM;
+
+plan tests => 1;
+
+ok (SGI::FAM::FAMChanged != SGI::FAM::FAMDeleted);

Added: branches/upstream/libsys-gamin-perl/current/typemap
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsys-gamin-perl/current/typemap?rev=28992&op=file
==============================================================================
--- branches/upstream/libsys-gamin-perl/current/typemap (added)
+++ branches/upstream/libsys-gamin-perl/current/typemap Thu Jan  1 06:30:55 2009
@@ -1,0 +1,4 @@
+FAMEvent *					T_PTROBJ
+FAMRequest *					T_PTROBJ
+FAMConnection *					T_PTROBJ
+FAMCodes					T_IV




More information about the Pkg-perl-cvs-commits mailing list