Another program about Protocol Handers!
I use the code to redir smtp. And test the connection from outlook. But i find that the . can not recv from socket($socket->recv($line, 1024)) . I use WPR PRO to sniffer the packet , the outlook send out . . = package SMTP; use strict; use Apache2::Connection ( );use APR::Socket ( );use APR::Const -compile => qw(SO_NONBLOCK);use Apache2::Const -compile => 'OK';use HTTP::Date;use Socket;sub handler { my $c = shift; my $proto = getprotobyname('tcp'); my $host='aaa.bbb.com.tw'; my $port=25; my $iaddr = inet_aton($host); my $paddr = sockaddr_in( $port, $iaddr ); socket( SOCK, PF_INET, SOCK_STREAM, $proto ); connect( SOCK, $paddr ) ; select (SOCK); $|=1; select(STDOUT); my $welcomemsg=; my $socket = $c->client_socket; $socket-> opt_set(APR::Const::SO_NONBLOCK, 0); $socket->send($welcomemsg, length $welcomemsg); my $lines; my $cmd; my $line; my $i=0; while( $socket->recv($line, 1024)){ open(hh,">>/tmp/smtp.log"); print hh $i.$line; print hh "--($i)-\n"; close(hh); $i++; $lines .= $line; if ( $lines !~ /\n$/ ) { next; } binmode(SOCK); syswrite (SOCK ,$lines); my $response; binmode(SOCK); my $bs = sysread(SOCK, $response, 1024); $socket->send($response, length $response); $lines=''; } return Apache2::Const::OK;} 1;
Re: [FRIDAY] Trivia Question
> It's brian d foy and because he wants it that way: > > http://www252.pair.com/comdog/style.html some editors -- for instance, Wired magazine's policy IIRC -- refuse to recognize capitalization guides from authors, considering capitalization historically the domain of the craft of the scribe/typesetter and outside the scope of the author's control. This is an ongoing battle, or at least skirmish, among the leisure classes and their hobbies. Witness the nonsense involved in The Software Formerly Known As LaTe\/ /\, for instance. This thread seems like an opportunity for pitching alternatives, to tease BDF about his namby-pamby style guide. Brain D'fleur seems like a good start. -- David L Nicol all your mySQL databases are belong to us
mod_perl 2.0 custom directive clarification
The "Apache Server Configuration Customization in Perl" page claims that the following code can be used in the request handler to retrieve configuration values: my $dir_cfg = $self->get_config($s, $r->per_dir_config); however, it isn't quite clear what $self refers to in the request handler. AFAICT, the correct sample code should be Apache2::Module::get_config('MyApache2::MyParameters', $s, $r->per_dir_config()); as is shown further down. DES -- Dag-Erling Smørgrav - [EMAIL PROTECTED]
Re: mod_perl 2.0 custom directive clarification
On Mon, 20 Feb 2006 21:09:44 +0100 [EMAIL PROTECTED] (Dag-Erling Smørgrav) wrote: > The "Apache Server Configuration Customization in Perl" page claims > that the following code can be used in the request handler to retrieve > configuration values: > > my $dir_cfg = $self->get_config($s, $r->per_dir_config); > > however, it isn't quite clear what $self refers to in the request > handler. AFAICT, the correct sample code should be > > Apache2::Module::get_config('MyApache2::MyParameters', $s, > $r->per_dir_config()); > > as is shown further down. The part of the docs with my $dir_config = $self->get_. is for writing a callback to process the configuration information, not retrieve it in the handler. And yes, you're right. The proper way to retrieve it in your handler is what you found further down in the file. If you're only doing simple parameters you might want to look into using ModPerl::ParamBuilder as it makes the whole process very very easy. - Frank Wiles <[EMAIL PROTECTED]> http://www.wiles.org -
ANNOUNCE: Krang 2.003
We're pleased to announce that Krang v2.003 is now available. This release is comprised of several bug fixes and some small but valuable enhancements. Of note are a more streamlined ssl configuration, and a popup template chooser. Notable changes in this release: * Fixed bug in sql/mypref.sql so that user’s can’t clobber each others preferences. * Added missing setting of template param ’parent_path’ to Krang::CGI::ElementEditor::find_story_link(). * Replaced template selector in ’New Template’ and ’Find Template’ (advanced search) with category_chooser style template_chooser. * Simplied use of --module option with bin/krang_build. * Added checkbox to groups manager to allow "admin_lists" to be set. * Fixed Kang::Navigation bug where Desks were not being displayed in proper order. * Fixed internal server error when attempting to publish templates and media/stories at the same time from the UI. * Fixed internal server error when viewing media files from the Scheduler user interface. For more information about Krang, visit the Krang website: http://krang.sourceforge.net/ There you can download Krang, view screenshots, read documentation, join our mailing-lists and access the CVS tree. Detailed change-log here: http://krang.sf.net/docs/changelog.html Krang is an Open Source web-publisher / content-management system designed for large-scale magazine-style websites. It is a 100% Perl application using Apache/mod_perl and MySQL, as well as numerous CPAN modules. Krang provides a powerful and easy to use story and media editing environment for magazine editors, as well as a complete template development environment for web designers. On the back-end, Perl programmers can customize Krang to control the data entered in the story editor and add code to drive the templates to build output. Krang can be enhanced with add-ons containing new skins and other new features. Krang easily handles large data sets and can manage multiple websites in a single installation. - the Krang team Aaron Dancygier
(slightly OT) postgresql? firebird? mysql?
Hi guys, I'm currently using mysql, but I'm considering changing over to firebird or postgre. Anyone have any reasoned loves/hates/useful experiences to pass on? Thanks Daniel -- Daniel McBreartyemail : danielmcbrearty at gmail.comwww.engoi.com : the multi - language vocab trainerBTW : 0873928131
Re: (slightly OT) postgresql? firebird? mysql?
Daniel McBrearty <[EMAIL PROTECTED]> wrote: > I'm currently using mysql, but I'm considering changing over to firebird or > postgre. > > Anyone have any reasoned loves/hates/useful experiences to pass on? I love postgresql! OK, to make it reasoned: * Better license than MySQL, BSD-like license means it can be embedded in commercial products if need be. * Everything's journaled and transactional, which means the database _may be slightly_ slower, but it's far more resistant to data corruption. * slony makes it easy to cluster your database. * People on the postgresql-general mailing list have been responsive and helpful * PL/PGSQL procedural language is fast and not too difficult to learn (although the documentation could use some improvement, if it weren't for my having easy access to a postgres mentor I'd have wasted many more hours on this...) * I dig the elephant logo. - Tyler
Re: mod_perl 2.0 custom directive clarification
Frank Wiles <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] (Dag-Erling Smørgrav) wrote: > > The "Apache Server Configuration Customization in Perl" page claims > > that the following code can be used in the request handler to retrieve > > configuration values: > > > > my $dir_cfg = $self->get_config($s, $r->per_dir_config); > > > > however, it isn't quite clear what $self refers to in the request > > handler. AFAICT, the correct sample code should be [...] > The part of the docs with my $dir_config = $self->get_. is for > writing a callback to process the configuration information, not > retrieve it in the handler. To quote a slightly longer excerpt: | This object can be later retrieved at request time via: | | my $dir_cfg = $self->get_config($s, $r->per_dir_config); which is clearly incorrect, unless "at request time" means something different to you than it does to me. This is in the "Directive Callback Subroutine" section, see http://perl.apache.org/docs/2.0/user/config/custom.html#toc_Directive_Callback_Subroutine DES -- Dag-Erling Smørgrav - [EMAIL PROTECTED]
Re: (slightly OT) postgresql? firebird? mysql?
On Mon, 20 Feb 2006 21:23:11 +0100 "Daniel McBrearty" <[EMAIL PROTECTED]> wrote: > Hi guys, > > I'm currently using mysql, but I'm considering changing over to > firebird or postgre. > > Anyone have any reasoned loves/hates/useful experiences to pass on? I too love PostgreSQL and use it for everything. Along with Tyler's comments, you can also write your stored procedures in Perl with PL/Perl which is nice. And on systems with few users, yes MySQL is faster, but most benchmarks I've seen PostgreSQL starts to win out when you have greater than 5-10 simultaneous users. But I also believe those numbers were run with the next to last stable releases of both products so it may have moved in one direction or another since then. Note however that PostgreSQL's default configuration is not optimal for most systems. It is a lowest common demoninator configuration, here is an article I wrote awhile back that has become one of the main tuning guides: http://www.revsys.com/writings/postgresql-performance.html - Frank Wiles <[EMAIL PROTECTED]> http://www.wiles.org -
Re: (slightly OT) postgresql? firebird? mysql?
mysql's innodb and mysql 5's 'improvements' should address a lot of issues with previous versions that said, mysql and postgres are great. (i've never used firebird) there's beginning to be less of a difference between mysql and postgres as time progresses though the mysql project essentially started with speed, and aimed for a full set of db features the postgres project essentially did the opposite: support everything , but slow, then go for speed i think the only annoying thing between migrated from postgres<- >mysql is the triggers vs auto_increment stuff if your code uses a lot of insert_id from an auto_increment field, expect to go crazy tracking down all of your calls and creating triggers/serials/stored procedures to replicate that functionality On Feb 20, 2006, at 3:27 PM, Tyler MacDonald wrote: Daniel McBrearty <[EMAIL PROTECTED]> wrote: I'm currently using mysql, but I'm considering changing over to firebird or postgre. Anyone have any reasoned loves/hates/useful experiences to pass on? I love postgresql! OK, to make it reasoned: * Better license than MySQL, BSD-like license means it can be embedded in commercial products if need be. * Everything's journaled and transactional, which means the database _may be slightly_ slower, but it's far more resistant to data corruption. * slony makes it easy to cluster your database. * People on the postgresql-general mailing list have been responsive and helpful * PL/PGSQL procedural language is fast and not too difficult to learn (although the documentation could use some improvement, if it weren't for my having easy access to a postgres mentor I'd have wasted many more hours on this...) * I dig the elephant logo. - Tyler
Re: mod_perl 2.0 custom directive clarification
On Mon, 20 Feb 2006 21:32:02 +0100 [EMAIL PROTECTED] (Dag-Erling Smørgrav) wrote: > To quote a slightly longer excerpt: > > | This object can be later retrieved at request time via: > | > | my $dir_cfg = $self->get_config($s, $r->per_dir_config); > > which is clearly incorrect, unless "at request time" means something > different to you than it does to me. > > This is in the "Directive Callback Subroutine" section, see > http://perl.apache.org/docs/2.0/user/config/custom.html#toc_Directive_Callback_Subroutine Yes, that's exactly what I'm talking about. :) You are referencing the wrong section for how to use these configs in your sub handler(). When using custom configuration directives there are essentially three steps involved: 1) Define the directives via @directives and load it in. 2) Write the callbacks that are used by Apache when reading in those config options. This is what you are reading about in "Directive Callback Subroutine". These callbacks are used to put the data into whatever data structure you want to save it under and/or validate the data when the config file is parsed. 3) You use Apache2::Module::get_config() to actually retrieve the configuration *data* in your sub handler(). Hopefully that is more clear. - Frank Wiles <[EMAIL PROTECTED]> http://www.wiles.org -