Content Assist on passed objects

Help
2011-09-18
2013-05-20
  • Thomas Prommer

    Thomas Prommer - 2011-09-18

    Epic community,

    Is there a best practice coding standard on how to consistently get the auto-completion / content assist working on methods of a Perl Module in Epic when passed into a method. For example:

        sub main {
           my $moduleObject = MyNameSpace::ModuleObject->new();
           processModuleObject($moduleObject);
        }

        sub processModuleObject {
          my $moduleObject = shift;
          $moduleObject->…    <- that is were I want context assist/auto-completion to work

        }

    The best work around to get it work was the following which I am not happy with:

        sub main {
           my $moduleObject = MyNameSpace::ModuleObject->new();
           processModuleObject($moduleObject);
        }

        sub processModuleObject {
         
          my $moduleObject = MyNameSpace::ModuleObject->new();
          $moduleObject = shift;
          $moduleObject->runLogic();

        }

    Are there any coding best practices we should be aware of?

    /Thomas

     
  • Jan Ploski

    Jan Ploski - 2011-09-18

    I wouldn't necessarily call it a best practice, but you can help yourself like so:

    sub processModuleObject {
      my MyNameSpace::ModuleObject $moduleObject = shift;
      $moduleObject->runLogic();
    }
    
     
  • Oliver Trosien

    Oliver Trosien - 2011-09-19

    That's nice, but unfortunately not best practice. PBP recomends using the @_ for getting arguments. And there this technique does not work. :-(

    sub process {
        my (MyNameSpace::ModuleObject1 $Arg1, MyNameSpace::ModuleObject2 $Arg2) = @_;
    }
    
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks