On May 15, 2009, at 12:47 PM, yair via RT wrote:
Show quoted text> Queue: perl-ldap
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=46111 >
>
> Graham,
>
> Thanks for the prompt response. I tested with RH4 (perl-LDAP 0.31-5).
>
> On RH4, I switched the code to use the 5.8 open (and skip the optional
> IO::Scalar). I made my best effort to implement a fallback for old
> Perl
> (before 5.8), but I really do not have any way to test. Also, I
> removed
> the call to write_version. The LDIF seems to put the version
> automatically).
>
> 100a101
>> require IO::Scalar;
> 102,110c103
> < my $fh ;
> < if ( $] < 5.008 ) {
> < require IO::Scalar;
> < my $fh = IO::Scalar->new(\$content);
> < } else {
> < $fh = new IO::Handle ;
> < open $fh, '>', \$content or die ;
That is actually a syntax error in some versions of perl, which was
why I opted for IO::Scalar. Of course is it really worth trying to
support 5.4 anymore though
Show quoted text>
> < } ;
> <
> ---
>> my $fh = IO::Scalar->new(\$content);
> 112c105
> < #REMOVED $ldif->write_version;
This was there for the case when the search returns no results.
Show quoted text>
> ---
>> $ldif->write_version;
>
> While testing, I'm noticed TWO problems with error handling:
>
> if ($mesg->code) {
> my $res = new HTTP::Response &HTTP::Status::RC_BAD_REQUEST,
> "LDAP return code " . $ldap->code;
> $res->content_type("text/plain");
> # BAD $res->content($ldap->error);
> $res->content($mesg->error);
as this was copy/paste from the html section I can conclude that
nobody uses this module and that we can default to ldif output :)
Show quoted text>
> return $res;
> }
>
> the '$ldap->error' should be '$mesg->error'.
>
> Do you want a separate ticket for this item ? Without it, any error
> will result little information to the user about the real problem.
> Most
> common error for me was bad password/username, or bad permission.
>
> Attached is my final version, but it's built from 1.10.
Thanks
Graham.