This question about Using an extension: Answered

Error compiling Can't locate Foswiki/Form/Topic.pm

Summary

ERROR in Foswiki error.log:
error compiling class Foswiki::Form::Topic: Can't locate Foswiki/Form/Topic.pm in @INC (you may need to install the Foswiki::Form::Topic module)

I am using Foswiki 2.0.3, perl v5.18.2, Ubuntu 14.04.2 LTS. I have installed WikiworkbenchContrib and prerequisites. The Foswiki error log reports an error when I create a new Application.

The error message suggests that I need to install Topic.pm. However, I am unclear where this module is to be found. Have I missed a prerequisite? Can you assist?

Details

The following sequence works in version 1.1.9, but fails in 2.0.3 as follows.

  1. WIKIDEBUG >>> 1. login 2.0.3 - Mon Dec 21 12:20:36 AEDT 2015
    • Success
  2. WIKIDEBUG >>> 2. Create TestApp in 2.0.3 - Mon Dec 21 12:22:22 AEDT 2015
    • Appears successful. three pages of topics reported in TestApp (WebHome). Directory contains 26 files plus history.
    • HOWEVER, the Foswiki log reports an error in this step. See below.
  3. WIKIDEBUG >>> 3. Create a topic function in 2.0.3 - Mon Dec 21 12:27:18 AEDT 2015
    • Success? After clicking "New", RenderTopicFunction appears in the edit template WITHOUT a form displayed. I assume the defaults are inserted.
    • After clicking "Save" the topic is displayed with the form: TopicFunction. And the TopicType is: WikiTopic
  4. WIKIDEBUG >>> 4. Back to the TopicFunctions page in 2.0.3 - Mon Dec 21 12:35:48 AEDT 2015

