[ic] Database Handle and Global Subs

Sheamus Nulty interchange-users@lists.akopia.com
Thu Jun 14 11:27:59 2001


----- Original Message -----
From: "Mark Johnson" <markj@redhat.com>
To: <interchange-users@developer.akopia.com>
Sent: 13 June 2001 21:49
Subject: Re: [ic] Database Handle and Global Subs


> Sheamus Nulty wrote:
> >
> > Mark,
> >
> > My problem is with the if statement because for some reason its just
> > printing what ever I put after it. If I put the following on a page and
run
> > it
> >
> > [pdfcreate foo="[cgi orders]"]
> >
> > my pdfs are generated. However if I do the following
> >
> > [set print]1[/set]
> > [if scratch print]
> > [pdfcreate foo="[cgi orders]"]
> > [/if]
> >
> > what gets returned in the browser is
> >
> > [pdfcreate foo="[cgi orders]"] as text and no pdfs are generated.
> >
> > Sheamus
> >
>
> I'm with you. I can't see anything wrong with that. Perhaps you could
> post the block of code that all relates to this so I can see if
> something around the code is causing problems. Generally speaking, the
> only reason you should see [pdfcreate...] as text is if that usertag
> isn't defined. But, if it's interpolating outside the if block, then
> clearly it's defined.
>
> If you get desperate, you can always recode your usertag to handle the
> if conditions internally. Something like:
>
> [set print]1[/set]
> [pdfcreate foo="[cgi orders]" scratchif=print]
>
> Then, in pdfcreate before any other code is executed (assuming you put
> the second param into the same-named scalar):
>
>  return undef unless $Scratch->{ $scratchif };
>
> I only say this because, frankly, I have no clue why an if block would
> keep IC tags from interpolating.
>


I'v setup the following. I have a global sub defined as follows in my
interchange.cfg file

GlobalSub <<EOF

sub pdfshea {

 my $counter=5;
 return "$counter";

}

EOF

I then run the following

[set print]1[/set]
[if scratch print]
[pdfshea]
[/if]

and it just prints out  [pdfshea] to the webpage. So I'm of the opinion that
[if] will just print out what comes after it .
If this is the case is my only alternative the solution you provided.

Thanks

Sheamus


> --
> Mark Johnson
> Senior Systems Architect - Professional Services
> Red Hat, Inc.
> E-Business Solutions
> markj@redhat.com
> 703-456-2912
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users
>