pas-dev Mailing List for Perl Application Server (Page 2)
Status: Beta
Brought to you by:
mortis
You can subscribe to this list here.
2002 |
Jan
|
Feb
(6) |
Mar
(19) |
Apr
(3) |
May
(147) |
Jun
(6) |
Jul
(4) |
Aug
(12) |
Sep
(1) |
Oct
(12) |
Nov
(23) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(4) |
Feb
(12) |
Mar
(13) |
Apr
(16) |
May
(28) |
Jun
(9) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(84) |
Dec
(25) |
2004 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(5) |
Oct
|
Nov
|
Dec
|
From: Justin B. <ju...@le...> - 2004-01-26 23:59:45
|
>> After reviewing the code more last night, the include file directive >> could almost be made to happen at runtime... we'd just need access to >> a compiler (isn't it already there in the RequestHandler?). The >> resolveIncludeFile method could be moved to Org::Bgw::Pas::Page.pm or >> Org::Bgw::Pas::Base.pm. That method would pretty much remain the same >> except it would compile the file it finds and return the results. > > If you're talking about resolving includes every time a page is > accessed, you should also keep in mind that that is counter to the point > of mod_perl, and in some circumstances the compiled pages will be in > memory as a previous version already. > > I think you might be suprised at runtime by certain undesired behavior. Considering the majority of the content of the included pages will be executed at runtime... I'd say I have the blinders on. :) I guess then what I'm asking for is a dynamic include vs the static include. Just like in JSP's: -- With JSP, there are two different kinds of content to include: static and dynamic. The include directive shown here: <%@ include file="include/copyright.inc" %> includes the source of the target page at translation/compile time. Therefore, it's not possible to include runtime content using the include directive. The JSP include directive treats a resource as a static object, and the context of the resource is included literally in the page. In direct contrast, the include action shown here: <jsp:include page="include/copyright.inc"/> handles the resource as a dynamic object. The request is sent to the resource, and the result of the processing is included. Templates use a dynamic approach so that runtime expressions can be evaluated and included. -- More on the <jsp:include> tag: http://java.sun.com/products/jsp/tags/11/syntaxref1112.html That's what I'm basically looking for/to do. Where you can pass an expression as the page name. And just for reference: http://java.sun.com/products/jsp/tags/11/syntaxref117.html#8772 (Include directive) > You could always do as kyle mentioned jsp does and use a uri style > include, or you could forward to a different psp based on the $criteria > in the page. I'd like to keep maintenance to a minimum therefore I would rather not completely copy an entire page like I would have to do with a forward. I'd rather have more of the flexibility of Jakarta Stuts in particular Tiles: http://jakarta.apache.org/struts/userGuide/dev_tiles.html I'm basically talking about solution 5 on this page: http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html. I'd like to reduce the coupling between common view components and content bodies. This not only helps reduce maintenance under one instance but also across instances. It would also allow clients to have a little more freedom for body content or even layout w/o significantly impacting maintenance and even development time. > Just some half baked ideas. Would we expect any less? :) If we add a new tag that has the similar functionality as <jsp:include> (at least the dynamic part) we'd at least be moving towards the direction of Tiles. Using the configuration file to choose the right layout and page and the page object have the ability to override those choices is a nice start, IMO. Maybe not ideal or as straight forward, but after working with Jakarta Struts and Tiles, I wouldn't consider that straight forward either. Justin |
From: Mental P. <me...@ne...> - 2004-01-26 21:40:05
|
Justin Bedard wrote: > > After reviewing the code more last night, the include file directive > could almost be made to happen at runtime... we'd just need access to > a compiler (isn't it already there in the RequestHandler?). The > resolveIncludeFile method could be moved to Org::Bgw::Pas::Page.pm or > Org::Bgw::Pas::Base.pm. That method would pretty much remain the same > except it would compile the file it finds and return the results. > If you're talking about resolving includes every time a page is accessed, you should also keep in mind that that is counter to the point of mod_perl, and in some circumstances the compiled pages will be in memory as a previous version already. I think you might be suprised at runtime by certain undesired behavior. You could always do as kyle mentioned jsp does and use a uri style include, or you could forward to a different psp based on the $criteria in the page. Just some half baked ideas. |
From: Justin B. <ju...@le...> - 2004-01-26 15:14:42
|
>>i've been poking around the compiler trying to figure out why this >>doesn't work: >> >><% my $filename = $self->config->get('pspFileName'); %> >><%@ include file="$filename" %> > > > PSP directives (things that start with %@, like 'include file') are > resolved at compile time. File inclusions are expanded during > compilation, the file referenced is inserted into the text of the PSP > as if you wrote it directly into the PSP file. Once all the > directives are resolved, then the code for the page object is emitted. A couple of print statments later and I was able to finally see this. > Tags like expressions (<%= %>) and code (<% %>) tags are what become > part of the code of the generated page object. So they don't get > 'run' until the page object's execute() method is invoked. > > Does that make sense? Yup. >>$filename doesn't get translated and the compiler complains that it's >>can't find a file named '$filename'. > > Exactly, there is no evaluation or execution of the referenced file > name in include directives. I see that now. > Run-time inclusion is not part of the <%@ include file ... %> > directive. > > What exactly are you after with the run-time inclusion? JSP handles > it with a taglet, something like: > > <psp:include uri="/u/r/i"> > <psp:arg name="foo" value="baz" /> > <psp:arg name="bar" value="qux" /> > </psp:include> > > It uses a 'uri' for an important reason. In JSP, that taglet actually > causes the system to execute the code pointed to by the uri as an HTTP > request, passing in the specified parameters as a query string (or as > post-data if you specify that the request should be a POST). It's not > an include in the sense of code inclusion, or in the sense of a > method-call, it's including the output produced by the referenced uri. I want to be able to include a specific snippet of code dependent on a parameter in the configuration file. In the sales force application that we've worked on, we have multiple sites running on a single code base. What if a client wants a little different look to a page? Instead of completely duplicating the page like we have been when this case arises, I'd rather just grab what file gets included from the config file and run with it. If we can do this then the system can be more template based where a client could even choose a different layout instead of being restricted to a single layout. After reviewing the code more last night, the include file directive could almost be made to happen at runtime... we'd just need access to a compiler (isn't it already there in the RequestHandler?). The resolveIncludeFile method could be moved to Org::Bgw::Pas::Page.pm or Org::Bgw::Pas::Base.pm. That method would pretty much remain the same except it would compile the file it finds and return the results. Justin |
From: Kyle R. B. <mo...@vo...> - 2004-01-26 14:04:00
|
I hope it's ok that I'm CC'ing the pas-dev list, I think this discussion is important. > i've been poking around the compiler trying to figure out why this > doesn't work: > > <% my $filename = $self->config->get('pspFileName'); %> > <%@ include file="$filename" %> PSP directives (things that start with %@, like 'include file') are resolved at compile time. File inclusions are expanded during compilation, the file referenced is inserted into the text of the PSP as if you wrote it directly into the PSP file. Once all the directives are resolved, then the code for the page object is emitted. Tags like expressions (<%= %>) and code (<% %>) tags are what become part of the code of the generated page object. So they don't get 'run' until the page object's execute() method is invoked. Does that make sense? > $filename doesn't get translated and the compiler complains that it's > can't find a file named '$filename'. Exactly, there is no evaluation or execution of the referenced file name in include directives. Run-time inclusion is not part of the <%@ include file ... %> directive. What exactly are you after with the run-time inclusion? JSP handles it with a taglet, something like: <psp:include uri="/u/r/i"> <psp:arg name="foo" value="baz" /> <psp:arg name="bar" value="qux" /> </psp:include> It uses a 'uri' for an important reason. In JSP, that taglet actually causes the system to execute the code pointed to by the uri as an HTTP request, passing in the specified parameters as a query string (or as post-data if you specify that the request should be a POST). It's not an include in the sense of code inclusion, or in the sense of a method-call, it's including the output produced by the referenced uri. Kyle -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Kyle R. B. <mo...@us...> - 2003-12-19 14:41:55
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Plint In directory sc8-pr-cvs1:/tmp/cvs-serv23397/src/Org/Bgw/Plint Modified Files: CoreChecker.pm Log Message: fixed eval check to be better about eval occurring in stings, regexes and documentation |
From: Kyle R. B. <mo...@us...> - 2003-12-17 16:44:06
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Plint In directory sc8-pr-cvs1:/tmp/cvs-serv18427/src/Org/Bgw/Plint Modified Files: CoreChecker.pm Log Message: added checks for case preferences with variable declarations, and for short variable names |
From: Kyle R. B. <mo...@us...> - 2003-12-11 14:44:43
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Plint In directory sc8-pr-cvs1:/tmp/cvs-serv13755/src/Org/Bgw/Plint Modified Files: CoreChecker.pm Log Message: added alternate representation of module version |
From: Kyle R. B. <mo...@us...> - 2003-12-11 14:39:15
|
Update of /cvsroot/pas/pas In directory sc8-pr-cvs1:/tmp/cvs-serv12497 Modified Files: TODO Log Message: added notes for new check for module/path |
From: Kyle R. B. <mo...@vo...> - 2003-12-11 14:37:37
|
Since Plint was created, I've started to use it more and more to give a quality analysis of the code I'm working on. It has repeatedly helped me catch things like typos and omissions in my code. It has helped me make a significantly smaller amount of mistakes, and to make sure the code I'm working on is more robust (compiles, has strict/warnings, a basic unit test, etc). I'd like to throw out a few new ideas and solicit feedback from the list. I'd like to enhance Plint in a few ways: - move to an object based Check system - where all checks are a single object derived from Org::Bgw::Plint::Check and only implement a single type of check. This provides the groundwork for other enhancements I'm thinking about - it was also originally proposed by Mental. - Create a FileStatus (or ModuleInfo) object to accumulate the information about a module: . the checks that it has passed . the checks that it has failed o the reasons for failure (could be a list, for instance, of the methods that are missing api pod, or the locations of the errors that caused failure) . the checks that could not be run for it (including reasons if appropriate) . the checks that were ignored for it (including reasons if appropriate) . cached information about the module, like whether it exists, what methods are present, a cached copy of the sources, of the stripped sources, and other appropriate details. The checks should be able to populate this cache, and should use it as their primary source of information - that way expensive operations can be amotorized across all the checks. - Create Report objects, by default the plint command line program would become a simple driver that loaded the checks, ran them across files and invoked a simple reporter object to print to the console. The FileStatus/ModuleInfo object would then be the primary thing a reporter had to work with - it should then be easy to develop simple (console/text) reports and fancier reports (html? - integrated with unit test output and a generated documentation pack?) - I'd like to implement a method analysis checker. Something that could look for perl code that looked like method calls and verify that the method names existed somewhere - maybe this is the start of type analysis - if a method name is somewhat unique, the type of the object it is invoked on could be inferred just by analyzing the sources. Regardless, it should be possible to avoid the method name typo issue in 99% of cases. If types for variables are either declared in the sources, or could be inferred, then the location of the method and potentially argument analysis could be done as well. Any thoughts? Kyle -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Kyle R. B. <mo...@us...> - 2003-12-11 14:24:08
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Plint In directory sc8-pr-cvs1:/tmp/cvs-serv9314/src/Org/Bgw/Plint Modified Files: CoreChecker.pm Log Message: added mouleHasVersion check |
From: Kyle R. B. <mo...@us...> - 2003-12-10 23:19:40
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Plint In directory sc8-pr-cvs1:/tmp/cvs-serv27032/src/Org/Bgw/Plint Modified Files: CoreChecker.pm Log Message: ignore files for the unit test if they're already a test |
From: Kyle R. B. <mo...@us...> - 2003-12-09 21:24:43
|
Update of /cvsroot/pas/pas/bin In directory sc8-pr-cvs1:/tmp/cvs-serv22651/bin Modified Files: plint Log Message: minor fix for ignore pfxs |
From: Kyle R. B. <mo...@us...> - 2003-12-09 21:11:48
|
Update of /cvsroot/pas/pas In directory sc8-pr-cvs1:/tmp/cvs-serv20236 Modified Files: TODO Log Message: more todo and new plint check |
From: Kyle R. B. <mo...@us...> - 2003-12-09 21:11:48
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Plint In directory sc8-pr-cvs1:/tmp/cvs-serv20236/src/Org/Bgw/Plint Modified Files: CoreChecker.pm Log Message: more todo and new plint check |
From: Jason S. <fa...@us...> - 2003-12-09 17:47:24
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas In directory sc8-pr-cvs1:/tmp/cvs-serv9536/src/Org/Bgw/Pas Modified Files: Session.pm Log Message: fixed parent for session pages |
From: Jason S. <fa...@us...> - 2003-12-09 16:32:56
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas In directory sc8-pr-cvs1:/tmp/cvs-serv28274/src/Org/Bgw/Pas Modified Files: Page.pm RequestHandler.pm Log Message: forgot to 'use' baseclass... oops. |
From: Jason S. <fa...@us...> - 2003-12-09 16:32:56
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas/Psp In directory sc8-pr-cvs1:/tmp/cvs-serv28274/src/Org/Bgw/Pas/Psp Modified Files: Compiler.pm Log Message: forgot to 'use' baseclass... oops. |
From: Jason S. <fa...@us...> - 2003-12-09 16:23:40
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas/Psp In directory sc8-pr-cvs1:/tmp/cvs-serv25878/src/Org/Bgw/Pas/Psp Modified Files: Compiler.pm Log Message: changed parent classes as config has been refactored into Org::Bgw::Pas::Base (from Org::Bgw::Base) |
From: Jason S. <fa...@us...> - 2003-12-09 16:23:40
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas In directory sc8-pr-cvs1:/tmp/cvs-serv25878/src/Org/Bgw/Pas Modified Files: Page.pm RequestHandler.pm Log Message: changed parent classes as config has been refactored into Org::Bgw::Pas::Base (from Org::Bgw::Base) |
From: Jason S. <fa...@us...> - 2003-12-08 22:41:46
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas/Psp In directory sc8-pr-cvs1:/tmp/cvs-serv17687/src/Org/Bgw/Pas/Psp Modified Files: Compiler.pm Log Message: fixed typo'd method only found if $Log->debug was true |
From: Jason S. <fa...@us...> - 2003-12-08 22:41:46
|
Update of /cvsroot/pas/pas/src/Org/Bgw/HTTP/Header In directory sc8-pr-cvs1:/tmp/cvs-serv17687/src/Org/Bgw/HTTP/Header Modified Files: Request.pm Log Message: fixed typo'd method only found if $Log->debug was true |
From: Jason S. <fa...@us...> - 2003-12-08 22:41:46
|
Update of /cvsroot/pas/pas/src/Org/Bgw/HTTP In directory sc8-pr-cvs1:/tmp/cvs-serv17687/src/Org/Bgw/HTTP Modified Files: Header.pm Proxy.pm Log Message: fixed typo'd method only found if $Log->debug was true |
From: Kyle R. B. <mo...@us...> - 2003-12-08 14:24:41
|
Update of /cvsroot/pas/pas In directory sc8-pr-cvs1:/tmp/cvs-serv13545 Modified Files: TODO Log Message: added more notes about documentation ideas |
From: Kyle R. B. <mo...@us...> - 2003-12-05 23:20:38
|
Update of /cvsroot/pas/pas In directory sc8-pr-cvs1:/tmp/cvs-serv28492 Modified Files: TODO Log Message: todo additions re:plint and documentation |
From: Kyle R. B. <mo...@us...> - 2003-12-05 19:44:23
|
Update of /cvsroot/pas/pas In directory sc8-pr-cvs1:/tmp/cvs-serv15486 Modified Files: TODO Log Message: todo additions re:plint and documentation |