Tag Archive: Framework

For all of you that enjoy working in Linux you may have run across a framework called Mason. Mason is a framework much like catalyst however I think it is much easier to use and less convoluted. It allows you to create objects to get a set data for a webpage. Now I know Perl has its drawbacks like any other language out there. What I do like about it though is that there is a vast library of modules out there that will do just about anything you want it to do.

With the addition of Mason framework, this allows you to create a more object-oriented site as well as create handlers to do some of the heavy lifting and leave Apache to do the HTML rendering. One thing I have used in conjunction with the Mason module, is a module called prototype. This allows you to add Ajax to your web page which gives you a rich user experience. Well I digress.

One thing i wanted to talk about here was how to add the handler to your apache configuration. This is fairly straight forward as any cgi handler is. One thing to make sure of is to have a directory (usually called data) for the caching of the objects to be placed. Another directory you would need to make sure of is to assign the component root so that Mason knows where to start looking for components when called.

Now one trick I found was that I usually create a sub folder in the web root for all my components to go to, but when I use this directory as my component root my AutoHandler does not work and assist with processing the pages correctly. So what is a AutoHandler? it is a page much like Application.cfm or .cfc is for ColdFusion to instantiate your application and set global, session and other variables. The AutoHandler allows you to set up your database connection object along with setup any processing that you would need to be done each time a page is called within the application.

So being that the AutoHandler needs to be run, one thing I have done was to set my component root equal to the root of my application. Now I believe you can add the AutoHandler to apache as the primary cgi handler much like you would add perl as a handler of .pl files. However for the sake of testing and flexibility I found that just using your root as the component root, works just as easy. Now I still use a subfolder to contain all my components, I just need to make sure in the path defined for the component, that I specify the folder it is in. not such a big deal to me.

Other than that, all you need is to set your PerlHandler equal to HTML::Mason::ApacheHandler and possibly use PerlAddVar to set global variables to be persistent. Below is a sample setup I have made for you to see a possible scenario of setting up Mason as the Perl web framework.

This afternoon I attempted to start a site on one of my servers that would be used to run .NET 4.0x framework on it. Now I checked and made sure that the Framework was installed. I also checked to make sure my application pool was set to use the framework. However I did notice that the ASP isapi that processes the commands in the Handlers section was still only running the framework 2.0 version. So I switched them over to use the 4.0 and lo and behold it still did not work. Fear not, below is the fix if you are still running into this.

Run this in the command line of the server. Adjust the directory accordingly to fit where ever the 4.0 version is installed on your PC.

Run this first

Then make sure that your .NET framework is set to allowed in ISAPI and CGI Restrictions by clicking on your server name in IIS manager on the left navigation panel, then click on ISAPI and CGI Restrictions under the IIS section. Once aspx is allowed to run the 4.0 framework your application should work!.

%d bloggers like this: