very rare thing: a
CPU-intensive web app.
Doing some research with Devel::DProf and Time::HiRes is probably your next
step. You need to find out where all that work is going.
- Perrin
> Is there any way to get the content handling phase to send the content to
> the client before the logging phase executes?
Just use a cleanup handler instead of a log handler.
- Perrin
a variable you set with PerlSetVar to
something different for each script.
- Perrin
tandard
module. Check your error_log for messages.
- Perrin
Is there a CPAN module that I can
> import to overload the use command with something that takes the full
> pathname into account perhaps?
You can specify a full path to use/require. Check man perlfunc for the
details. You can also specify a path relative to the current working
directory if you don't like hard-coding full paths in your scripts.
- Perrin
ou should use CGI or PerlEx or something
similar.
- Perrin
> I have a lot of large MP3 files, and want to restrict the number that
Apache
> serves concurrently. Is this possible ? I'm posting it here since I assume
> it would require some sort of module to achieve it. ?? (Win 32).
You want mod_throttle. I don't know if it works on Windows.
- Perrin
On Tue, 14 Aug 2001, Rasoul Hajikhani wrote:
> Are there any traps that I should be aware of when using s//g? I was
> reading the online mod_perl docs and could not find anything to that
> effect. But I do recall working with Perrin (correct me if I am wrong
> Perrin) that there were
ke the child serves a request and immidiately dies.
>
> Does anyone have any ideas on how to figure out why this keeps happenning?
There is info in the distribution and in the guide (debug section) on how
to get stack traces of your code or of Perl itself.
- Perrin
nd out which exactly variable are eating RAM ?
>
> I'm absolutely sure that I'm not useing global variables.
You should read the guide at http://perl.apache.org/guide/ for more info
on memory growth. Some growth over time is normal and you might want to
use Apache::SizeLimit to control it.
- Perrin
his solution, but
> easy finding of these session ids is not desirable. ;)
So, it's not really a session ID then; it's your session data.
There are tons of two-way encryption modules on CPAN. Try looking at
Crypt::CBC.
- Perrin
> So what is the REASON for this copy-on-first-call behaviour.(there have to
> be some reason, if i'm not totaly dull to see it )
It's called a closure. You can read up on it in the Camel book or in Damian
Conway's OO book.
- Perrin
d twice during startup. Try upgrading to mod_perl 1.26,
which fixes this bug.
- Perrin
> Umm... Is
>
> > return OK;
>
> the correct thing to return when using multiple handlers?
Yes, according the mod_perl docs. It only stops if you return something
other than OK or DECLINED.
- Perrin
>send_http_header or something
similar), and print something to the client. Otherwise, your Set-Cookie
header will never get sent out.
Glad to see you're still mod_perl-ing.
- Perrin
ng
> wrong?
It depends on what's happening in that second module. If you don't send an
actual response to the client, headers (including cookies) will not be sent
out.
- Perrin
discussion about this before, but I can't remember what the outcome was and
I can't find it in the archive.
- Perrin
s a separate locking API used to
implement Apache::Session, it should be possible to just use, for example,
Apache::Session::Lock::Semaphore without using any other part of
Apache::Session.
- Perrin
his way. It seems that the session pattern is
generally used for transient data where last-save-wins is fine as long as
the integrity of the data is protected during the actual writes. If you
need fancier locking, you could try ripping the lock stuff out of
Apache::Session.
- Perrin
ode that hogs memory, and you'll need to control it
somehow. Most people have servers more in the range of 10-40MB, with a
bunch of that shared.
- Perrin
Robert Landrum wrote:
> The guide is a great thing, and removing items from it is risky.
Think of it as refactoring.
sanity.
>I'd also start working on the new docs for mod_perl 2.0, so I can see an
>extended chapter on databases and persistence layers in the users guide.
>
I vote to cover only the mod_perl specific stuff in there, as you said
above.
>Perrin, would you like to be the da
Gunther Birznieks wrote:
>
> At 07:16 PM 8/1/2001 -0400, Perrin Harkins wrote:
> > > I have a CGI application where I do:
> > >
> > > require 'db.pl';
> > >
> > > where db.pl defines some functions and variables related to connecting t
ave you followed all the documentation on using LOBs in DBD::Oracle? Are
you sure that LongReadLen is set high enough?
- Perrin
that the
> "correct" way of doing things?
No. Put the connect stuff in a subroutine and call it from your
application. Things in the main section of a required file are only
supposed to run once.
- Perrin
> http://axkit.org/docs/presentations/tpc2001/anydbd.axp
Is this basically a hash of SQL statements, indexed by DBD type? Or is
there something more that I'm missing? (I should have gone to your TPC
talk...)
f you keep changing them with each new
value in the WHERE clause.)
> Using RPC calls instead of language commands also improves speed, and
> solves the "quoting" problem, too.
The same goes for bind variables.
- Perrin
working on one, but it's a
big job and he's busy with Mason.
- Perrin
.org/features/tmpl-cmp.html for a description of the
available options.
- Perrin
could put your SQL in a separate file, but I don't like that approach
because it doesn't seem like you would be changing SQL without changing the
other code very often. Having your SQL right next to where it's being used
is convenient, and a HERE doc makes it easy to read.
- Perrin
John Buwa wrote:
> Isnt there a way to clear global variable to a null after a web transaction
> is complete?
Apache::PerlRun does that.
- Perrin
d practices for using templates in general
Slouching towards 1.0,
Perrin
> Anybody know if exist some module how CGI::Out for buffering output in CGI
script ?
Is there a reason you can't just append everything to a variable until the
end? If that won't work, you can tie STDOUT. Apache::Filter might help.
- Perrin
might try
^/(.*)\.asp(.*)$ for matching the whole query string, but I wouldn't thing
it would be necessary with a greedy regex.
- Perrin
0
> (that's the same URL, but with a query string added), then I get a "404
> Not Found" error.
Of course you do. Your regex ^/(.*)\.asp doesn't match that URL with the
query string.
- Perrin
ne. One package name, one variable name = one variable. If
you need two, they need to have different package names or different variable
names. The file name is irrelevant.
- Perrin
::compar_2ecgi::checkUser called at
See http://perl.apache.org/guide/porting.html#Name_collisions_with_Modules_and
The short answer is that all of your required files need to declare a package
name, and then you can either use the full name to access their functions or
have them export the function names.
- Perrin
>
> Shouldn't the libs load into shared memory? If so, how?
DBI->install_driver()
See http://perl.apache.org/guide/performance.html#Initializing_DBI_pm for more.
- Perrin
connect to the
database exit after the current request. Newly spawned children seem to
connect okay.
- Perrin
;s easy to get started
with is the MLDBM::Sync module, which uses dbm files for sharing.
- Perrin
> is there any good thorough documentation on building custom
> config directives other than what's in the eagle book? i
> left mine back in au and i don't really want to buy another
> one :)
You're in luck, that chapter is on-line:
http://www.modperl.com/book/chapters/ch8.html
ripts?
You can read more here:
http://perl.apache.org/guide/porting.html#Transitioning_from_Apache_Regis
- Perrin
s and averaging. I think it helps smooth out random bad runs,
which do happen now and then.
Any numbers on the new Apache::ASP CGI mode?
- Perrin
uch! I would think it's worth doing one full run to prime each system. Or
do you feel a need to include the initial compilation time?
- Perrin
uch! I would think it's worth doing one full run to prime each system. Or
do you feel a need to include the initial compilation time?
- Perrin
> I need to save some status informations about each request (in my
> "filter" each request passes through 3 phases : PerlTransHandler,
> PerlAccessHandler and PerlHandler.
You want $r->pnotes.
- Perrin
> no need to do a lookup or rely on PerlSetupEnv On I wouldn't think...
>
> my $ssl = Apache::URI->parse($r)->scheme =~ m/^https/;
Or maybe just look at the port # of the request.
- Perrin
27;s problems, but it might help some people find
a tool that suits them.
- Perrin
Take a look at http://perl.apache.org/guide/ and read the stuff on libapreq.
- Perrin
ols
that compile in-line perl, because it doesn't eval anything or cache
anything. The only real downside of this module is that coding repeated
sections (loops) can't be done in-line, i.e. you have to use multiple files.
That's a bit of a pain.
- Perrin
t want
your designers to have to think about it, you could pre-process the
templates to translate the form elements to TT syntax.
There's plenty of documentation for this module that covers the details of
plugins and filters.
- Perrin
y to be database work or IPC of some kind that slows down
an application.
Under CGI, the caching schemes of many of these systems don't work. That
does make a difference.
- Perrin
perfect for some people who just want a simple solution
that stays out of their way.
Also, I believe that security issue Ged referred to was fixed by the author.
- Perrin
aviors and business rules into simple
> XML-like elements that content developers can use.
> PSP shares the same basic elements with JSP..."
Good grief! This sounds exactly like Apache::ASP with its XMLSubs feature.
I give up.
- Perrin
going to be at the upcoming Perl conference in San Diego, you
might enjoy my session called "Choosing a Perl Templating System." I'll be
surveying the popular options and explaining some of the things that
differentiate them.
- Perrin
.cpan.org/search?mode=module&query=template
- Perrin
turn $user;
}
Put it in some utility class that your other classes all use.
Alternatively, you could make your User class cache itself in pnotes and
just have everyone call new(), but that assumes you'll never want to use it
outside of mod_perl. Also see Class::Singleton.
- Perrin
> 2. Cause any httpd_perl child process which exceeds 20 megabytes in
> memory usage to terminate after it's done.
Apache::SizeLimit (and others) can do this.
- Perrin
em during startup, since they won't be shared between
child processes.
- Perrin
hing in a Brooklyn Larger Bath when this is done.
I prefer the IPA, taken orally.
- Perrin
> IS there a way of pre-processing and post processing a handler?
Only by using something like Apache::Filter. Apache itself does not support
chaining handlers.
- Perrin
th SSI. The only way to do that is by using Apache::SSI and
Apache::Filter, as described here:
http://search.cpan.org/doc/KWILLIAMS/Apache-SSI-2.16/SSI.pm
- Perrin
the templating tools are pretty
solid as well.
- Perrin
ache::SSI either
alone or as a filter with Apache::Filter. Does that help?
- Perrin
(P.S. I'm in Brooklyn too!)
d you can call for this. You could also look at CGI::SSI_Parser, which
I have not used.
- Perrin
this way. Of course, do() doesn't check
to see if your module returned true, but they are basically equivalent.
TMTOWTDI.
- Perrin
nother reply to the server and never gets another
> response back? But yes, it creates a new socket ref each time?
It looks to me like you have a problem with scoping and closures. Try
making $sock a global, i.e. change "my $sock;" to "use vars qw($sock);".
Then put your close and undef stuff back in.
- Perrin
ime. Can't remember about PerlRun.
> BTW, here is shorter version of your suggestion:
>
> BEGIN { do '/foo/bar/query.pl'; }
That's what I used when porting someone's old perl4-ish code to PerlRun.
Both of these quick fixes waste memory though.
- Perrin
:
BEGIN {
do "mail.pl";
}
That will work, but it wastes memory by loading them multiple times per
child. If you make them into real modules, they can be loaded from
startup.pl and thus be in shared memory.
- Perrin
ke sure that you
aren't trying to open a socket (or filehandle, or database handle) in the
parent process (during startup) and use it in the children. Each child will
have to make a new socket the first time.
Hope that helps,
Perrin
processing. Is there some way to capture that information?
You could use LWP to make the request instead of using a subrequest, or you
could use a modified version of Apache::PerlRun or Apache::Registry that
fakes CGI and captures the output. You can look at Apache::Filter for some
ideas.
- Perrin
I suspect that it's a combination of the database access and the network
transfer. There is no difference in the amount of parsing going on, since
it's all cached after the first time (per child).
- Perrin
lication (like this benchmark).
Nevertheless, it's good to see some numbers, if only to convince Andy to
finish his optimized XS version of the TT stash.
- Perrin
ent that
it will get cleared at the end of the request, even if your code dies for
some reason. It's safer than doing the same thing with a cleanup handler
that manually clears a global.
- Perrin
IP) problem, but you still have to make exceptions for things like
AOL proxies that can blast you with legitimate traffic. If thousands of AOL
users all click on an ad banner in the same 10 seconds, you don't want to
ban them.
- Perrin
TimeStamp + "R" + Unknown number + "E"
>
> By the way, the session only seems to active until the browser completely
> shuts down. Any ideas?
Sure sounds like a cookie to me. What makes you think it isn't one? Or
else they just don't care who you are until you hit the shopping cart, and
then they keep your identity with URLs and hidden form fields.
- Perrin
certainly check it out.
The only trouble with that is that you will have a separate copy in every
child taking up 700K or more. You can only avoid that if you restart the
server or use some kind of shared memory approach.
- Perrin
hareLite or IPC::MM, but I think you'll still end with a scalar that
takes up more than 700K in each child. If you can't live with that, you
might try breaking up the file more so that you can access it in smaller
chunks.
- Perrin
It's not hard to do, but it is potentially dangerous since you could
overwrite globals like $/ and change the behavior of your program. In
general, it's best to avoid cluttering the symbol table.
- Perrin
ge amount of memory. You might have better luck using dbm
files or something similar that doesn't need to keep the whole thing in
memory at once.
- Perrin
handling this by
> putting
> the code in an eval block, but this no longer works since all Registry scripts
> are already in one huge eval block.
It should still work. An eval{} is scoped like any other block. Maybe you
have a typo? Post your code and we'll look at it.
- Perrin
or not bad user input should be
handled with exceptions at all, but since I like to keep the controller code
simple and let the data model objects do the input checking, you have to
bubble it back up somehow. I'm still kind of unsatisfied with how difficult
some of the user exception handling turned out to be, and I'll probably try
something different next time
- Perrin
ttp://www.template-toolkit.org/docs/default/index.html.
- Perrin
les. The developers give the code away for free, and do
not hide the fact that it doesn't support transactions. There's no need for
this kind of vitriol.
- Perrin
steal code from
there.
However, dbm is a good choice for this. You may find SDBM_File faster than
DB_File if your records are small enough for it (I think the limit is 2K per
record).
- Perrin
here:
http://groups.yahoo.com/group/modperl/message/27908
http://groups.yahoo.com/group/modperl/message/27943
- Perrin
> > It might be easier and more bulletproof to build the conf file
> > off-line with
> > a simple perl script and a templating tool. We did this with Template
> > Toolkit and it worked well.
> > - Perrin
>
> That would be fine and dandy, but it's not exa
worked well.
- Perrin
where...
The crypto section in Mastering Algoritms with Perl is a pretty good
overview.
- Perrin
Matt Sergeant wrote:
> > Is there a way I could use to specify a not condition?
> > as in
> >
> > SSLVerifyClient require
> >
> >
> > That would let me list the exceptions, and everything else would be
> > restricted by default..
>
> It's really frustrating, but this is *not* possible...
t; syntactic sugar..
You could use Filter::CPP with #ifdefs for this.
#ifdef DEBUGGING
print STDERR $some_thing;
#endif
- Perrin
y not sound like such a bad idea after
you examine some of the alternatives. It's really just one group's solution
to the problem you're posing. There are replication tools for MySQL which
are supposedly fairly easy to run.
- Perrin
other processes may have done. If you want to
avoid this, you'll need to do your own locking, or just use Apache::Session.
- Perrin
small site should do fine on NFS.
Since NFS-shared sessions already work with Apache::ASP, you could try it,
benchmark it for your expected traffic, and then decide.
- Perrin
and only for that, but your
Cache::* modules will work with any combination of threads and processes
since the data is really stored outside of the interpreter in shared
memory or files. Even if you use globals, they are only global to the
current thread.
- Perrin
les on CPAN may have to change.
- Perrin
> have done a search on CPAN for "resume" and "cv" did not come up with
anything
> like what i am doing
http://www.zeuscat.com/andrew/work/resume/formats.shtml
- Perrin
s David Harris pointed out, if it does do
the right thing and re-read from disk, it's probably not much better than
re-opening the database. I suppose it would avoid some Perl object creation
though, so it would be at least a little faster.
- Perrin
long as you have a
read-only app. For read/write, you have to tie/untie every time. Or
use BerkeleyDB.
- Perrin
ut an external file!
I think you'll still have problems with this technique, unless you
tie/untie every time. I'm looking at the perldoc for DB_File version
1.76, at the section titled "Locking: the trouble with fd". At the very
least, you'd have to call sync after acquiring a write lock but before
writing anything.
- Perrin
901 - 1000 of 1431 matches
Mail list logo