chrisgraber has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I need to convert a site written with .hts files. The site will use Solaris and a MySQL database instead of Sybase, and .hts files will not be usable. I want to use standard HTML or PHP files, but keep most of the inline Perl code intact (as much as possible!).

http://stti-web.iupui.edu/websql.dir/docs/pguide/progr_6.htm#HEADING8-0 is a good doc about using Perl in HTS files

I am wondering what a good way to accomplish this is? Embperl?

Chris - nobertos@yahoo.com

  • Comment on Help with .hts (sybase "html" files w/inline perl)

Replies are listed 'Best First'.
Re: Help with .hts (sybase "html" files w/inline perl)
by liz (Monsignor) on Sep 16, 2003 at 07:33 UTC
    Depending on the number of .hts files that need to be converted, I'd go with either of the following:

    • one of the standard Perl templating solutions (and I'm not going to name them because the all have their pro's and con's, which I can't really apply because I don't know enough about your situation).

    • Write a custom mod_perl handler that mimics SybPerl that you're using now (a drop in replacement if you will). Taking out <SYB></SYB> sections out of HTML and evalling them is not such a big thing (apart from certain security implications, but those existed already in your current solution). And writing replacements for the ws_xxx functions shouldn't be such a big problem (with exception of ws_rpc probably, but that's because that accesses functionality that you won't find in MySQL).

    If the number of .hts files in in the 10's or 20's, I would go for the first. If there are more than 100 .hts files to convert, I would probably go for the latter. If the number is inbetween, I wouldn't know.

    One note of warning: Sybperl was basically Perl 4 if I remember correctly. You might encounter some odd problems when converting to a "recent" Perl.

    Hope this helps.

    Liz

      Howdy!

      Liz wrote:

      One note of warning: Sybperl was basically Perl 4 if I remember correctly. You might encounter some odd problems when converting to a "recent" Perl.

      "Sybperl" is the non-DBI Sybase-Perl interface mpeppler wrote (and which rocks!). The .hts stuff is "websql", something that Sybase marketed for a while that was Perl 5 based, but it included its own copy of Perl and it was a low-numbered Perl 5, as I recall.

      yours,
      Michael

        The site has about 85 .hts files. The files access a database and text files.

        I know some of my options are listed above, but I don't have experience with mod_perl etc. I am a low level Perl coder so I don't want to have to reinvent the wheel! I'd like to be able to semi-seamlessly plop the code into new pages.

        I posted a sample (right click his link) file at http://www.cjgdev.com/sample_file.hts

        Do these files use the Sybperl you talked about? I see SYB tags in them. I.e. does Sybperl = SYB?

        Help! Chris

Re: Help with .hts (sybase "html" files w/inline perl)
by mpeppler (Vicar) on Sep 16, 2003 at 17:52 UTC
    WebSQL is a Sybase product based on perl and Sybperl 2.x (really, the Sybase::CTlib module). It's a product first released in early 1996, so the version of perl that it uses is very old (5.001m IIRC) and a similarly ancient version of Sybase::CTlib. I seem to remember someone mentioning an Apache::WebSql module that worked with modperl and that let you use .hts files without modifications, although last time I checked a couldn't find it on CPAN.

    It should be feasible to adapt one of the current HTML templating systems to handle the <SYB> tags, although getting that to work right might really be more work than just porting the whole thing to PHP, as that appears to be your real target platform. In any case you'll have to adapt the Sybase calls to DBI calls so that it will work with MySQL.

    Michael

      Thanks for the input.

      Sounds like getting the old perl code to work within a new system would be rather difficult. What about this scenario? The people I might do the work for just want to get rid of the ancient machine the .hts files run on. But now they don't want to convert the code to PHP (too much work). They don't know anything about what keeps the files working (Sybase related things) though. Might it be possible to move the code to a Solaris box and have it still function? What pieces are needed in order for the .hts code to work?

      Do you think I should I check on CPAN for that Apache module?

      Then there's also the other issue of using a mySQL db instead. To me, that doesn't seem to be possible, since all the inline perl code in the hts pages uses special ways of accessing the database. Am I crazy?

      Chris

        The easy solution would be to find a Solaris version of Web.SQL and use that. However, that may be difficult to find. The Apache::WebSQL module is listed on CPAN in the module list, but it's not found on search.cpan.org. You may need to contact the author to see if there is something that you could use.

        If the client still has the Sybase server on their net then I'd skip porting to MySQL as simply unnecessary at this point. Michael