in reply to Test Blocks and skipping

I am sure that I do not understand you question fully, but it sounds like the use of labels and goto statements might help. If so see: perldoc goto
If not, sorry...but good luck in your search, and I am sure that some of the much wiser monks will have suggestions.

Replies are listed 'Best First'.
Re^2: Test Blocks and skipping
by joewoodhouse30 (Novice) on Oct 16, 2006 at 21:58 UTC

    Not sure how this would help.

    Effectively what I want is for this
    step a; testBlock("Block1",checkSomething) step b; }
    to work like
    step a; if(checkSomething){ step b; }else{ print "Not running step b as checkSomething failed" }
    Hope that makes things clearer
      So what you want to do is invent a programming language, and make it work by parsing it then translating it to Perl. If the language is simple, that shouldn't be that hard to do.

      However you want to make it not look like a programming language. And you want it to be capable. And you don't want to let your users know that they are actually programming. Oh, and you want to be able to extend the language easily.

      That's a hard problem. And it is mostly a psychological one. What I'd suggest doing is a lot of whiteboarding. Write up samples of what people should write and what it would do. Go over it with users. When you have something mutually acceptable, then write a filter to turn that into Perl code. (Filter::Simple may help.)

      You can then make it extensible by having some command in your new language that loads a Perl module that adds new functions. :-)

      step a; testBlock("Block1",checkSomething) step b; }

      What does the unbalanced curly right bracket mean?

      The closest I can whip up - with a bit of syntax change - is

      sub checkSomething { 0 } sub testBlock (**&) { my ($block,$cond,$sub) = @_; my $test = &{$cond}; $test ? &$sub : warn "not running code for $block since '$cond' fa +iled \n"; } testBlock "Block1", 'checkSomething', sub { print "done\n"; # or another test };

      But I do ask - what good is it to provide test suites for somebody who doesn't grok if/else, and what could that target user possibly debug?

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re^2: Test Blocks and skipping
by tilly (Archbishop) on Oct 16, 2006 at 21:45 UTC
    I hope this was a troll, and not meant seriously. If not, then you've missed out on several decades of programming theory.
      Tilly,
      If you read in his text "if..else construct is deemed to complicated for my target users". This made me believe that it could have been a solution if not for the targeted users, what is simpler labels?