The contents of the foswiki log are: ( the markers >>>> WIKIDEBUG correspond to the steps above )
>>>>>>>>>>>>>>>>>>>>>>>> WIKIDEBUG >>> 1. login 2.0.3 - Mon Dec 21 12:20:36 AEDT 2015
>>>>>>>>>>>>>>>>>>>>>>>> WIKIDEBUG >>> 2. Create Test.App in 2.0.3 - Mon Dec 21 12:22:22 AEDT 2015
| 2015-12-21T12:23:33+11:00 error | error compiling class Foswiki::Form::Topic: Can't locate Foswiki/Form/Topic.pm in @INC (you may need to install the Foswiki::Form::Topic module) (@INC contains: /var/www/Foswiki-2.0.3/lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl . /var/www/Foswiki-2.0.3/lib/CPAN/lib) at (eval 274) line 2.
 at (eval 274) line 2.
        eval 'require Foswiki::Form::Topic' called at /var/www/Foswiki-2.0.3/lib/Foswiki/Form.pm line 404
        Foswiki::Form::createField('Foswiki::Form=HASH(0x9789cf0)', 'topic', 'web', 'Applications', 'topic', 'WikiApplication', 'definingTopic', '', 'title', ...) called at /var/www/Foswiki-2.0.3/lib/Foswiki/Form.pm line 361
        Foswiki::Form::__ANON__('close_tr') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Tables/Parser.pm line 268
        Foswiki::Tables::Parser::parse('---++ Documentation\x{a}%STARTSECTION{"documentation"}%\x{a}Normally ...', 'CODE(0x9769c48)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Form.pm line 376
        Foswiki::Form::__ANON__() called at /usr/share/perl5/Error.pm line 416
        eval {...} called at /usr/share/perl5/Error.pm line 408
        Error::subs::try('CODE(0x976a198)', 'HASH(0x976a238)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Form.pm line 381
        Foswiki::Form::_parseFormDefinition('Foswiki::Form=HASH(0x9789cf0)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Form.pm line 136
        Foswiki::Form::new('Foswiki::Form', 'Foswiki=HASH(0x8d5f7e8)', 'Applications/TestApp', 'Applications.WikiApplication') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Plugins/JQGridPlugin/DBCacheConnector.pm line 172
        Foswiki::Plugins::JQGridPlugin::DBCacheConnector::__ANON__() called at /usr/share/perl5/Error.pm line 416
        eval {...} called at /usr/share/perl5/Error.pm line 408
        Error::subs::try('CODE(0x976ca80)', 'HASH(0x976c9e0)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Plugins/JQGridPlugin/DBCacheConnector.pm line 177
        Foswiki::Plugins::JQGridPlugin::DBCacheConnector::search('Foswiki::Plugins::JQGridPlugin::DBCacheConnector=HASH(0x979dc48)', 'web', 'Applications/TestApp', 'query', 'topic=\'.*\'', 'sort', 'Changed', 'reverse', 'on', ...) called at /var/www/Foswiki-2.0.3/lib/Foswiki/Plugins/JQGridPlugin/DBCacheConnector.pm line 111
        Foswiki::Plugins::JQGridPlugin::DBCacheConnector::restHandleSearch('Foswiki::Plugins::JQGridPlugin::DBCacheConnector=HASH(0x979dc48)', 'Foswiki::Request=HASH(0x8d42fa0)', 'Foswiki::Response=HASH(0x8d5f8c4)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Plugins/JQGridPlugin.pm line 100
        Foswiki::Plugins::JQGridPlugin::__ANON__() called at /usr/share/perl5/Error.pm line 416
        eval {...} called at /usr/share/perl5/Error.pm line 408
        Error::subs::try('CODE(0x97af70c)', 'HASH(0x97af8b0)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Plugins/JQGridPlugin.pm line 108
        Foswiki::Plugins::JQGridPlugin::restGridConnector('Foswiki=HASH(0x8d5f7e8)', 'JQGridPlugin', 'gridconnector', 'Foswiki::Response=HASH(0x8d5f8c4)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Func.pm line 768
        Foswiki::Func::__ANON__('Foswiki=HASH(0x8d5f7e8)', 'JQGridPlugin', 'gridconnector', 'Foswiki::Response=HASH(0x8d5f8c4)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/UI/Rest.pm line 275
        Foswiki::UI::Rest::__ANON__() called at /usr/share/perl5/Error.pm line 416
        eval {...} called at /usr/share/perl5/Error.pm line 408
        Error::subs::try('CODE(0x97aca88)', 'HASH(0x97600bc)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/UI/Rest.pm line 290
        Foswiki::UI::Rest::rest('Foswiki=HASH(0x8d5f7e8)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/UI.pm line 374
        Foswiki::UI::__ANON__() called at /usr/share/perl5/Error.pm line 416
        eval {...} called at /usr/share/perl5/Error.pm line 408
        Error::subs::try('CODE(0x83c9430)', 'HASH(0x8da409c)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/UI.pm line 500
        Foswiki::UI::_execute('Foswiki::Request=HASH(0x8d42fa0)', 'CODE(0x8d92fb4)', 'rest', 1) called at /var/www/Foswiki-2.0.3/lib/Foswiki/UI.pm line 326
        Foswiki::UI::handleRequest('Foswiki::Request=HASH(0x8d42fa0)') called at /var/www/Foswiki-2.0.3/lib/Foswiki/Engine/CGI.pm line 99
        Foswiki::Engine::CGI::run('Foswiki::Engine::CGI=HASH(0x887b4e0)') called at /var/www/Foswiki-2.0.3/bin/rest line 29
 |
>>>>>>>>>>>>>>>>>>>>>>>> WIKIDEBUG >>> 3. Create a topic function in 2.0.3 - Mon Dec 21 12:27:18 AEDT 2015
>>>>>>>>>>>>>>>>>>>>>>>> WIKIDEBUG >>> 4. Back to the TopicFunctions page in 2.0.3 - Mon Dec 21 12:35:48 AEDT 2015
>>>>>>>>>>>>>>>>>>>>>>>> WIKIDEBUG >>> 5. END OFF EXPERIMENTS - Mon Dec 21 12:38:26 AEDT 2015  

The problem appears to occur here:
require Foswiki::Form::Topic' called at /var/www/Foswiki-2.0.3/lib/Foswiki/Form.pm line 404

Topic.pm is not found anywhere in my Foswiki 2.0.3 installation tree.

The code in Form.pm at line 404 does not refer explicitly to Topic.pm.
    386 # PROTECTED
    387 # Create a field object. Done like this so that this method can be
    388 # overridden by subclasses to extend the range of field types.
    389 sub createField {
    390     my $this = shift;
    391     my $type = shift;
    392 
    393     # The untaint is required for the validation *and* the ucfirst, which
    394     # retaints when use locale is in force (hence we do the validation *after*
    395     # the ucfirst)
    396     my $class = Foswiki::Sandbox::untaint(
    397         $type,
    398         sub {
    399             my $class = ucfirst(shift);
    400             $class =~ m/^([a-zA-Z0-9_]*)/;    # cut off +buttons etc
    401             return "Foswiki::Form::$1";
    402         }
    403     );
    404     eval 'require ' . $class;
    405     if ($@) {
    406         $this->session->logger->log( 'error',
    407             "error compiling class $class: $@" );
    408 
    409         # Type not available; use base type
    410         require Foswiki::Form::FieldDefinition;
    411         $class = 'Foswiki::Form::FieldDefinition';
    412     }
    413     return $class->new( session => $this->session(), type => $type, @_ );
    414 }

All this suggests that I need to install Topic.pm. However, I am unclear where this module is to be found. Have I missed a prerequisite? Can you assist?

Thanks in advance.

-- BramVanOosterhout - 21 Dec 2015

Yes, I have found the answer. Topic.pm is in MoreFormFieldsPlugin. Installed that with all prerequisites and the compile error went away. I still don't get the same behaviour as under 1.1.9. That is the created TopicFunction onle has a WikiTopic type. But that is clearly a different problem. I will close this error report.. Thanks for letting me formulate the question. smile

-- BramVanOosterhout - 21 Dec 2015
 

QuestionForm edit

Subject Using an extension
Extension WikiWorkbenchContrib
Version Foswiki 2.0.3
Status Answered
Related Topics
Topic revision: r1 - 21 Dec 2015, BramVanOosterhout
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy