Re: Apache::Session and user sessions
On Mon, 9 Dec 2002, Perrin Harkins wrote: > md wrote: > > My question is with regards to whether I need or > > should put the submitted data into the session as the > > user navigates the forms (to create an account). The > > user will be taken through three forms to create an > > account. So for instance, form one will ask the user > > to create a username, password, and provide an email > > address. Before moving on to form two (billing info), > > should I put this data in the session, or just go > > ahead and dump it in the database (after making any > > nec. checks), since I won't need the info until they > > actually login? Or should I collect all the info from > > all three screens by putting it in the session as the > > user traverses the forms and then put it all in the > > database at once? I'm currently using the first > > option. BTW, it is possible for a user to create a > > free account by hitting form one only, so no harm > > would come if something happened after form one. > > This is really a question of requirements. In systems where all Agreed. I have a golden rule for this: if (( management are annoying and like to know about incomplete registrations || you want one point of varifying input so that designers can shove in as many intermediary pages as possible) ) && You don't have a ridiculous amount of fields to process ) { place in session } else { shove in hiddens. } I wouldn't start populating your real tables until the registration is complete since you may end up with lots of incomplete junk in there and your form design will be governed by any database constraints placed on your table (foreign keys, and stuff). Then again, I sometimes have to bend my golden rules. Fortunately Perl and Gold both bend easily. > usually don't store form input in the session because it leads to > strange results if the user has multiple browser windows open on the > site, but that may not be an issue for your application. I'm not sure how often a user will attempt to complete one form through multiple browsers. To be honest I'm not sure that he/she should. I think of a form as one process which may remain persistant due to hiddens or a session. Once the form has been completed or a user has logged in, the session data used for the rest of the site should probably be unrelated and populated separately. That's just my 0.02 EU on a cold Monday evening. R.
Re: Newbie: Why does my script prompt to be downloaded intermittantly?
On Thu, 21 Nov 2002, Trevor Joerges [SendMIME Software] wrote: > behavior is intermittent. I've read the mod_perl pitfalls and the > "PerlSendHeader" is set to "on" in my config file. Is there something else I > need to add or remove? Hi Treveor, I've seen three fixes to this sort of problem in the past, so you might want to see if any of the following apply to your case: 1) Changing Browser - Galeon had me testing for days, when I could clearly see that I was getting the correct header, via telnet to the port. See below. 2) Turning PerlSendHeader Off and sending your own headers. The problem was probably somewhere else, but sending my own headers fixed it. Then again, the problem might not have been elsewhere. 3) Make sure you're not sending your header twice. With PerlSendHeader being on or off, plus a code segment sending a header/or some gibber elsewhere, or even a stray 'print' to STDOUT from some other place, before the header is dispatched. I've had header trouble a couple of time and have often found telneting to the vhost to be a very handy detector of what might be going wrong. If that fails then paracetamol is usually a good cure. My late night 0.02 EU. R.
Re: AW: Apache::DBI and password security
On Fri, 15 Nov 2002, [iso-8859-1] "Faßhauer, Wolfgang, FCI3" wrote: >>Hmm. I think that the guy who wrote Blowfish_PP would cut my > danglies off >>for that one. > >This is an interesting idea. Cutting my danglies off? hmm. Sounds painful. >Many thanks to you, Rafiq! s'ok, although I wouldn't implement this myself. There are probably nicer ways of being paranoid out there. And just use Crypt::Blowfish if you really want to use Blowfish. :) Good luck. R.
Re: AW: Apache::DBI and password security
On Fri, 15 Nov 2002, [iso-8859-1] "Faßhauer, Wolfgang, FCI3" wrote: > > Have you thought of running your webserver as some 'www' user? You can > > then make your scripts readonly by a 'dev' group which the www user and > > the developes are members of. > >CORRECT: > >'readonly' should be 'only readable' by > > Yes, that's our plan, too. But the risk still remains that someone will get > a look to the script. I think, there is a golden rule: Never put clear text > passwords in files. Those files are stored in archives by backup for > example. There maybe a lot of people (sysadmin, developer, ...) concerned > with the webserver. So it's not easy to secure it. A thought, although I've never been so secure myself and I'm not sure how secure this would be - but it's one of those silly convoluted ideas you have to tell someone. Since you're using mod_perl and apache_dbi, this is just a thought. Use the Crypt::Blowfish_PP to generate an encrypted password and place it as a variable in a package somewhere. During server startup take a password from the command line, some sort of: Paranoid::CryptDBIPassword::promptForPassword getliner. Take the value as my $key and: my $bfish = Crypt::Blowfish_PP->new($key) $Apache::PARANOID::dbiPassword = $bfish->decrypt($encryptedPassword); then whenever you want your password you access $Apache::PARANOID::dbiPassword. Hmm. I think that the guy who wrote Blowfish_PP would cut my danglies off for that one. R.
Re: Apache::DBI and password security
On Fri, 15 Nov 2002, Rafiq Ismail (ADMIN) wrote: > On Fri, 15 Nov 2002, [iso-8859-1] "Faßhauer, Wolfgang, FCI3" wrote: > > one database user because of resource limits. The problem I see is that the > > password for connecting to the database is clear readable in the perl > > script. > > Does anybody know how to hide that password? > > Have you thought of running your webserver as some 'www' user? You can > then make your scripts readonly by a 'dev' group which the www user and > the developes are members of. CORRECT: 'readonly' should be 'only readable' by R.
Re: Apache::DBI and password security
On Fri, 15 Nov 2002, [iso-8859-1] "Faßhauer, Wolfgang, FCI3" wrote: > one database user because of resource limits. The problem I see is that the > password for connecting to the database is clear readable in the perl > script. > Does anybody know how to hide that password? Have you thought of running your webserver as some 'www' user? You can then make your scripts readonly by a 'dev' group which the www user and the developes are members of.
Help - SEGFAULTS on 'PerlModule' after version upgrade
Ugggh: My software works with the 'original server settings', (apache 1.3.24/mod_perl 1.26) see below(1), under linux. It doesn't work with 'new server settings', (apache 1.3.26 / mod_perl 1.26) see below(2), under freeBSD. Symptoms: With the new build, I get seg faults with 'some' of the PerlModules included through PerlModule in various virtualhosts. Other modules work. These packages all run with strict and do not include any XS besides what may hide under the cover with DBI, Date::Calc and Template. I also have a headache. The packages were happily being included into my old build and there is nothing unusual about them. An strace displays the last couple of lines before a segfault as follows: Server Settings follow this Block=== stat("/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/Date/Calc/Calc.bs", {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 sigprocmask(SIG_BLOCK, ~[ILL TRAP ABRT EMT FPE BUS SEGV SYS], []) = 0 open("/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/Date/Calc/Calc.so", O_RDONLY) = 7 fstat(7, {st_mode=S_IFREG|0555, st_size=105794, ...}) = 0 read(7, "\177ELF\1\1\1\t\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 )\0\000"..., 4096) = 4096 mmap(0, 102400, PROT_READ|PROT_EXEC, MAP_PRIVATE, 7, 0) = 0x28316000 mmap(0x2832e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 7, 0x17000) = 0x2832e000 close(7)= 0 access("/usr/lib/libperl.so.3", F_OK) = 0 open("/usr/lib/libperl.so.3", O_RDONLY) = 7 fstat(7, {st_mode=S_IFREG|0444, st_size=615768, ...}) = 0 read(7, "\177ELF\1\1\1\t\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0|O\1\000"..., 4096) = 4096 mmap(0, 622592, PROT_READ|PROT_EXEC, MAP_PRIVATE, 7, 0) = 0x2832f000 mmap(0x283bd000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 7, 0x8d000) = 0x283bd000 mmap(0x283c6000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0x283c6000 close(7)= 0 access("/usr/lib/libm.so.2", F_OK) = 0 access("/usr/lib/libm.so.2", F_OK) = 0 access("/usr/lib/libutil.so.3", F_OK) = 0 sigprocmask(SIG_SETMASK, [], NULL) = 0 sigprocmask(SIG_BLOCK, ~[ILL TRAP ABRT EMT FPE BUS SEGV SYS], []) = 0 sigprocmask(SIG_SETMASK, [], NULL) = 0 --- SIGSEGV (Segmentation fault) --- --- SIGSEGV (Segmentation fault) --- === Can someone please help?? I can provide a fuller strace if someone might be able to decipher my problem from this. Very, very, lost, Cheers, Rafiq SERVER CONFIGS: (1)'original server settings' - Server version: Apache/1.3.24 (Unix) Modperl: 1.26 Compiled-in modules: http_core.c mod_so.c Server compiled with -D EAPI -D HAVE_MMAP -D HAVE_SHMGET -D USE_SHMGET_SCOREBOARD -D USE_MMAP_FILES -D HAVE_FCNTL_SERIALIZED_ACCEPT -D HAVE_SYSVSEM_SERIALIZED_ACCEPT -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D HTTPD_ROOT="/usr/local/apache" -D SUEXEC_BIN="/usr/local/apache/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/httpd.scoreboard" -D DEFAULT_LOCKFILE="logs/httpd.lock" -D DEFAULT_XFERLOG="logs/access_log" -D DEFAULT_ERRORLOG="logs/error_log" -D TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" -D ACCESS_CONFIG_FILE="conf/access.conf" -D RESOURCE_CONFIG_FILE="conf/srm.conf" (2)'new server settings': - Server version: Apache/1.3.26 (Unix) Mod_Perl: 1.26 Compiled-in modules: http_core.c mod_so.c Server compiled with -D HAVE_MMAP -D USE_MMAP_SCOREBOARD -D USE_MMAP_FILES -D HAVE_FLOCK_SERIALIZED_ACCEPT -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D SO_ACCEPTFILTER -D ACCEPT_FILTER_NAME="httpready" -D HTTPD_ROOT="/usr/local" -D SUEXEC_BIN="/usr/local/sbin/suexec" -D DEFAULT_PIDLOG="/var/run/httpd.pid" -D DEFAULT_SCOREBOARD="/var/run/httpd.scoreboard" -D DEFAULT_LOCKFILE="/var/run/httpd.lock" -D DEFAULT_ERRORLOG="/var/log/httpd-error.log" -D TYPES_CONFIG_FILE="etc/apache/mime.types" -D SERVER_CONFIG_FILE="etc/apache/httpd.conf" -D ACCESS_CONFIG_FILE="etc/apache/access.conf" -D RESOURCE_CONFIG_FILE="etc/apache/srm.conf"
Re: More Segfaultage - FreeBSD, building apache, ssl, mod_perl from ports
On Tue, 12 Nov 2002, Dominic Mitchell wrote: > > I'm sure that the BSD users amoungst you have all done it 101 times. > > Nope, ports only supports mod_perl as a DSO. oh, poop. > The alternative is to use something like apache toolbox[1] to install it > all in one go. If you want to be sneaky, you can always get a list of > files post-install and run it through pkg_create to fake up a package. > It's what the ports makefile does for you behind your back, anyway... Sounds fun. I'll look into pkg_create. Cheers. Rafiq
More Segfaultage - FreeBSD, building apache, ssl, mod_perl fromports
I'm a bit irritated by FreeBSD ports at the moment and need somoene to shine some light. I need to build Apache from ports on a BSD box - it has to be from ports - but i don't want to include mod_perl in as a dso. Thus, I'd like to go to ports and 'Make' with a bunch of options which will compile mod_perl straight into my apache1.3-ssl package. Having run make on www/apache1.3-ssl and www/mod_perl, all I get is segfaults. I simply want to run one make to build it in one go. How??? I'm sure that the BSD users amoungst you have all done it 101 times. Help please? Cheers, Rafiq
Re: Help mod_perl 1.27 and DB
On Fri, 8 Nov 2002, Tony Simbine wrote: > GET http://www.myhost.com/myscript.perl > >now I get the results as expect > GET http://www.myhost.com/myscript.perl > >now I get an error > wenn i reload my apache-webserver, then i allways get the expected page. > how can i resolve it? You know he's right? It's always best to show what your errors actually are. Read the modperl guide and it will show you that this sort of behaviour comes from globals bouncing between processes. Scrop your variables and you'll be a happy man. Always use strict and .. it's a friday night, I'm going to frag now. Read the guide, it's in there. It's under common pitfalls or something of that nature. byebye.
Re: OT: Help with SQL SELECT on Varchar from character 0..n
Doh! SUBSTR - I forgot to wear my brain this morning. On Tue, 17 Sep 2002, Rafiq Ismail (ADMIN) wrote: > Hi, > > I'm using postgres and remember having done something ages ago with some > operator in mysql, although it makes zero sense to me now as to how I did > it the first time. What I want to do is have a select return a partial > string from the ith character of a string to the jth character of a > string. I'd like postgres to filter this partial string and return it to > me. > > Any ideas how I can go about doing this without using postgres regular > expressions? Am I simply imagining that I managed to do this the first > time around? Or should I be ashamed that I don't remember how to do it > this time around? > > Cheers, > > Rafiq > > > > >
OT: Help with SQL SELECT on Varchar from character 0..n
Hi, I'm using postgres and remember having done something ages ago with some operator in mysql, although it makes zero sense to me now as to how I did it the first time. What I want to do is have a select return a partial string from the ith character of a string to the jth character of a string. I'd like postgres to filter this partial string and return it to me. Any ideas how I can go about doing this without using postgres regular expressions? Am I simply imagining that I managed to do this the first time around? Or should I be ashamed that I don't remember how to do it this time around? Cheers, Rafiq
Apache::Session HELP!
Hi, I'm in major poop. Got a presentation soon and my just implemented, implementation of Apache::Session is not working as per the man page. I've set commit to 1 and tied a session to a postgres database. I then set a field and check the table it's not there. When I later do a fetch on it, I get a scarey error: [error] Object does not exist in the data store at /usr/lib/perl5/site_perl/5.6.1/Apache/Session/Store/Postgres.pm line 81 Create and fetch methods, with table schema, below: 1)Create: sub tieSession { my $self = shift; my %session; my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST; print STDERR "\n CREATING SESSION using dsn: $dsn \n"; tie %session, 'Apache::Session::Postgres', undef, { DataSource => $dsn, UserName => $DBI_USER, Password => $DBI_PWD, Commit => 1 }; ## store creation time $session{CREATION_TIME}=time; return \%session; } 2) fetching the session: sub fetchSession { my $self = shift; my $sessionId = shift; my $dsn = "DBI:Pg:dbname=".$DBI_DB.";host=".$DBI_HOST; my %session; print STDERR "\n getting session for $sessionId\n"; tie %session, 'Apache::Session::Postgres', $sessionId, { DataSource => $dsn, UserName => $DBI_USER, Password => $DBI_PWD, Commit => 1 }; ## store last access $session{LAST_ACCESS} = time; $ENV{GUEST_ID} = $session{GUEST_ID} || undef; return \%session; } 3) Table Schemata CREATE TABLE sessions ( id char(32) not null primary key, a_session text ); help? Cheers, fiq
RE: Some wierd problem with mod_perl and Apache
On Sat, 3 Aug 2002, Ged Haywood wrote: > Hi there, > > On Sat, 3 Aug 2002 [EMAIL PROTECTED] wrote: > > > Well I wouldn't use CGI.pm just to call param(). > > > > If I don;t use CGI.pm, it complains during compilation > > - Undefined subroutine &Apache::ChangePassword::param. > > Yup. You need to parse the input some other way. It's not difficult. the one liner from the good old book: my %params = $r->method eq 'POST' ? $r->content : $r->args; Shove that in your handler somewhere and pass it around. Remember that $r is your request object.
RE: CGI Scripts w/mod_perl
On Fri, 26 Jul 2002, Mark Coffman wrote: > Try running "which perl" and use that path for your #!/usr/bin/perl line. > Then rename your script as .cgi and see if that helps. Um.. yeah, ignore all my "locate" tribble. 'which' is the way to go. That wasn't a question.
PerlSendHeader and $r->header_out
Hi People With Functioning Brain Cells, I'm having a brief period of grief, which I'm sure I've been through before. I have this situation where I set a cookie using: $r->header_out('Set-Cookie'=>$cookie); Now this is all fine, however I'm having a major problem in getting my header into the right place. If I call $r->send_http_header right after my $r->header_out(set_stuff) directive, and then call $r->print("page contents"), I get: page_contents HTTP_HEADERS DISPLAYED HERE (INCLUDING COOKIE HEADER) Now, I experimented with PerlSendHeader being set to On, whilst disabling the call to $r->send_http_header, yet it then appears to give me a header which doesn't include the cookie header: HTTP/1.1 200 OK Date: Thu, 25 Jul 2002 13:01:12 GMT Server: Apache/1.3.20 (Linux/SuSE) PHP/4.0.6 mod_perl/1.26 Transfer-Encoding: chunked Content-Type: text/html Any idea what is going on? I'd like to just send_http_header with the headers appearing on top of my page. It appears to do things in the wrong order. There is no duplication of headers either. If anyone can help and would fancy flying me out, I'll even buy you a beer. :) My content handler returns the result of another method called within the same module. This method is passed the request object, which in turn it uses to send the headers and print the page. This seems 'sensible' to me; so why is it not working?? Many Thanks, Fiq "We're so wonderfully wonderfully wonderfully Wonderfully pretty Oh you know that I'd do anything for you We should have each other to tea, huh? We should have each other with cream Then curl up by the fire And sleep for awhile It's the grooviest thing It's the perfect dream" - The Cure, "Love Cats."
Caching in TT2 or Some Mod Perl oddity
I'm in a baffled state, ladies and gentleman. I'm using TT2 to ultimately display some pages, however I'm having some rather odd behaviour creeping in. In my template constructor I have CACHE_SIZE set to 0. I have a page which - even after a server restart - reverts to an older version of the page. Whilst I was still debugging, I accidently had Data::Dumper doing a print STDOUT and a lovely $VAR1=[] in the corner of my screen. This has long since been removed from my code, however I keep going through hits of the same page - as I said, even after a restart - where either I have the 'correct' funky page, or on the next hit reverting to the old over funked paged. >From my understanding of TT2, it's not the actual page which is cached but some sort of compiled version of the nested code (?). Thus I'm having trouble seeing how it might be a TT2 problem, especially with {CACHE_SIZE=>0} whenever Template is instantiated. Is it TT2 or is it some Mod_Perlus Oddity? Anyone? Cheers, Fiq 'Don't you love her madly? Don't you need her badly? Don't you love her ways? Tell me what you say? Don't you love her madly? want to be her daddy? Don't you love her face? Don't you love her as she's walking out the door?' - Jim Morrison, The DoorS.
Idiot question: headers at the base of the page.
I'm doing squinty eyed coding and need someone to knock common sense into me. In the right order - as far as I can see - I have my content_type ;send_http_headers; $r->print'ed. With loads of poo in between. Under what circumstances would my page render, dumping the HTTP headers at the base? Other than their being sequentially out of order, that is. It's probably one of those look at it again in the morning questions. Someone hit me over the head with a hammer please.
Re: [OT] MVC soup (was: separating C from V in MVC)
> On Thu, 6 Jun 2002, Bill Moseley wrote: > > > Anyone have links to examples of MVC Perl code (mostly controller code) > > that does a good job of M and C separation, and good ways to propagate > > errors back to the C? I'm working on my own impelmentation at the moment and am planning to have a mechanism in my unoverridden forms controller subclass which hosts methods which can validate data based on types derrived from the form's input names, together with a set of valid fields. For more complex validation I'm planning on subclassing and overloading these methods. The validation routines get called if there is a '_validate' field and these in turn generate an errors structure which gets fed to the View's view of the model. I have a seed method in my controller which determines the execution order, however what it does is call other seeds in the model layer. If all is cool, it does an internal redirect to the next page as supplied in a hidden field - or determined at runtime. You'll have to excuse me for the mubling, but my face is currently being stuffed full of falafal. :) Try some? Fiq.
Re: [OT] MVC soup (was: separating C from V in MVC)
On Thu, 6 Jun 2002, Bill Moseley wrote: > Anyone have links to examples of MVC Perl code (mostly controller code) > that does a good job of M and C separation, and good ways to propagate > errors back to the C? "http://pagekit.org,"; might be interesting. Fiq
Re: MVC advice..?
Ello, On 29 May 2002, Randal L. Schwartz wrote: > >>>>> "Rafiq" == Rafiq Ismail (ADMIN) <[EMAIL PROTECTED]> writes: > Rafiq> Is there a neat way of dynamically loading in the appropriate control > Rafiq> subclass? Something proven and widely used. > > Load the file with a require, and then just call the appropriate > constructor using an indirect call: > > require "My/Prefix/$type"; # presuming $type has no colons > $myClass = "My::Prefix::$type"; > my $handler = $myClass->new(@parms); > > This works even in "use strict". Thanks. This is pretty much the handler which I'd previously written, with the the exception of s/use/require/. I'll probably either go with Apache::Dispatch, using the DispatchRequire option, or write something custom. On Wed, 29 May 2002, Perrin Harkins wrote: > So, you're asking how to map URLs to perl modules? Is there some reason > you aren't simply using httpd.conf or Apache::Dispatch? In my last MVC I just took a look at Apache::Dispatch and I get he impression that if I were to use it then I would have to either PerlModule 'all' my subclasses beforehand, or alternateively use the DispatchRequire option anyway. I'm already using StatINC so I'm going to have to do a toss between code which I've already written and converging to the Apache::Dispatch interface. I'm not so keen on loading all the inheriting classes into memory beforehand, nor setting up multiple handlers for each location. It's a fairly large site and my main concern was to do with how I should store the correspondence from uri to object. > design, we had all of our controllers inherit from one base controller > that held all of the common code. I could just map from URLs to the specific control subclasses and then use Dispatch to require them - I'd already started on writing a mapping from path names to relative namespaces. I was still 'eval/use'ing the Modules though. How does StatINC behave with 'required' packages? Hmm.. it's "make your mind up time. ;) Thanks for the tips. Cheers, Fiq __ "__ __ _ __ __ | \/ | ___ __| | ___ _ __ _ __ | \/ | __ _ _ __ | |\/| |/ _ \ / _` |/ _ \ '__| '_ \| |\/| |/ _` | '_ \ | | | | (_) | (_| | __/ | | | | | | | | (_| | | | | |_| |_|\___/ \__,_|\___|_| |_| |_|_| |_|\__,_|_| |_| a pathetic example of his organic heritage" - Bad Religion
MVC advice..?
Hi, I'm building an MVC architecture site and have hit a design issue. I have varoius Control subclasses which relate to different templates with different behaviour. Now my problem is that I have to assign which Subclass I want to instantiate, based on the script and params. I my last effort I went for a Shared datastructure holding (script, control module pairs) which then allowed one to be dynamically "eval 'use..'"'ed in the main content handler. I found that clunky. I'm building from scratch again and am thinking of just firing up a template and allowing the control to be loaded INTO the view as a template toolkit plugin. What I hate about this is that I'm surrendering my View layer. Is there a neat way of dynamically loading in the appropriate control subclass? Something proven and widely used. Cheers, Fiq "__ __ _ __ __ | \/ | ___ __| | ___ _ __ _ __ | \/ | __ _ _ __ | |\/| |/ _ \ / _` |/ _ \ '__| '_ \| |\/| |/ _` | '_ \ | | | | (_) | (_| | __/ | | | | | | | | (_| | | | | |_| |_|\___/ \__,_|\___|_| |_| |_|_| |_|\__,_|_| |_| a pathetic example of his organic heritage" - Bad Religion
Re: tt2 using mason tags
> Mark Fowler wrote: > Agreed. Also, any significant Mason component is likely to use Mason's > built-in object model, which is not part of TT. You will probably have > to port some code before it will run. Understood, but it's a small application which is more custom o.o. perl and inline perl based than it is custom mason. Other than the fact that it gets rendered by mason, it is pretty independent. It's just the fact that in spite of my specifying that it should use inline_perl, it didn't interpolate the inline code which uses custom modules in mason tags. I've got it to try and interpolate now, however it seems to warn that "$VARNAME's" are odd symbols. I'll look at that later. Going to redo the whole thing in tt2 directives anyway. Cheers to all. fiq __ "__ __ _ __ __ | \/ | ___ __| | ___ _ __ _ __ | \/ | __ _ _ __ | |\/| |/ _ \ / _` |/ _ \ '__| '_ \| |\/| |/ _` | '_ \ | | | | (_) | (_| | __/ | | | | | | | | (_| | | | | |_| |_|\___/ \__,_|\___|_| |_| |_|_| |_|\__,_|_| |_| a pathetic example of his organic heritage" - Bad Religion
tt2 using mason tags
Hi, I'm experimenting with conversion of a mason template based system to tt2. I tried to set TT2Tags to mason and then to <% > however this, even with the evaluate option to on, doesn't seem to work. (Apache::Template) I then wrote a custom handler which uses a custom parser, which I've constructed with the tag style set to mason. No go there either. I've got inline perl turned on, however I seem to alternate between a random permissions error (probably a silly oversight) and an unevaluated tempalate. Does this sound familiar? Has anyone had any success with porting straight from Mason? Part two would be to replace the inline code with tt2 directives- thought it was worth mentioning this before getting flamed. :) I'm just after evaluation with mason tags. Anyone? TIA, fiq __ "__ __ _ __ __ | \/ | ___ __| | ___ _ __ _ __ | \/ | __ _ _ __ | |\/| |/ _ \ / _` |/ _ \ '__| '_ \| |\/| |/ _` | '_ \ | | | | (_) | (_| | __/ | | | | | | | | (_| | | | | |_| |_|\___/ \__,_|\___|_| |_| |_|_| |_|\__,_|_| |_| a pathetic example of his organic heritage" - Bad Religion
Re: PDF's [OT I THINK]
Hi Geoff, > not sure where to start looking for some info, so I thought here first > > I need to be able to print pdf's from an apache webserver using perl... > I know usually that just an link to the file is sufficient, but these files > are outside of the /var/www/path to webserver. In such cases I usually point to a dynamic link which then sets the mime type and then reads and spews out the document. The browser will then either render or hit you with a save option. fiq __ "__ __ _ __ __ | \/ | ___ __| | ___ _ __ _ __ | \/ | __ _ _ __ | |\/| |/ _ \ / _` |/ _ \ '__| '_ \| |\/| |/ _` | '_ \ | | | | (_) | (_| | __/ | | | | | | | | (_| | | | | |_| |_|\___/ \__,_|\___|_| |_| |_|_| |_|\__,_|_| |_| a pathetic example of his organic heritage" - Bad Religion
Re: DBI: selectall_hasref incompatibility
Fixed it with common sense - using "values %$result" to get back my original struct. Time to upgrade DBI. Cheers anyway. And a great big nasty insult to the wonderful guy who went and made the selectall_hashref method do what it logically sounds like it should do. ;) fiq On Tue, 2 Apr 2002, Rafiq Ismail (ADMIN) wrote: > Got a slight problem here.. > > Does anyone know why there was at some point a major change in the return > value for DBI::selectall_hashref? And is there a depricated method which > still uses the original prototype? > > My problem: > --- > > Using DBI V1.19 on my box, the reported prototype is: >""selectall_hashref"" > $ary_ref = $dbh->selectall_hashref($statement); > $ary_ref = $dbh->selectall_hashref($statement, \%attr); > $ary_ref = $dbh->selectall_hashref($statement, \%attr, > @bind_values > > > So i wrote shiney happy code and tried it on our production box. > > > On the Production box, using DBI V1.21, the given prototype is: > >selectall_hashref > > $hash_ref = $dbh->selectall_hashref($statement, $key_field); > $hash_ref = $dbh->selectall_hashref($statement, $key_field, > \%attr); > $hash_ref = $dbh->selectall_hashref($statement, $key_field, > \%attr, @bind_values); > > > hmm.. I sware that I saw something similar about a year ago. > > I don't want to go about rewriting code, so has anyone found some secret > undocumented method which still use the original prototype. > > > TIA, > > fiq > > > "__ __ _ __ __ > | \/ | ___ __| | ___ _ __ _ __ | \/ | __ _ _ __ > | |\/| |/ _ \ / _` |/ _ \ '__| '_ \| |\/| |/ _` | '_ \ > | | | | (_) | (_| | __/ | | | | | | | | (_| | | | | > |_| |_|\___/ \__,_|\___|_| |_| |_|_| |_|\__,_|_| |_| > a pathetic example of his organic heritage" > - Bad Religion > > >
DBI: selectall_hasref incompatibility
Got a slight problem here.. Does anyone know why there was at some point a major change in the return value for DBI::selectall_hashref? And is there a depricated method which still uses the original prototype? My problem: --- Using DBI V1.19 on my box, the reported prototype is: ""selectall_hashref"" $ary_ref = $dbh->selectall_hashref($statement); $ary_ref = $dbh->selectall_hashref($statement, \%attr); $ary_ref = $dbh->selectall_hashref($statement, \%attr, @bind_values So i wrote shiney happy code and tried it on our production box. On the Production box, using DBI V1.21, the given prototype is: selectall_hashref $hash_ref = $dbh->selectall_hashref($statement, $key_field); $hash_ref = $dbh->selectall_hashref($statement, $key_field, \%attr); $hash_ref = $dbh->selectall_hashref($statement, $key_field, \%attr, @bind_values); hmm.. I sware that I saw something similar about a year ago. I don't want to go about rewriting code, so has anyone found some secret undocumented method which still use the original prototype. TIA, fiq "__ __ _ __ __ | \/ | ___ __| | ___ _ __ _ __ | \/ | __ _ _ __ | |\/| |/ _ \ / _` |/ _ \ '__| '_ \| |\/| |/ _` | '_ \ | | | | (_) | (_| | __/ | | | | | | | | (_| | | | | |_| |_|\___/ \__,_|\___|_| |_| |_|_| |_|\__,_|_| |_| a pathetic example of his organic heritage" - Bad Religion
Re: modperl and SQL db select
Postgres: +More relational? So they say. More features perhaps. +stored procedures - ie. you can make query wrapping methods -pain the rear postgres user permissions to control. +been doing complex sql queries (subselects etc,) for longer. +Reminds me a lot of what I used to be able to do with oracle. +probably faster to set up ( than oracle ;) ). +every element of the database has a unique oid field which internally makes everything uniquely accessible by this field. +has all or nothing transaction support to avoid partially corrupting your data - it either completes the query(or group of queries) or it does'nt - useful when it's under heavy load or joe blogs comes along writes cr@p code and dependent writes updates to the live db, since he enjoys making changes to live, he doesn't know much sql and and he mispells "update" in the second query. Ooops. He's got a partially altered database and who knows what insanity this might cause for us. Or even manager blogs using odbc and doing the same there with his 'i'm a techie deep down' script. That was long! +Better under heavy load. +Clean shutdowns under heavy load. +psql has a cr@p command line. +better optimizer Mysql:+we all start with it. +Bench marks much faster. +/-Can allow nested queries (subselects again) though this is a relatively new feature. +People say it's less relational. Isn't really - but has fewer features (see above) +Doesn't have stored procedure support. +Think that I've read that it's indexing mechanism is not as good as postgres'. +probably easier to grasp if you haven't used it before +negate all of the above postgres points. -less reliable under heavy load. Images: Image::Magick - probably don't want the pictures themselves in the database, so much as pointers to their physical location and a means of pushing them in and out - use this for getting stats on them and manipulating thumbnails etc. My .02 EU Probably get flamed for being all wrong. But I'm not. So there!! :) Happy First Day of Spring, fiq On Thu, 21 Mar 2002, dreamwvr wrote: > hi, > > Is there any issue with using modperl with postgres vs mysql > for a database driven website? Don't want to bark up the wrong > tree in a mod_perl project only to discover I picked the wrong .db :-/ > > >From a licensing perspective which one is less risky if doing some > work for a client? Noticed slashcode however the postgres port > has stopped. AFAIK anyhow. Thought if practical I would do > some coding to integrate Postgres if it is the right choice. > If not MySQL? Just wanted to confirm that either is safe for a > customer to use. They would not sell the program but they might > sell the programs I write and the actual singular database. > >Basically I want to simply insert data into a > .db and then produce HTML from the results and queries. > The thought has crossed my mind to as well output the images > as well from the .db What mod:perl modules should I seriously > consider. Appreciate any pointers here as am just about to > to begin the DBI:: stuff. > > TIA > [EMAIL PROTECTED] > > > >
Re: [OT] Return Receipts
A quick fix might be to stick your from header in your script, when generating the email. fiq On Thu, 21 Mar 2002, Ewen Marshall wrote: > I apologise striaght away for the completly off topic mail, but I'm desparate! > > I am having problems with return receipts from our users here at work. When someone > requests a return receipt and I click okay, I get a Mailer-Daemon with the error: > > >>> MAIL From:<@@fransmaas.co.uk> SIZE=2583 > <<< 501 <@@fransmaas.co.uk>: domain missing or malformed > > For some reason it appears that the return receipt is not picking my email address as > being the "From:" address and the mail server (Sun box, Solaris 2.6) is substituting > the "From:<>" with "From:<@@fransmaas.co.uk>" When I have a look at the sendmail >config > (sendmail.cf) I can find: > > # handle "from:<>" special case > R$*<>$* $@@ turn into magic token > > Has this got anything to do with the problem? Please be aware that my sendmail >knowledge > is very poor :( > > Thanks in advance for any help. > > Ewen >
Re: Document Caching
On Wed, 6 Mar 2002, Rasoul Hajikhani wrote: > Robert Landrum wrote: > > #startup.pl > > > > open(FILE," > $MY::TEMPLATE .= while(); > > close(FILE); > Thanks... But I use Template Toolkit to generate a dynamic file. How > would the above code work in that situation?! Not how I'd do it, although I'm pretty sure that TT2 has it's own caching mechanism, however in answer to this 'particular question' could you not overload TT's service object to use the preloaded instantiation similar, or more specialised than the one above. (SEE ALSO man Template::Service ..probably) :) fiq btw Apache::Template does let you control caching of templates in memory.
Re: how to pass data in internal redirects?
Surprisingly I'm actually doing a proof of principle on the same theme. I'm developing a set of MVC classes which tie in with either tt2 or mason. I've got abstract Model, View and Controller classes. View can be subclassed into HTML, XML, whatever. I'm using normal classes at the moment, but if I get the go ahead, I'll be replacing these with some sort of pseudo-hash framework. My controller object would use the request object and the environment to determine a framework/templates and which overloaded Controller to generate. There is a generic events handler in the base class, which gets overloaded and which specialises the associated model object for the particular view subclass. I haven't looked at pre-reading the model and passing it into the first content handler, since in my case the model is likely to emerge from a large dataset. Once possible idea, floating in my head is to follow a principle adopted by the first company i was with, in that I could have a transitory daemon through which the data is called - this could possibly cache models requests, preventing second re-reads; also checking to see if the underlying model has changed, as per the original MVC paper. I guess that we can then reaccess the model at any point thereafter so that the the controller doesn't need to reaccess the data. Another point would be to cache the final generated templates, so that the view and controller override interaction with the model, where this data is already persistant. Got my basic framework in place - might make it my first cpan release if I can figure out how - want to share ideas? fiq On Tue, 26 Feb 2002, F. Xavier Noria wrote: > As an exercise studying mod_perl I am trying to see how could the MVC > pattern be implemented. I've thought a possible approach would be to > write the model using normal Perl classes, and controllers and views > with Apache modules. > > I suppose that controllers would use internal redirects to call the > views, is there a way to pass Perl data this way? For example, in the > hangman game in O'Reilly's book a controller would load a session from > the cookie, process user's guest, modify the state and redirect the > request internally to the view. Ideally the view shouldn't read the > data to display from the database again... could it be passed somehow by > the first content handler? > > -- fxn > >
Re: Mistaken identity problem with cookie (fwd)
Although all your cookies will be probably be going to the same proxy for those requests from the same isp, the tcp-ip session will remain the same and it is most likely that you'll still be connected to the same ip which made the initial proxy connection. My thought is possibly that you're misuing global variables here, or that you have name space issues? Thus the variable which you are setting your cookie value with may not be correctly reset. Just a thought. Fiq
Re: Samba authorization
Have you tried running a locate on AuthenSmb.pm to make sure that it's under your @INC? Wondering whether you installed it in the correct location? Try sticking a : use lib "path/to/Apache"; a little higher up. Fiq On Mon, 11 Feb 2002, Andrew Afliatunov wrote: > Hi! > > I want to use authorization against NT server for some directories of my > web server (apache 1.3.22 on SunOS 5.8). So I installed mod_perl-1.26 > (configured with EVERYTHING=1), installed Authen-Smb-0.91 and > Apache-AuthenSmb-0.60, made corresponding changes in httpd.conf. > ( > > Options Indexes FollowSymLinks Includes > AllowOverride None > AuthType Basic > PerlSetVar myPDC e250.taom.lan > PerlSetVar myBDC e250.taom.lan > PerlSetVar myDOMAIN ACADEMY > AuthName "Administrator's page" > require user u0100659 > PerlAuthenHandler Apache::AuthenSmb > > ). > But when I try to go to the directory, apache says - "Internal Server > Error", and in error.log file I see "Undefined subroutine > &Apache::AuthenSmb::handler called". But all necessary files shurely > exist and they have appropriate rights. I can't understand what's the > matter? Please, help! > > > -- > Andrew > > > >
Re: Can't locate Sybase/CTlib.pm
btw, my assumption here was that massive long line in your -I is some how wrong. Well it's got to be right? Fiq On Thu, 7 Feb 2002, Rafiq Ismail (ADMIN) wrote: > Hi Lynne, > > On Wed, 6 Feb 2002, Ng, Lynne (Exchange) wrote: > > #!/usr/bin/perl -I > > /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Sybase:/usr/local/lib/perl > > 5/site_perl/5.005/sun4-solaris/auto/Sybase > > use Sybase::CTlib; > > @INC = @lib::ORIG_INC; ** > > print "Hello world"; > > ** Assuming that "@INC = @lib::ORIG_INC;" will add the path for Sybase to > your @INC, you've got the order wrong. You should: > > @INC=... and then > use Sybase::CTlib; > > > It showed this error: > > Can't locate Sybase/CTlib.pm in @INC > Thus, your script was unable to find CTlib.pm. > > > Fiq > > >
Re: Can't locate Sybase/CTlib.pm
Hi Lynne, On Wed, 6 Feb 2002, Ng, Lynne (Exchange) wrote: > #!/usr/bin/perl -I > /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Sybase:/usr/local/lib/perl > 5/site_perl/5.005/sun4-solaris/auto/Sybase > use Sybase::CTlib; > @INC = @lib::ORIG_INC; ** > print "Hello world"; ** Assuming that "@INC = @lib::ORIG_INC;" will add the path for Sybase to your @INC, you've got the order wrong. You should: @INC=... and then use Sybase::CTlib; > It showed this error: > Can't locate Sybase/CTlib.pm in @INC Thus, your script was unable to find CTlib.pm. Fiq
Re: Server error log says "Accept mutex: sysvsem"
Not sure but it just looks like you're getting confirmation of semaphore locking which is probably occuring between the different processes - I'd guess. Then again, it's worrying that it's being directed to STDERR. My guess would be that it's harmless. Check the options with which you rebuilt apache; you haven't got excessive debugging info have you? Someone with much more wisdom may prove me wrong - I'm just filling an empty moment with speculation. :) fiq On Tue, 5 Feb 2002, Al Pacifico wrote: > The following message keeps appearing in my server error log after > building a newer version of Apache (v.1.3.23) and mod_perl (v.1.26) than > I had been running. I never saw this before (I think I had Apache 1.3.20 > with mod_perl 1.24 most recently). > What does it mean and should I worry? > > [Tue Feb 5 11:44:46 2002] [notice] Accept mutex: sysvsem (Default: > sysvsem) > > Thanks in advance. > -al > Al Pacifico > Seattle, WA > >