Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Thanks for the script. I changed it a bit. Here's my version. (Hopefully I didn't introduce a bug.)
#!/usr/bin/perl # # a simple module initializer using TemplateToolkit # original source: # - code rewritten a bit # - use Path::Class instead of File::Spec # - renamed '' template file to use Cwd; use Path::Class qw(file); my $template_dir = "~/.templates/modules/"; my $module = $ARGV[0] || prompt( "Module name> " ); (my $dist = $module) =~ s/::/-/g; # Foo::Bar::Baz -> Foo-Bar-Baz (my $base = $module) =~ s/.*:://; # Foo::Bar::Baz -> Baz my $file = $base . ".pm"; # Baz -> my $cwd = file(cwd(), $dist); # must contain ttree (provided through Template Toolkit) $ENV{PATH} = '/usr/local/bin:/usr/bin:/bin'; my @command = ( 'ttree', "-s $template_dir", "-d $cwd", "-define module='$module'", "-define module_file='$file'", "-define module_dist='$dist'", ); system join " ", @command; chdir $dist; rename file('lib', ''), file('lib', $file); sub prompt { print join "\n", @_; print "> "; my $line = <STDIN>; chomp $line; $line; }

In reply to Re^2: Best Module Starter? by Monk::Thomas
in thread Best Module Starter? by dynamo

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [1nickt]: That's cool Disci+

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (4)
    As of 2018-01-24 03:04 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (255 votes). Check out past polls.