pas-dev Mailing List for Perl Application Server (Page 9)
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: Mental P. <me...@ne...> - 2003-03-26 19:11:57
|
Wow, you're a busy guy over there :) Regarding the last 3 proposals... it always takes me a little bit to really 'get it', but I like the simple execute method generation. Sites with a lot of similar page objects spring to mind. Seems like a waste to write the same if() else() blocks all the time. I completely understand the need for compile time code generation too. As an add on, I'd like to also point out that in addition to the compile time code building, taglibs would be a nice to have also. They're obviously for very different purposes, but would compliment each other nicely.=20 I'm not completely on board with the parameter map idea. If you ask me, its just asking for a steeper maintenence curve. The autogen of getsets can be difficult enough to map out at times. This comes back in some ways to reasons we deprecated $self->prev and the coupling of page objects to psp's. Maybe I'm too reliant on ctags tho. I dont think its a _bad_ idea, I just think worst case sometimes. I'm not completely sold on why you'd want to couple the query object to the page file in the first place. I can understand the convenience of it. The automagic name scrubing was a great example of why its good. The ramp up time of someone not familiar with the technique may very well be short enough to be a non-issue. Guess I'll just think on it a little and see.... So, what are your thoughts on the order you'd want to do this in? I wish I had more time to contribute to this stuff...=20 --=20 Mental Patient <me...@ne...> |
From: Kyle R . B. <mo...@vo...> - 2003-03-26 14:48:58
|
package Com::Domain::Site::Login; use strict; use warnings; use Org::Bgw::Pas::Page; our @ISA = qw( Org::Bgw::Pas::Page ); Com::Domain::Site::Basket->installExecuteSwitch( 'param' => 'action', 'map' => { 'default' => 'showLoginForm', 'login' => 'handleUserLoggingIn', 'logout' => 'handleUserLoggingOut', } ); # that code would then create your execute method for you. The method looks like # this: # sub execute # { # my($self) = @_; # unless( defined( $self->query->param('action') ) ) { # return $self->showLoginForm; # } # return $self->handleUserLoggingIn if 'login' eq $self->query->param('action') ; # return $self->handleUserLoggingOut if 'logout' eq $self->query->param('action') ; # } # # 'action' could have been any parameter that your HTML pages pass to # the page object to switch it's behavior (this is a commonly used technique # when you want the page to act differently based on an input parameter). # now you don't even need an execute method, these methods will just # get called when the corresponding action is encountered! sub showLoginForm { my($self) = @_; return $self->forward_request('loginForm.psp'); } sub handleUserLoggingIn { my($self) = @_; # do whatever it means to log in on your site... return $self->response->set_redirect('/pas/Main'); } sub handleUserLoggingOut { my($self) = @_; # do whatever it means to log out on your site... return $self->forward_request('loggedOut.psp'); } 1; -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Kyle R . B. <mo...@vo...> - 2003-03-26 14:22:14
|
package Com::Domain::Site::AccountSetup; use strict; use warnings; use Org::Bgw::Pas::Page; our @ISA = qw( Org::Bgw::Pas::Page ); Com::Domain::Site::AccountSetup->buildRequestParameterMap( 'first_name' => 'firstName', 'last_name' => 'lastName', 'middle' => 'middleName', ); # buildRequestParameterMap would do a few things, first it would use the # values of the passed pairs and effectivly call: # Com::Domain::Site::AccountSetup->makeGetSetMethods(qw( firstName lastName )); # for you. Second, it sets up a method (that will be called from # SUPER::request_init that moves parameters from the request object into # your object's get/set methods. sub execute { my($self) = @_; # now just use the params! they're already available in your get/set # methods } ######################################## ######################################## # # extension 1, allow for 'scurbbing' or mutating to take place: # Com::Domain::Site::AccountSetup->buildRequestParameterMap( 'first_name' => { 'slot' => 'firstName', 'mutator' => 'scrubName' }, 'last_name' => { 'slot' => 'lastName', 'mutator' => 'scrubName' }, 'middle' => { 'slot' => 'middleName', 'mutator' => 'scrubName' }, ); # this gets called for each defined param that has this method # as it's mutator - then the data returned by this method is # assigned to the appropriate get/set method (which again are # automatically created based on the 'slot' values from the mapping). sub scrubName { my($self,$data) = @_; $data =~ s/\d+//; return $data; } sub execute { my($self) = @_; # now just use the params! they're already available in your get/set # methods, and they've been passed through the scrubbing methods } -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Kyle R . B. <mo...@vo...> - 2003-03-25 16:00:56
|
Some new PSP tags for advanced users. First, some background. In many of the sites I've done with Pas using PSP, I've written code that generates HTML because it's easier for me if the HTML is generated, but not really necessary to have it be dynamic at run-time. I.e. there is nothing in the generated HTML that relies on query specific data/parameters. If there were some kind of macro system, I would have used that in it's place. So that's what I'm proposing, a type of macro-system to pre-execute some of the code in the PSP. Sections marked in this way will be resolved during the compilation of the PSP code. There are several benefits, and side-effects to this. The new tags might be <%& %> and <%&= %> - I beleive an ampersand modifier might be available. These sections would then be executed as they were encountered in the page during compilaiton. The #line advantage that PSP has over some of the other templating systems should still hold by the way. Within these sections, $self could be an instance of the parent object of the PSP/page (because we're compiling the page, the object that represents the actual page wouldn't be availble until compilation was finished, so the closest thing we can offerr is the parent) - what ever is declared in the <%@ page extends = "xyz" %> tag(s). That instance would be constructed with an empty query object, but not have it's request_init method called. These code blocks could then be used to produce HTML (or even generate PSP code for that matter, which is one of the side-effects of implementing this) at compile time - so you can have a highly refactored presentation layer. In one applicaiton, we are using psp code to genreate some of our forms, since they all have the same look and feel, but only differ in the labels and names of the form elements, so instead of incurring the penalty of that code executing at run-time, we could use this type of system to resolve it at compile time: <%& my $formSpec = FormSpec->new; $formSpec->method('POST'); $formSpec->action('/pas/mySite/FormHandler'); $formSpec->addTextField( 'First Name', '-name' => 'firstName', '-size' => 20, ); $formSpec->addTextField( 'Last Name', '-name' => 'firstName', '-size' => 20, ); %> <FORM METHOD="<%&= $formSpec->method %>" ACTION="<%&= $formSpec->action %>"> <%& foreach my $elem ( $formSpec->formElements ) { %> <%&= $elem->name %>: <%= $self->query-><%&= $elem->elemType %>( <%&= $elem->elemArgs %> ) %> <BR> <%& } %> </FORM> Would be resolved to: <FORM METHOD="POST" ACTION="/pas/mySite/FormHandler"> First Name: <%= $self->query->textfield( -name => 'firstName', -size => 20 ) %> <BR> Last Name: <%= $self->query->textfield( -name => 'lastName', -size => 20 ) %> <BR> </FORM> This is obviously a somewhat contrived example, but it should serve to illustrate the concept. A more basic example might be a refactored site that has the start, or header of a page in an include file: <!-- in _header.psp --> <HTML> <HEAD> <TITLE><%&= $Page::title %></TITLE> </HEAD> <BODY BGCOLOR="<%&= $Page::bgcolor %>"> <!-- in index.psp --> <%& $Page::title = 'My Site - Main Page'; $Page::bgcolor = '#FFFFFF'; %> <%@ include file = "_header.psp" %> <!-- the main body goes here... --> <%@ include file = "_footer.psp" %> Which would resolve to a compile PSP page that looked like this: <HTML> <HEAD> <TITLE>My Site - Main Page</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> ... In many of the sites I've worked on, this could be used to refactor the presentation layer to make it easier for the site designers/developers to introduce common look and feel to the pages. In many cases, this could also be used as a significant optmization technique to cut down on the overhead of generating a page -- it could greatly reduce the run-time costs of large portions of the pages that are currently dynamically generated from PSP/Perl code. I beleive I can see how to implement this in the compiler without a huge amount of effort. I think the benefits would be huge. Thoughts/Feedback/Comments? Kyle -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Kyle R. B. <mo...@us...> - 2003-03-17 19:44:03
|
Update of /cvsroot/pas/pas/src/Org/Bgw/HTTP In directory sc8-pr-cvs1:/tmp/cvs-serv30003a/src/Org/Bgw/HTTP Modified Files: Proxy.pm Log Message: proxy enhancements |
From: Kyle R. B. <mo...@us...> - 2003-03-17 19:41:02
|
Update of /cvsroot/pas/pas/src/Org/Bgw/HTTP/Proxy In directory sc8-pr-cvs1:/tmp/cvs-serv28832/src/Org/Bgw/HTTP/Proxy Modified Files: BufferedSocket.pm Log Message: proxy enhancements |
From: Kyle R. B. <mo...@us...> - 2003-03-17 19:41:02
|
Update of /cvsroot/pas/pas/src/Org/Bgw/HTTP In directory sc8-pr-cvs1:/tmp/cvs-serv28832/src/Org/Bgw/HTTP Modified Files: Proxy.pm Log Message: proxy enhancements |
From: Kyle H. <kh...@qu...> - 2003-02-27 17:29:17
|
On Thursday 27 February 2003 06:44, Kyle R . Burton wrote: > I just saw what you mean about 3.0.18 - the release name is pas-3.0.18, > but the .tar.gz file is named 3.0.8. Regardless, I just released the > latest version [3.0.19], which I'd recommend you use. The new code seems to have done the trick. I am now getting sessions that work. Both Example 2 and the temperature conversion page work correctly now. Thanks! Now, I just have to build something with it :-) Best, Kyle |
From: Kyle R . B. <mo...@vo...> - 2003-02-27 14:44:33
|
> I'm attempting to set up PAS. So far, PAS looks like the right > balance of functionality and simplicity. > > I've got PAS working, mostly. > > I'm using: > > SuSE Linux 8.0 for x86 > Apache 1.3.23 (patched heavily for security problems) > mod_perl 1.26 > Perl 5.6.1 > PAS 3.0.16 (cannot download 3.0.18 from Source Forge) I just saw what you mean about 3.0.18 - the release name is pas-3.0.18, but the .tar.gz file is named 3.0.8. Regardless, I just released the latest version [3.0.19], which I'd recommend you use. > I've installed PAS into /opt/pas. > > All the examples function to the extent that they mostly do the right thing. > So far, the only thing that appears to be not working are sessions. I can > see the session files being created in /opt/pas/session-cache. But, on pages > that have session data, I am getting a new one each time. > > For example, Example 2 (sets a timestamp in a session on first use) always > says "this was the first time you've visited this page,..." and has a new > timestamp for both the current time and session time each time. > > Did I miss something in the config somewhere? Perhaps. In older versions of Pas, you had to set the cookie domain in the pas.conf file. The scenario that I think is happening is that Pas is issuing a cookie for a domain/hostname that is different from what you are accessing the site as. If you are accessing your website as http://localhost/, but [the version of Pas you are using] thinks that the site's name is 'foo.bar.com', Pas is trying to set the cookie with that name, and the browser is refusing to send it back with the next request (which is proper behavior for the browser). Newer versions of Pas default to seting the cookie's domain based on the environment (Apache) variable SERVER_NAME, which should match the hostname that the web-browser accessed the site as. If pas.sid.cookie.domain is set in the configuration file, it will override the value of SERVER_NAME, so the current recommended practice is to not set that value unless you're having trouble. I'm not sure what the situation is, but those are some of the issues I've run into with cookies in the past. > Oddly enough, I _am_ getting session cookies. I've turned on cookie warnings > in Mozilla and I am getting cookies sent to me. However, all the example > pages act as if there was no session cookie. Does the hostname in Mozilla's location bar match the domain the cookie is being set for? That's my best guess. Kyle -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Kyle R . B. <mo...@vo...> - 2003-02-27 14:44:33
|
> The links on Source Forge have 3.0._8_. Where can I get 3.0.18? When I go to the SF project summary page: http://sourceforge.net/projects/pas/ The 3.0.18 release is available for download. The project website links to the SF project summary page. In the archived downloads area of the project website there is also a copy of 3.0.18. I'll update the project website's main page to include a download link that takes you to the files page. I'm not sure where you were looking, but I can find the latest version on SourceForge's site. I added a download link to the project website that links directly to the files area. I'll be getting to your other email in a minute... Kyle -- ------------------------------------------------------------------------------ Wisdom and Compassion are inseparable. -- Christmas Humphreys mo...@vo... http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ |
From: Kyle R. B. <mo...@us...> - 2003-02-27 14:25:56
|
Update of /cvsroot/pas/pas In directory sc8-pr-cvs1:/tmp/cvs-serv24038 Modified Files: ChangeLog Log Message: updated changelog for 3.0.19 |
From: Mental <Me...@Ne...> - 2003-02-27 03:29:30
|
On Wed, Feb 26, 2003 at 07:02:28PM -0800, Kyle Hayes wrote: <snip> >=20 > All the examples function to the extent that they mostly do the right thi= ng. > So far, the only thing that appears to be not working are sessions. I can > see the session files being created in /opt/pas/session-cache. But, on p= ages > that have session data, I am getting a new one each time. >=20 > For example, Example 2 (sets a timestamp in a session on first use) always > says "this was the first time you've visited this page,..." and has a new > timestamp for both the current time and session time each time. >=20 > Did I miss something in the config somewhere? >=20 > Oddly enough, I _am_ getting session cookies. I've turned on cookie warni= ngs > in Mozilla and I am getting cookies sent to me. However, all the example= =20 > pages act as if there was no session cookie. >=20 > Any clues? If I had to hazard a guess, I'd say your psp isnt a session page. Org::Bgw::Pas::Psp::Compiler pod: session <%@ page session =3D "true|false"; %. This directive controls session behavior. Unless overridden by the implements directive, this directive will set the parent object of the generated PSP page as Org::Bgw::Pas::SessionPage allowing access to a session() method. It will also make a $session vari- able available to the psp page. IF you're getting a session cookie, and you see the sessions being created in a database/file/whatever, then the only thing I can think of that'd make sense (and I've done it to) is you're not telling the psp that it's a sessionpage.... HTH -- Mental (Me...@Ne...) I choose to live and to Lie, kill and give and to Die, learn and love and to Do what it takes to step through. --Tool "46 & 2" CARPE NOCTEM, QUAM MINIMUM CREDULA POSTERO. GPG public key: http://www.neverlight.com/pas/Mental.asc |
From: Kyle H. <kh...@qu...> - 2003-02-27 03:02:39
|
I'm attempting to set up PAS. So far, PAS looks like the right balance of functionality and simplicity. I've got PAS working, mostly. =20 I'm using: SuSE Linux 8.0 for x86 Apache =09 1.3.23 (patched heavily for security problems) mod_perl 1.26 Perl =09 5.6.1 PAS=09 3.0.16 (cannot download 3.0.18 from Source Forge) I've installed PAS into /opt/pas. All the examples function to the extent that they mostly do the right thi= ng. So far, the only thing that appears to be not working are sessions. I ca= n see the session files being created in /opt/pas/session-cache. But, on p= ages that have session data, I am getting a new one each time. For example, Example 2 (sets a timestamp in a session on first use) alway= s says "this was the first time you've visited this page,..." and has a new timestamp for both the current time and session time each time. Did I miss something in the config somewhere? Oddly enough, I _am_ getting session cookies. I've turned on cookie warni= ngs in Mozilla and I am getting cookies sent to me. However, all the example= =20 pages act as if there was no session cookie. Any clues? Best, Kyle |
From: Kyle H. <kh...@qu...> - 2003-02-27 02:26:54
|
The links on Source Forge have 3.0._8_. Where can I get 3.0.18? Best, Kyle |
From: Justin B. <j0...@us...> - 2003-02-19 15:36:37
|
Update of /cvsroot/pas/pas/src/Org/Bgw/HTTP In directory sc8-pr-cvs1:/tmp/cvs-serv27322 Modified Files: Proxy.pm Log Message: Removed _requestsProcessed member variable. It was never being used. numberOfRequestsProcessed() now returns the member variable _numConnections. |
From: Justin B. <j0...@us...> - 2003-02-19 14:41:44
|
Update of /cvsroot/pas/pas/src/Org/Bgw/HTTP In directory sc8-pr-cvs1:/tmp/cvs-serv28465 Modified Files: Proxy.pm Log Message: Added a get method for numberOfRequestsProcessed. |
From: Kyle R. B. <mo...@us...> - 2003-02-18 17:16:52
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas/Psp In directory sc8-pr-cvs1:/tmp/cvs-serv6307/src/Org/Bgw/Pas/Psp Modified Files: Compiler.pm Log Message: the compiler should now handle dashes in file names when creating package names... |
From: Kyle R. B. <mo...@us...> - 2003-02-18 17:14:31
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas/Psp In directory sc8-pr-cvs1:/tmp/cvs-serv5073/src/Org/Bgw/Pas/Psp Modified Files: Compiler.pm Log Message: the compiler should now handle dashes in file names when creating package names... |
From: Justin B. <j0...@us...> - 2003-02-13 22:12:19
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Base In directory sc8-pr-cvs1:/tmp/cvs-serv27701/Base Modified Files: Common.pm Log Message: we now allow openFile to fail if the file does not exist. before we were testing for it's existance and failed silently. this proved to be aggravating. |
From: Mental P. <me...@ne...> - 2003-01-09 20:31:45
|
You guys ever see this: Exception: Unexpected Content-Type 'text/html; charset=3Diso-8859-1' returned Its intermittent...=20 --=20 Mental (Me...@Ne...) The Riddle of Epicurus Is God willing to prevent evil, but not able? Then he is not omnipotent. Is he able, but not willing? Then he is malevolent. Is he both able and willing? Then whence cometh evil? Is he neither able nor willing? Then why call him God? http://www.positiveatheism.org/ CARPE NOCTEM, QUAM MINIMUM CREDULA POSTERO. GPG public key: http://www.neverlight.com/pas/Mental.asc |
From: Mental P. <me...@ne...> - 2003-01-07 22:23:01
|
Well, I commited the preliminary Oracle driver for pas.=20 It works, but I'm not quite happy with it. For one thing, oracle has no concept of NOW(), it has SYSDATE. So I overrode some extra methods to print the sql correctly. This doubles mainenence in theory.=20 Whats the feeling of having the time/date function for the database in the config file?=20 pas.session.db.timefunction=3DSYSDATE or=20 pas.session.db.timefunction=3DNOW()=20 SOmething like that. That'll cut down the amount of code by a whopping 3 out of 5 methods. The other thing I had to do was override the dbh method. Oracle needs to use blobs for this, I had to set the LongReadLen. Not a big deal.=20 So, anyways, this is something I can go one way or the other on. Do we abstract the date stuff tot he config file, or do we let drivers simply override methods if needed?=20 I suppose this all means that DB2 support is next :) --=20 Mental (Me...@Ne...) The Riddle of Epicurus Is God willing to prevent evil, but not able? Then he is not omnipotent. Is he able, but not willing? Then he is malevolent. Is he both able and willing? Then whence cometh evil? Is he neither able nor willing? Then why call him God? http://www.positiveatheism.org/ CARPE NOCTEM, QUAM MINIMUM CREDULA POSTERO. GPG public key: http://www.neverlight.com/pas/Mental.asc |
From: Jason S. <fa...@us...> - 2003-01-07 22:15:51
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas/Session/DB In directory sc8-pr-cvs1:/tmp/cvs-serv2959 Added Files: Oracle.pm OracleTest.pm Log Message: oracle driver for sessions |
From: Jason S. <fa...@us...> - 2003-01-06 20:13:49
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Db In directory sc8-pr-cvs1:/tmp/cvs-serv28304/src/Org/Bgw/Db Modified Files: Base.pm Log Message: I modified the config file values used to determine username/password for session db connections to be as they are specified in the administrators guide. See the guide (ch4) for names. |
From: Kyle R. B. <mo...@us...> - 2002-12-18 20:15:03
|
Update of /cvsroot/pas/pas/bin In directory sc8-pr-cvs1:/tmp/cvs-serv11113/bin Modified Files: runPsp Log Message: adding in pract form |
From: Jason S. <fa...@us...> - 2002-12-18 16:47:56
|
Update of /cvsroot/pas/pas/src/Org/Bgw/Pas/Pages In directory sc8-pr-cvs1:/tmp/cvs-serv31357/src/Org/Bgw/Pas/Pages Modified Files: ErrorPage.pm error_page.psp Log Message: Fixed the spelling of Internal |