[ic] UserTag and require problem
Bruno Cantieni
bruno at digi-land.com
Fri Feb 9 21:57:17 EST 2007
> > Subject: RE: [ic] UserTag and require problem
> >
> > > > Does anyone have a clue why the below (cut down to the
> > > bone) is not
> > > > working?
> > > >
> > > > UserTag serialize Routine <<EOR
> > > > require Vend::serialize;
> > > > sub {
> > > > my(%v) = @_;
> > > > my $serialized = Vend::serialize::serialize(\%v);
> > > > return $serialized;
> > > > }
> > > > EOR
> > > >
> > > > [perl]
> > > > my %data = (
> > > > 1 => 'Yes',
> > > > 0 => 'No',
> > > > );
> > > > return $Tag->serialize(%data);
> > > > [/perl]
> > > >
> > > > This results in:
> > > > Safe: Undefined subroutine &Vend::serialize::serialize
> > > called at (tag
> > > > 'perl') line 4.
> > > >
> > > > I plopped the serialize.pm (Scott Hurring,
> > > > http://hurring.com/code/perl/serialize/) into the Vend
> directory
> > > > and it
> > > > appears to load OK when testing as in:
> > > >
> > > > #####
> > > > my $can_do = 0;
> > > > eval {
> > > > require Vend::serialize;
> > > > $can_do = 1;
> > > > };
> > > > if ($@) {
> > > > return sub{
> > > > ::logDebug("Cannot load serialize: $@");
> > > > }
> > > > }else{
> > > > ::logDebug("Starting serializer $can_do"); #
> getting here with 1
> > > > }
> > > > #etc.
> > > > #####
> > > I think you may have to add the AllowGlobal directive for your
> > > catalog to do stuff like that.
> > >
> > > Bill Carr
> >
> > Well, the catalog in question is actully in the AllowGlobal list :(
> >
> > Bruno
> >
>
> You'll need to make sure serialize.pm actually saye "package
> Vend::serialize;", as perl doesn't care what's in the .pm file -- it
> just loads it. As long as the module returns true, as far as perl
> knows, all is fine. (I notice the test code you've posted doesn't try
> to call &Vend::serialize::serialize...)
>
> You might put a test script in $IC_DIR/lib/Vend, that tries to require
> the module and then actually use it. Seems to me it'd fail,
> unless the
> module is told to put its stuff in Vend::serialize...
>
> Course, all this is me just guessing. If i'm wrong, someone please
> correct me :)
>
> --
> Daniel Davenport
> New Age Digital
> http://www.newagedigital.com
Oh for (name your favorite daeity)'s sake!!!
How many times do I have to do that boohbooh before I remember....
package Vend::serialize;
package Vend::serialize;
package Vend::serialize;
package Vend::serialize;
package Vend::serialize;
Mea culpa.
Thanks a million Daniel.
Have a great weekend all..
Bruno Cantieni
More information about the interchange-users
mailing list