[ic] if file in 5.0 working ?

Mike Heins mike at perusion.com
Mon Mar 1 16:05:13 EST 2004

Quoting Jon (prtyof5 at attglobal.net):
> > I pulled this from the archives which used to work in 4.9.x but doesn't
> > seem to since 5.0
> >
> > With interchange markup it might look something like this
> >
> > [if type=file term="some_dir/some_dir/[item-code].jpg"]
> >  Yep it's here
> > [else]
> >  Nope it aint
> > [/else]
> > [/if]
> >
>    Is it just me that is having a problem with the above example ?
> Since you can't use straight perl test methods such as  if ( -e "file")
> from within IC I'm not sure what else to do to get around this
> problem.  Unless of course this is a problem for me alone.

Actually, you can do

	my $fn = 'catalog.cfg';
	if(-f $fn) {
		return "File exists.";
	else {
		return "File doesn't exist.";

The -f test is allowed by the SafeUntrap defaults. If you wanted
-e to work, I think you have to do:

    SafeUntrap  ftis

It is one of the things documented in "perldoc Opcode".

Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

Clothes make the man.  Naked people have little or no influence on
society.  -- Mark Twain

More information about the interchange-users mailing list