Michael Sims wrote:

>Recently we added a new application to what we provide that allows
>customers to sign up to receive new listing notifications based on a
>certain set of search criteria.  I was charged with the responsibility
>of creating this application.  I decided (for various reasons) to
>implement this application in Perl.

I think this decision lies at the heart of your trouble.

>As I was putting the Perl script together I realized that I was going
>to have to duplicate all of the business logic that existed in my PHP
>pages to build the SQL queries and display the results.

And this is why.

>I realized at this point that I would be really nice if the business
>logic that determines how to construct the queries and which bits of
>data to display were completely seperated from the presentation logic
>that existed in my PHP pages.

Yes, this is exactly what you should do. Design (redesign?) your Web 
application with a more modular approach. Make your business logic in 
separate modules. There is no need to use a different language for this, 
however, especially since your business logic is probably simple 
decision making based on information from a database.

>I have considered setting up a PHP page that runs on a seperate port.

Don't forget that PHP has a CLI (command line interface). For example, 
create a script like this:

#! /usr/bin/php -q
echo "PHP has a command line interface!";

Make it executable and execute it, just like a Perl script.

Basically, it's really easy to create multiple interfaces to the same 
business logic. Don't try to make things more complicated than 
necessary, and since there is no need to use multiple languages in your 
implementation, that is a complexity worth avoiding.

If your Web application utilizes a modular design, then all your PHP 
script has to do is include the appropriate business logic from your Web 
application. Then, you can set it up with cron or whatever to decide who 
needs to be emailed what.

Happy hacking.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to