Re: DBD::Informix and SIGBUS in perl



"Jonathan Leffler" <jonathan.leffler@xxxxxxxxx> wrote in message ...

> On 5/17/05, Konstantin Solodovnikov <ks@xxxxxxxxxxxxx> wrote:
> > I'm having a problem with DBD::Informix when using it's functions via a
> > 'goto &$sub' mechanism.

> Que? What on earth is that? Why do you want to use it? Where did it ever
work?

It worked fine for me every time I used it in an AUTOLOAD routine.

> OK - the Camel book says 'goto LABEL' and 'goto EXPR' are rather like
> Fortran computed gotos and just as good for maintenance programmers.
> It says 'goto &NAME;' is OK for autoloaders who need to replace
> themselves with the function that they just loaded. You aren't
> autoloading that I can see, so...why?

I *am* autoloading. But I stripped AUTOLOAD function from the example
to make it shorter and clearer, because the code shows the effect both
with or without the AUTOLOAD function.

> And Konstantin, what is the DBI->can() method for? It is documented
> in DBI as returning true or false depending on whether a method is
> implemented by the driver or a default method is provided by DBI
> (perldoc DBI for v1.48). So, what made you think that it returned a
> subroutine reference or name? Your usage of it bears no relation to
> the documentation of it.

Well, DBI->can() returns a good sub reference for me, and it works fine, if
not interrupted by an SQL error.
But you are quite right about disadvantages of relying on undocumented
features of DBI API.
Could anyone point me at a more convenient way of implementing
an AUTOLOAD function?

BTW, if noone can rely on output of DBI->can() being a valid subroutine ref,
it surely breaks standards (see man UNIVERSAL).
And at least using it this way must be explicitly mentioned in the docs as a
bad practice.

Best regards,
Konstantin Solodovnikov,
JSC "Web Media Servises".
ks@xxxxxxxxxxxxxx


.



Relevant Pages

  • Re: autoload with namespace
    ... does the namespace get supplied to the autoload function as well as the ... use namespaces in most places. ... It then calls the relevant autoload function for that class. ... When hacking on other 3rd party apps that include such stuff it's ...
    (php.general)
  • Re: [PHP] autoload with namespace
    ... Playing around with dev PHP 5.3 and namespaces, ... Since autoload will be triggered on any ... namespace call, the request could be for a namespace function or constant. ... does the namespace get supplied to the autoload function as well as the ...
    (php.general)
  • Re: [PHP] Re:[PHP]clases en sesiones
    ... In order to have the __autoload function work properly for session'd objects it needs to be declared before the session is started. ... If it is before then you could declare the __autoload function in the prepended file and it should work. ...
    (php.general)
  • Re: Accessing Class Method
    ... because if you've reached the __autoload function, ... obviously not present (no sense making php check for it a second ...
    (comp.lang.php)