On approximately 5/7/2004 7:08 AM, came the following characters from
the keyboard of Morbus Iff:

I'll tell ya what I'm doing, then tell ya how I'd like to streamline it. This is wishful thinking, really - I've not thought about it from an implementation standpoint, so certainly shoot me down fiercely.

I've got a rather simple script that
has three variables at the top:

  my $date   = "20040507";
  my $id     = "123";
  my $name   = "morbus";

For each .exe I need to create, those three variables change.
My current workflow is as you'd expect: change the three vars,
alt-tab, "pp -o 20040507-123-morbus script.pl", alt-tab, change
the three vars, etc., etc., etc. After doing this about two
hundred times over the last few weeks, I'd rather be doing
something else with my time.

20 lines? How about 6 executable lines? To build, use


workflow script 123 morbus

How about sticking the 3 values in a separate file? And then reading them in from the first file. Avoids "editing" the script.

You mention ".exe" so I assume your platform is Windows.

Given file script.pl:
   my $date = "foo"; # testing only -- will be replaced in .exe
   my $id = "bar"; # testing only -- will be replaced in .exe
   my $name = "baz"; # testing only -- will be replaced in .exe
   print "date: $date, id: $id, name: $name\n";

and file workflow.cmd:
   rem first parameter should be name of script  (script.pl)
   rem second parameter should be id of script
   rem third parameter should be script author name

   set mydate=%DATE:~-4%%DATE:~4,2%%DATE:~7,2%
   echo my $date="%mydate%"; > tempscript.pl
   echo my $id="%2"; >> tempscript.pl
   echo my $name="%3"; >> tempscript.pl
   perl -n -e "print  if $. > 3;" %1 >> tempscript.pl
   pp -o %mydate%-%2-%3.exe tempscript.pl

and issuing a command like:

workflow script.pl 123 morbus

20040507-123-morbus.exe produces:

date: 20040507, id: 123, name: morbus

--
Glenn -- http://nevcal.com/
===========================
The best part about procrastination is that you are never bored,
because you have all kinds of things that you should be doing.



Reply via email to