From what I understood of the original problem -- Ronnie has to port some code over to Perl, from some shell scripts.

It makes perfect sense to me to try to keep the logic flow the same between programs for the first iteration. If the program's logic was working, it makes no sense to try to refactor it at the same time ... we have no idea what the deadlines are, or any other constraints on this project, and I don't personally see the point in spouting ideology on this particular point, as goto has its uses.

I've used goto in Perl quite a few times in the past year. Most frequently, it's inside functions like AUTOLOAD that generate closures, and then goto the new function ... or any other time I insert logging functions in a child that I don't want to show up if the parent looks at caller:

my $obj = child->new(); $obj->do_something(); my $obj2 = child2->new(); $obj2->do_something(); exit; package parent; use Data::Dumper; sub do_something { warn Dumper { 'caller' => [ caller ] }; } sub new { my $class = shift; return bless {}, $class }; package child; use base qw( parent ); sub do_something { my $self = shift; $self->SUPER::do_something; } package child2; use base qw( parent ); sub do_something { goto &{'parent::do_something'}; }

In reply to Re: Go to? by jhourcle
in thread Go to? by Ronnie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.