to the telnet server.
Of course the simplest approach would be to just let each Apache process
open telnet sessions as needed.
- Perrin
ht, yes. It won't be speedy if you start
getting many concurrent requests.
- Perrin
namically create anonymous
> subroutine handlers based on input and have them be active until the form is
> submitted, at which time they are used to process the form then discarded.
But why go to all that trouble, generating subroutines on the fly? It
just doesn't seem necessary for processing form input.
- Perrin
es which model objects to call.
- Controller calls some methods on model objects.
- Controller picks a view and passes data from model objects to it.
I wrote about this in my article on the eToys system:
http://www.perl.com/pub/a/2001/10/17/etoys.html
- Perrin
obably very
close to what you want to do.
- Perrin
this point. All of
these tools are blazing fast. They all have C code under the hood now
(with the new HTML::Template compiler). The bottleneck on performance
of web applications is still what it always was: data access.
- Perrin
Dave Rolsky wrote:
> Alzabo could handle a _lot_ of this for you. Class::DBI could handle some
> of it (though less).
SPOPS is also a good choice for this. All of them are on CPAN, just
waiting for you.
- Perrin
L::Template can be smartened up to
> understand that I want Dates rendered in a pretty format, quantities
> should be commified, cash values must have commas and 2dps, interest
> rates should have 4dps and cells with an error attribute should have
> a red background.
No problem, as I explained above.
- Perrin
a name. Then the view gets to
decide what special treatment to give that data.
Maybe there's a certain class of problems where the sort of layout hints
you're talking about are needed and I've just never had to deal with it.
- Perrin
the payment reason, on their subscription page, it doesn't wrap.
> Two views of the same data.
That doesn't require a layout manager though. Simple templating is fine
for that, i.e. two different templates (views).
- Perrin
necessarilly.
Obviously there are lots of ways to solve these problems, but what I
like about doing it in the template is that it puts these concerns in
the hands of the people who control the rest of the look-and-feel issues
in the application, and gets them out of the perl programmers' way.
- Perrin
x27;t decide how their results should be distributed.
This is typically something you would put into the controller, since the
view shouldn't have to worry about details like HTTP headers.
- Perrin
y_first_name_font') %]
... some text, possibly with other template directives in it...
[% END %]
The filter is a module which would get to post-process the output of the
contained block.
I believe the taglibs in AxKit could be used in a similar way.
- Perrin
Rob Nagler wrote:
> Perrin Harkins writes:
>
>>You can actually do that pretty comfortably with Template Toolkit. You
>>could use a filter for example, which might look like this:
>>
>>[% FILTER font('my_first_name_font') %]
>>... some text,
didn't put in any fancy HTML in my example. I could have put in
table tags right there, or made a macro if that table gets repeated a
lot. Looks to me like they work the same. In TT, I would probably use
macros or small templates (possibly defined in this same template file
at the top) for little repeating chunks, and filters or plugins for
things with more brains, like the String widget that decides whether or
not it needs to print FONT tags.
- Perrin
ake sure
you compile all of these with the same compiler, to ensure compatibility
between libraries.
- Perrin
no trouble grasping the basic
ideas of templating, and don't feel the need to try and wedge in stuff
that doesn't belong there.
The thing that worries me about a widget approach is that I would have
the same problem I had with CGI.pm's HTML widgets way back: the
designers can't change the HTML easilly. Getting perl developers out of
the HTML business is my main reason for using templating.
- Perrin
agram, code examples, etc. I wasn't planning to write a
spearate MVC one because I've already said most of it there.
- Perrin
icely. Would you put that formatting in
the controller?
What if you had a model object that generates a list of these concerts,
and on a certain page the designers want to show it in two columns.
Would you split it into two arrays in the controller?
- Perrin
that does a good job of M and C separation, and good ways to propagate
> errors back to the C?
You could look at the OpenInteract code. It includes some good examples.
- Perrin
andard form validation techniques makes
up for the redundancy in most cases.
- Perrin
has taken.
Rob and I talked about writing something, but honestly I have a hard
time thinking of what more there is to say. The best thing to do is go
and look at the many examples of MVC frameworks for Perl (bOP,
OpenInteract, CGI::Application, etc.) and dive into their sample code.
- Perrin
hen_using_X
ML_Parser
Sorry to hear you had trouble finding it. That section of the guide is
the first place you should look when you're having segfault problems.
- Perrin
oller or in the view. The model would just
provide the data. If they are simple links (i.e. same params always, no
logic) you should be able to use any templating system to build them.
Template Toolkit has a URL plugin for convenience:
http://www.template-toolkit.org/docs/default/Modules/Template/Plugin/URL
.html
- Perrin
nges which complicate things, but that's
the basic idea.)
- Perrin
x27;t get me wrong: a basic script + a template is still better than a
basic script + a bunch of print statements, but there is value in the
separation of the controller and the model too.
- Perrin
ine.
You could also look at the way OpenInteract does it, which allows you to
gather all the related stuff including this configuration into a single
package that you can install in one shot.
- Perrin
27;s the part that
accepts data and generates HTML.
- Perrin
and then decide which view to show.
- Perrin
Ward Vuillemot wrote:
> I know we are straying WOT, but I would love to get a better feel for XML, XSLT and
>AxKit.
Barrie Slaymaker has written a couple of articles on perl.com that serve
as a good intro to AxKit.
- Perrin
and-alone dynamic pages are not MVC at all. They exist
> because there are often 'glue' pages that don't warrant the comlexity of MVC
> (those that don't need M and have very simple VC needs).
I agree that there is often a need for some quick and dirty internal-use
pages (admin or reporting usually) that don't require the extra baggage.
- Perrin
perl. Can you give a URL for the
documentation on how to use this?
- Perrin
or now I'd suggest looking
at Cache::Cache, MLDBM::Sync, or Cache::Mmap.
- Perrin
do! better to get it from a real data bank.
MySQL is fast, but usually not as fast as simple disk access.
Cache::Cache and Cache::Mmap handle the details of the cache stuff for
you, making it pretty easy.
- Perrin
in state for a window (as opposed to
global state for a session) is to pass ALL the state data on every link.
- Perrin
...
Right, which is why you shouldn't try to store server-side state for
anything that could be different in multiple browser windows. Only
store global browser information on the server-side. Everything else
has to go into the links and forms.
- Perrin
ions have some data that is read-only or close to
it. (I know that yours deals with financial data, so in your case it
may actually have to be all real-time data.)
- Perrin
SQL every
time someone hits the front page of Slashdot just to give them the very
latest count on comments? Caching that page for 1 minute takes a ton of
load off the database and doesn't really impact the user experience.
I fully agree that optimizing the database and SQL is the first step,
but correct use of caching can make a huge difference on high-volume sites.
- Perrin
xample, if both the admins and editors get
to see the "edit content" button, don't do a bunch of ifs in the
template to express that. Pass something called "user_can_edit".
> Some
> stripped-down code samples would be nice
Again, I would urge people to look at things like OpenInteract. There's
also tons of articles out there, like this one about doing something
close to MVC with the XML::Application module:
http://www.xml.com/pub/a/2001/12/12/cgi-xml.html
- Perrin
notion of MVC
you're talking about here. It doesn't offer any specific help with
modelling your data as objects, but it follows the structure you
describe pretty closely and you could use any data modelling module you
like with it.
- Perrin
odperl (or www.someserver.com/somedir/index.phtml
> the uri becomes /modperl/somedir) which is used in a
> directive.
What does that get you? I don't see why you would want to do that.
- Perrin
tly. There might be 4 tables involved in finding
out what kind of credit card the user had, but that gets hidden behind
this API. If you find yourself writing classes that take options like
"where => 'date > ' . $date" you are reinventing SQL, and you've lost
your abstraction.
- Perrin
nd then they say to make
it really fast and handle a billion users. They are happy to trade
slightly stale data for very good performance, and part of the
requirements gathering process involves finding out how often various
kinds of data change and how much it matters if they are out of date.
(For example, inventory data for products changes often and needs to be
much more current than, say, user comments on that product.)
- Perrin
- Perrin
e for interpreting
request data and calling methods on model objects. (View.pm is maybe a
somewhat misleading name, since it isn't the part that generates the
HTML "view".)
- Perrin
of their
introductory documentation though.
- Perrin
raction is
something
> akin to 'GOTO considered harmful'.
I think you're overgeneralizing based on some kind of O/R mapping tool
you've used that tried to do too much. Wrapping up the knowledge of how
to work with the database to accomplish certain tasks inside of objects
is no different from any other application of OO programming.
- Perrin
op of that will
do
> you much good.
There's nothing "thick" or "heavy" about the way I do it. There is no
automatic SQL generation, and nothing to prevent me from using any SQL
tricks that my database supports. It's just a way of wrapping up chunks
of code that implement data-related tasks into an easy task-oriented API
for the controller (or other model objects) to act on.
- Perrin
le. Things like Alzabo model the database objects, i.e.
tables, rows, foreign keys.
My approach falls in the first camp, although I don't currently use any
OOP tools for assistance.
- Perrin
be much demand for from the mod_perl community.
- Perrin
> Does anybody know which is the technology behind Amazon?
If you look at their job listings, you'll see it's a lot of C/C++ and
Perl, with a smattering of other things, running on Unix. That's pretty
typical of the really big sites.
- Perrin
d support to
it for your favorite perl templating tool.
> The existence of such tools is IMHO the reason why IIS/ASP is winning
ground.
I think it might have more to do with millions of dollars of agressive
promotion.
- Perrin
uidelines that people can be referred to.
Also, a module map might be a good thing to create, i.e. an improved
version of this: http://perl.apache.org/src/apache-modlist.html.
- Perrin
nt was that since you can't expect all of the existing modules
to change their names you could make a little directory page that
follows the organization you're proposing and have it list the existing
modules in each category. Maybe not worth it, but it could be useful
for newbies.
- Perrin
f wrap-up to this round of O/R technology discussion, I want
to post a link to this quote from the author of SPOPS where he talks
about the practical limitations of SQL abstraction. I thought it was a
pretty astute observation:
http://perlmonks.org/index.pl?node_id=162259
- Perrin
t think either of those
modules would work if you had this problem and it sounded like you were
only getting it when trying to use both of them together.
- Perrin
c. I wouldn't suggest putting it on CPAN though unless it does
something that the others don't do.
- Perrin
w to
add support for threading in perl 5.8/mod_perl 2 to this? It might be
premature, since the DBI/DBD modules are not necessarilly thread safe.
- Perrin
y, it looks like Apache::ProxyPass
and Apache::ProxyRewrite all do essentially the same thing. Maybe you
could fold your ideas into one of those.
- Perrin
unless again things will get
> backported. Otherwise chances are that 5.8.0 will be a requirement.
I saw that message, which is why I mentioned 5.8, but I was wondering if
anyone has seen discussion of whether or not DBI will be safe to use
with 5.8 threads. Does anyone know?
- Perrin
parate image server (which you can host
on the same machine). I've found thttpd to be an amazingly efficient
server for images, but a slimmed-down apache does very well too.
- Perrin
should have been taken
> care off.
There's a pretty good chance that it's not mod_perl causing it. It may
be just that Win32 perl grows a little when you run that CGI::header
call over and over.
The upcoming mod_perl 2 will have better support for Windows. You can
find information on it here: http://perl.apache.org/release/docs/
- Perrin
at alternatives like PerlEx, but they may have
the same issues.
- Perrin
ways that you call it,
etc. One of those things is probably responsible.
- Perrin
everything from scratch using source RPMs.
I highly recommend building your own RPMs. It works great, you get
exactly what you want (and nothing you don't want), and you can install
them quickly on a cluster of machines because you don't have to
recompile on each one.
- Perrin
The only thing that isn't cached is your script itself.
- Perrin
did not declare packages, but just used a simple
"require lib.pl" to define a bunch of stuff in the current namespace.
That doesn't work with PerlRun or Registry. There are various
approaches for dealing with this, the quickest and worst being to change
the "require file" to a "do file". The best is to make them actual modules.
- Perrin
Error::Simple with {
my $err = shift;
if ($err->text() =~ m/ORA-172/) {
# handle the error here
} else {
# let this error propagate
$err->throw();
}
}; # <-- don't forget!
- Perrin
ception handling which covers it and
shows a workaround. You can see it here:
http://axkit.org/docs/presentations/tpc2001/
- Perrin
ser is just interpreting the
response of 333 as a sign that something went wrong and putting a pretty
face on it. Microsoft browsers are notorious for this, although you can
turn the behavior off.
- Perrin
It's really your only choice for a proxy server. It's
also somewhat safer, since it means your database doesn't have to be up
just to start your proxy server.
- Perrin
reset when you
enter the handler sub again.
There are other problems too, like "return" not doing what you would
expect when used inside a try block (it only returns from the try block).
- Perrin
's easy to subclass. You could also use
Dave Rolsky's Exception::Class, which is pretty similar.
- Perrin
7;d like to
make SizeLimit work for the threaded MPMs if possible.
- Perrin
.
The other problem, which might be harder, is to figure out how big a
particular interpreter is. The current implementations of
Apache::SizeLimit and GTopLimit cheat by asking the OS how big the
current process is. That won't work with threads.
- Perrin
us what you
find.
> With the whole problem
> of providing seemless recovery at the "client" side from database
> failure this tool seems quite productive.
What problem is that? I don't think there's much you can do beyond
re-connecting, which Apache::DBI does.
- Perrin
kind of local proxy object could handle this, forwarding all
method calls to the worker thread and returning all results. It would
be kind of like a transparent RPC mechanism.
- Perrin
ry to be able to automatically retry on
another database if it fails. For that, you would need to add some
extra code to catch the exception, recognize it as a connection failure,
make a new connection, and retry the query. I don't see anything on the
SQL-Relay pages about this sort of ability.
- Perrin
oblem at all.
- Perrin
tops. Then, if you find a
little section that causes growth and you can't understand why, post it
here and someone may be able to explain it.
A number of the most common sources of memory growth are explained in
the guide:
http://perl.apache.org/docs/1.0/guide/performance.html#Improving_Performance_by_Prevention
- Perrin
; -- true, but not
very helpful to someone who lives in Montreal and likes it.
- Perrin
gt; And why does it only happen for some
> browser/platform combinations?
Probably buggy browsers or TCP stacks.
- Perrin
test.
To answer the original question, I don't think Apache::DBI is much
overhead at all. It amounts to little more than a hash lookup.
Certainly less work than the the thread synchronization required for
connection pooling.
- Perrin
sin
had something built in. I would use those if possible.
Stick with Apache::DBI for mod_perl though. I would never tell anyone
to roll their own database persistence for performance instead of using
Apache::DBI. Pinging the database connection is good, and all systems
should do it if they don't already.
- Perrin
idate any old sessions this user may have. This
assumes you are talking about actual logins, not just sessions for
anonymous browsers.
- Perrin
t from the client is expected to return that
> cookie.
Sounds like an ordinary session to me. If you aren't logged, you must
log in. Logging in clears all other sessions tied to this user ID.
That should work fine.
- Perrin
t will force a change in CPAN.pm.
- Perrin
o look at some of the existing modules and see if a
merge of some kind is possible.
- Perrin
d _also_ in a mod_perl handlers
> or in a CGI script over Registry.
The Apache::Auth modules also support that.
- Perrin
ocs/adt/customization.html#Session_and_Session_Manager_Conf
They're not on CPAN, so I'm not surprised you didn't see them.
- Perrin
ation scheme would then
be possible for both languages (maybe use an existing XML one). You can
use a database for persistent storage from both sides.
- Perrin
://perl.apache.org/docs/general/perl_reference/perl_reference.html#my___Scoped_Variable_in_Nested_Subroutines
- Perrin
dea to do
your own parsing of the input and cookies. You should use one of the
CGI modules or Apache::Request and Apache::Cookie for this. Writing
your own routine for this is just asking for security problems and bugs.
- Perrin
why, I'll point you to this
article on the subject:
http://perlmonks.org/index.pl?node_id=51012
- Perrin
ed logging,
etc. without inventing your own config system. There are exceptional
situations (a requirement to add new handlers without a restart, for
example), but most people will be just fine doing it the old-fashioned way.
- Perrin
ser ID that is
associated with it go in the session. Status of a particular page has
to be passed in query args or hidden fields, to avoid problems with
multiple browser windows. Data that applies to multiple users or lasts
more than the current browsing session never goes in the session.
- Perrin
onsidered your home page? This id is
>stored permanently in the db ("lasts more than the
>current current browsing session") but I keep it in
>the session since this also rarely changes so I don't
>want
>to keep hitting the db to get it.
>
I would have some kind of user object which has a property of
default_page_id. The first time the user logs in I would fetch that
from the database, and then I would cache it so that I wouldn't need to
go back to the database for it on future requests.
- Perrin
e reliable
(like the ID of the current user, since without that you have to send
them back to log in again) from things that don't need to be (you could
always fetch the list of pages from the db if your cache went down).
- Perrin
ywhere from 3 to 20 years, there's a lot
> of info.
No problem, disks are cheap. 400MB of disk space will cost you about as
much as a movie in New York these days.
- Perrin
File) is also very fast, and other
options like Cache::Mmap and Cache::FileCache are much faster than
anything based on IPC::Sharelite and the like.
I have charts and numbers in my TPC presentation, which I will be
putting up soon.
- Perrin
h processing to determine what subset gets loaded at startup.
You could also just dump the whole thing into a Berkeley DB file every
now and then.
- Perrin
701 - 800 of 1431 matches
Mail list logo