in reply to Re: PL/1's PUT DATA in Perl - is this possible?
in thread PL/1's PUT DATA in Perl - is this possible?

You can also just use the comments and never even have a use Smart::Comments line in the file at all or worry about removing/commenting it out for production. Just run with a wrapper which calls perl appropriately when you want them turned on (zsh function; adjust accordingly for other inferior shells . . . :):

scom () { local level="" if [[ $1 = (([#]##),#)## ]] then level="=$1" shift fi perl -MSmart::Comments${level} "$@" }

By default it runs with the normal "###" level, but you can call it as scom '###,####,#####' foo.plx to enable more levels as necessary.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^3: PL/1's PUT DATA in Perl - is this possible?
by ikegami (Patriarch) on Nov 07, 2008 at 19:05 UTC

    Adjusted for inferior shell:

    #!/usr/bin/sh perl -e'$l=shift if $ARGV[0] =~ /#{3,}/; exec $^X, "-MSmart::Comments=$l", @ARGV; die $! '
Re^3: PL/1's PUT DATA in Perl - is this possible?
by djp (Hermit) on Nov 13, 2008 at 01:13 UTC
    I use a bunch of aliases:
    alias smart='perl -MSmart::Comments' alias smart3='perl -MSmart::Comments="###"' alias smart34='perl -MSmart::Comments="###","####"' alias smart4='perl -MSmart::Comments="####"' ...