Loading ...
Sorry, an error occurred while loading the content.

'maps' and 'delegates' in IO::ClassLoader.pm ??

Expand Messages
  • ingo_1972
    Hello, I d like to use the IO::ClassLoader class. But the code die s at this line: Bivio::IO::Alert- bootstrap_die( maps must be a hash_ref ) unless
    Message 1 of 6 , May 22, 2005
    • 0 Attachment
      Hello,

      I'd like to use the IO::ClassLoader class.

      But the code die's at this line:

      Bivio::IO::Alert->bootstrap_die('maps must be a hash_ref')
      unless ref($cfg->{maps}) eq 'HASH';

      What are maps and delegates doing here?
      $cfg is a empty HASH. But where is maps coming from ?


      $_DELEGATES = $cfg->{delegates};


      Thank you very much in advance,
      Ingo
    • robnagler
      ... These are configuration parameters. Bivio::IO::ClassLoader offers three services: simple imports, mapped imports, and delegated imports. The header
      Message 2 of 6 , May 23, 2005
      • 0 Attachment
        --- In extremeperl@yahoogroups.com, "ingo_1972" <ingox@g...> wrote:
        > What are maps and delegates doing here?
        > $cfg is a empty HASH. But where is maps coming from ?

        These are configuration parameters. Bivio::IO::ClassLoader offers
        three services: simple imports, mapped imports, and delegated
        imports. The header documentation explains the three ways you can
        import:

        C<Bivio::IO::ClassLoader> implements dynamic class loading.
        L<simple_require|"simple_require"> implements a dynamic C<use> clause.

        L<map_require|"map_require"> is an indirect load via mapped name.
        The classes
        loaded have names of the form I<Map>.I<Class>. The I<map> is a
        simple perl
        identifier which identifies a class path or handler class which does the
        loading. map_require calls simple_require if the I<map_class> is a
        simple class.

        L<delegate_require|"delegate_require"> is called by classes which
        delegate
        (part of) their implementations. A I<delegate> may provide I<info>,
        a data
        structure which defines the internals of, say, a
        L<Bivio::Type::Enum|Bivio::Type::Enum>. A delegate may also completely
        implement the class.

        B<NOTE: You can only load classes which are of type
        L<Bivio::UNIVERSAL|Bivio::UNIVERSAL> with this module.>

        This last point is important. If you just need a simple class loader,
        you probably don't want Bivio::IO::ClassLoader. Use something
        simpler, e.g.

        eval 'use My::Class;1' || die($@);

        There are probably CPAN packages which do that much.

        ClassLoader is mostly used by bOP to manage multiple applications
        which may override standard classes (such as ECService or
        UserCreateForm). ClassLoader is also used defer loading classes until
        they are needed. The latter case is a performance optimization for
        command line utilities.

        Rob
      • Terrence Brannon
        ... ack. More of the Bivio self-containedness. ... http://www.metaperl.com/article-pod/Catalog-lazy_loaders/lazy_loaders.html ... yes, I call those lazy
        Message 3 of 6 , May 24, 2005
        • 0 Attachment
          "robnagler" <nagler@...> writes:


          > B<NOTE: You can only load classes which are of type
          > L<Bivio::UNIVERSAL|Bivio::UNIVERSAL> with this module.>

          ack. More of the Bivio self-containedness.

          > This last point is important. If you just need a simple class loader,
          > you probably don't want Bivio::IO::ClassLoader. Use something
          > simpler, e.g.
          >
          > eval 'use My::Class;1' || die($@);
          >
          > There are probably CPAN packages which do that much.

          http://www.metaperl.com/article-pod/Catalog-lazy_loaders/lazy_loaders.html

          > ClassLoader is also used defer loading classes until
          > they are needed.

          yes, I call those lazy loaders and maintain a list of them.

          --
          Carter's Compass: I know I'm on the right track when,
          by deleting something, I'm adding functionality.
        • ingo_1972
          Rob, thank you for your answer. My problem is that I have a script which uses Bivio. This is working fine. My task is that I have to move it to a different
          Message 4 of 6 , May 24, 2005
          • 0 Attachment
            Rob,

            thank you for your answer.
            My problem is that I have a script which uses Bivio.
            This is working fine.
            My task is that I have to move it to a different system.

            On the new machine the script always dies here:
            Bivio::IO::Alert->bootstrap_die('maps must be a hash_ref')
            unless ref($cfg->{maps}) eq 'HASH';

            Is there something needed to get it up and running ?

            Thanx,
            Ingo


            --- In extremeperl@yahoogroups.com, "robnagler" <nagler@b...> wrote:
            > --- In extremeperl@yahoogroups.com, "ingo_1972" <ingox@g...> wrote:
            > > What are maps and delegates doing here?
            > > $cfg is a empty HASH. But where is maps coming from ?
            >
            > These are configuration parameters. Bivio::IO::ClassLoader offers
            > three services: simple imports, mapped imports, and delegated
            > imports. The header documentation explains the three ways you can
            > import:
            >
            > C<Bivio::IO::ClassLoader> implements dynamic class loading.
            > L<simple_require|"simple_require"> implements a dynamic C<use> clause.
            >
            > L<map_require|"map_require"> is an indirect load via mapped name.
            > The classes
            > loaded have names of the form I<Map>.I<Class>. The I<map> is a
            > simple perl
            > identifier which identifies a class path or handler class which
            does the
            > loading. map_require calls simple_require if the I<map_class> is a
            > simple class.
            >
            > L<delegate_require|"delegate_require"> is called by classes which
            > delegate
            > (part of) their implementations. A I<delegate> may provide I<info>,
            > a data
            > structure which defines the internals of, say, a
            > L<Bivio::Type::Enum|Bivio::Type::Enum>. A delegate may also
            completely
            > implement the class.
            >
            > B<NOTE: You can only load classes which are of type
            > L<Bivio::UNIVERSAL|Bivio::UNIVERSAL> with this module.>
            >
            > This last point is important. If you just need a simple class loader,
            > you probably don't want Bivio::IO::ClassLoader. Use something
            > simpler, e.g.
            >
            > eval 'use My::Class;1' || die($@);
            >
            > There are probably CPAN packages which do that much.
            >
            > ClassLoader is mostly used by bOP to manage multiple applications
            > which may override standard classes (such as ECService or
            > UserCreateForm). ClassLoader is also used defer loading classes until
            > they are needed. The latter case is a performance optimization for
            > command line utilities.
            >
            > Rob
          • Terrence Brannon
            ... sounds like an issue for the Bivio BOP yahoogroup! -- Carter s Compass: I know I m on the right track when, by deleting something, I m adding
            Message 5 of 6 , May 24, 2005
            • 0 Attachment
              "ingo_1972" <ingox@...> writes:

              > Rob,
              >
              > thank you for your answer.
              > My problem is that I have a script which uses Bivio.
              > This is working fine.
              > My task is that I have to move it to a different system.

              sounds like an issue for the Bivio BOP yahoogroup!

              --
              Carter's Compass: I know I'm on the right track when,
              by deleting something, I'm adding functionality.
            • robnagler
              ... Moved to Bivio-bOP@yahoogroups.com Rob
              Message 6 of 6 , Jun 12 7:19 AM
              • 0 Attachment
                --- In extremeperl@yahoogroups.com, Terrence Brannon <bauhaus@m...> wrote:
                > sounds like an issue for the Bivio BOP yahoogroup!

                Moved to Bivio-bOP@yahoogroups.com

                Rob
              Your message has been successfully submitted and would be delivered to recipients shortly.