[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] QPQ/MacPerl problem (fwd)



According to Josh McCormack:
> 
> Is there a script that will make a Perl script MacPerl or the other way
> around?

Not that I know of.  However, there is the Proper Path (pp)
subroutine I wrote.  If you want it I will send it to you.
Don't want to post it again as I'm sure everyone is getting
a bit tired of seeing it.  :-)

If you get into the habit of consolidating where you define
what/where a particular file is (so long as all of them are
under one directory), then you shouldn't have quite so bad
of a problem with this.  What I mean by this is:

	Let's say you have fifty program files.  Let's also
	say that all of the files you are going to be
	working with are in one directory.  (Not an
	uncommon thing I've found.  Though there are MANY
	other instances where you will be moving a file
	from one directory to another too.) Then, you could
	have a single program called whatever you want (I
	use PP).  Then, when you are going to work with a
	particular file you just call the subroutine with
	the file name and it returns the proper path to get
	to that file.  This does a couple of things.
	First, it eliminates you having to remember what
	the proper path is.  Second, you don't have to
	retype the entire pathname each and every time you
	want to work with a file, and third, it helps one
	heck of a lot when you have to transfer programs
	from one computer type to another.  Because all you
	have to change is the directory pathname once and
	everything else is automatically changed when the
	call is made to the subroutine.  :-)

	.	.	.

As I was typing this up I got to thinking about Perl's
capabilities.  If I remember correctly, there is a Perl
GREP example in the Perl book.  You could use that to
create a program which first looks for a particular string
and then to change it.  I'm thinking that you might be able
to look for something like /(\w)\/(\w)/ (for Unix style
directory listings) and if it is found change it to
/$1\:$2/.  The only thing is - you'd have to do a two pass
check (I believe) because if you had
"my/directory/path/name" and you did a substitution then
even with the "g" option you'd still wind up with
"my:directory/path:name".  At least, without trying it,
that's what I think would happen.  Anyone else?

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch