[Rt-commit] [svn] r1378 - in DBIx-SearchBuilder/trunk: . SearchBuilder

jesse at pallas.eruditorum.org jesse at pallas.eruditorum.org
Tue Aug 31 03:22:11 EDT 2004


Author: jesse
Date: Tue Aug 31 03:22:10 2004
New Revision: 1378

Modified:
   DBIx-SearchBuilder/trunk/   (props changed)
   DBIx-SearchBuilder/trunk/SearchBuilder/Record.pm
Log:
 ----------------------------------------------------------------------
 r8476 at tinbook:  jesse | 2004-08-31T07:21:53.399025Z
 Fixing the code that handles the old _Accessible layer to be more robust. (It may want to be made faster, but if you are using code that needs the emulation code, you can get more speed by upgrading to a newer app ;)
 ----------------------------------------------------------------------


Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Record.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Record.pm	(original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Record.pm	Tue Aug 31 03:22:10 2004
@@ -473,45 +473,19 @@
     my $attr = shift;
     my $mode = lc(shift);
 
-    
     # @_ is the Accessible data from our subclass. Time to populate
     # the accessible columns datastructure (but only if we're using
     # something with the ancient API that predates ClassAccessible
-    $self->_AccessibleLoad( @_) if ( !$self->can('_ClassAccessible') && @_);
 
     #  return true if we can $mode $Attrib;
     local ($^W) = 0;
-    my $attribute = $self->_ClassAccessible->{$attr};
-    return 0 unless (defined $attr && $attr->{'mode'});
+    my $attribute = $self->_ClassAccessible(@_)->{$attr};
+    return 0 unless (defined $attribute && $attribute->{$mode});
     return 1;
 }
 
 # }}}
 
-# {{{ sub _AccessibleLoad
-
-=head2 _AccessibleLoad COLUMN => OPERATIONS, ...
-
-WILDLY DEPRECATED. YOU SHOULD NEVER NEED THIS
-
-=cut
-
-
-*_accessible_load = \&AccessibleLoad;
-sub _AccessibleLoad {
-  my $self = shift;
-  my $accessible;
-
-  while ( my $col = shift ) {
-    $accessible->{$col}->{lc($_)} = 1
-      foreach split(/[\/,]/, shift);
-  }
-
-  *{_ClassAccessible} =  sub { return $accessible };
-
-}
-
-# }}}
 
 =head2 _PrimaryKeys
 
@@ -524,6 +498,7 @@
     my $self = shift;
     return ['id'];
 }
+
 # {{{ sub _ClassAccessible
 
 =head2 _ClassAccessible 
@@ -541,6 +516,19 @@
 
 =cut
 
+# XXX This is stub code to deal with the old way we used to do _Accessible
+# It should never be called by modern code
+
+sub _ClassAccessible {
+  my $self = shift;
+  my %accessible;
+  while ( my $col = shift ) {
+    $accessible{$col}->{lc($_)} = 1
+      foreach split(/[\/,]/, shift);
+  }
+	return(\%accessible);
+}
+
 # }}}
 
 # sub {{{ ReadableAttributes


More information about the Rt-commit mailing list