[Bast-commits] r3906 - in trunk/Net-LDAP-HTMLWidget: . lib/Net/LDAP

omega at dev.catalyst.perl.org omega at dev.catalyst.perl.org
Wed Jan 2 06:34:07 GMT 2008


Author: omega
Date: 2008-01-02 06:34:07 +0000 (Wed, 02 Jan 2008)
New Revision: 3906

Modified:
   trunk/Net-LDAP-HTMLWidget/
   trunk/Net-LDAP-HTMLWidget/Changes
   trunk/Net-LDAP-HTMLWidget/lib/Net/LDAP/HTMLWidget.pm
Log:
 r20835 at andreas-marienborgs-computer:  andreas | 2008-01-02 07:34:00 +0100
 Added option for decoding values from ldap-server before adding to the widget



Property changes on: trunk/Net-LDAP-HTMLWidget
___________________________________________________________________
Name: svk:merge
   - ea49d7f7-7c45-40ca-be27-1349e20c1c07:/local/net-ldap-htmlwidget:15859
   + ea49d7f7-7c45-40ca-be27-1349e20c1c07:/local/net-ldap-htmlwidget:20835

Modified: trunk/Net-LDAP-HTMLWidget/Changes
===================================================================
--- trunk/Net-LDAP-HTMLWidget/Changes	2008-01-01 18:18:36 UTC (rev 3905)
+++ trunk/Net-LDAP-HTMLWidget/Changes	2008-01-02 06:34:07 UTC (rev 3906)
@@ -1,5 +1,14 @@
 Revision history for Net-LDAP-HTMLWidget
-
+0.06    2008-01-01 07:29
+        Making it possible to decode values from the ldap server before
+        filling the widget.
+        
+0.05    2007-08-16 12:48
+        Or so I thought, trying again
+        
+0.04    2007-08-14 08:01
+        Fixed the distro to not include ._ files
+        
 0.03    2007-08-08 12:39
         Fixed a missing use Carp;
         

Modified: trunk/Net-LDAP-HTMLWidget/lib/Net/LDAP/HTMLWidget.pm
===================================================================
--- trunk/Net-LDAP-HTMLWidget/lib/Net/LDAP/HTMLWidget.pm	2008-01-01 18:18:36 UTC (rev 3905)
+++ trunk/Net-LDAP-HTMLWidget/lib/Net/LDAP/HTMLWidget.pm	2008-01-02 06:34:07 UTC (rev 3906)
@@ -2,9 +2,10 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.03';
+our $VERSION = '0.06';
 # pod after __END__
 use Carp qw(croak);
+our $DECODE = 0;
 
 sub fill_widget {
     my ($self,$entry,$widget)=@_;
@@ -16,7 +17,11 @@
     foreach my $element ( @elements ) {
         my $name=$element->name;
         next unless $name && $entry->exists($name) && $element->can('value');
-	    $element->value( $entry->get_value($name) );
+        my $v = $entry->get_value($name);
+        if ($DECODE) {
+            $v = Encode::decode($DECODE, $v);
+        }
+	    $element->value( $v );
     }
 }
 
@@ -129,7 +134,26 @@
 
 Updates the $item with new values from $result and updated using 
 $ldap_connection.
-   
+
+
+=head1 CHARACTER ENCODING
+
+As a result of utf-8 handling in general beeing a pain in the ass,
+we also provide an bad hack to work around certain odities. 
+
+We have a package scoped variabel called DECODE which, if set, will
+cause values from the ldap-server to be decoded from that encoding
+to perls internal string format before it gets added to the HTML::Widget
+
+=head2 Example
+    
+    package MyApp::LDAP::Entry;
+    use base qw/Net::LDAP::HTMLWidget/;
+    
+    $Net::LDAP::HTMLWidget::DECODE = 'utf-8';
+    
+    1;
+
 =head1 AUTHOR
 
 Thomas Klausner, <domm at cpan.org>, http://domm.zsi.at




More information about the Bast-commits mailing list