Commit Graph

366 Commits

Author SHA1 Message Date
ian%hixie.ch
aa5488a873 Neaten up the arguments display: limit the depth, allow integers to be unquoted as well as floats, crop long strings. 2002-12-30 08:02:40 +00:00
ian%hixie.ch
4504de3dc3 Remove bogus argument, and add error checking code to catch similar errors in future 2002-12-30 07:52:19 +00:00
ian%hixie.ch
f7331c74e8 Export the syntaxError function, which reports a syntax error where the caller was invoked. 2002-12-30 07:30:43 +00:00
ian%hixie.ch
15e0f695ed Reduce the number of sites that call 'caller'. Let's hope that this doesn't get optimised too much, or else the line numbers will start getting increasingly inaccurate... 2002-12-30 07:28:45 +00:00
ian%hixie.ch
33256ecd89 Add support for reporting Exceptions as warnings, for parity with, and so that PLIF can transition from, Carp.pm 2002-12-30 07:06:34 +00:00
ian%hixie.ch
908bc39af0 Remove debugging code that accidentally got checked in. 2002-12-30 06:43:27 +00:00
ian%hixie.ch
dc9577f495 Clean up the stack trace code: make stacktrace smarter about where the exception should be reported from, make it know about the arguments to the functions, make the stringifier know about try{} blocks 2002-12-30 06:40:05 +00:00
ian%hixie.ch
007df6e6bf Additional comments explaining what might happen in cases of key clashes. 2002-12-29 21:02:59 +00:00
ian%hixie.ch
c66533cb57 Minor grammatical fix. 2002-12-29 21:02:22 +00:00
ian%hixie.ch
7ef7c159fa Fixing the support for the 'attempt()' method on databases, which was broken while fixing the fallout from the Exception stuff. 2002-12-29 03:56:00 +00:00
ian%hixie.ch
cb536855e9 Allow catch...with statements to not be followed by anything. Also add a little debug code. 2002-12-28 18:24:27 +00:00
ian%hixie.ch
bef362c12b Unify the statement execution methods so that we can have consistent exception raising 2002-12-28 18:23:24 +00:00
ian%hixie.ch
fae823b4df Add rudimentary stacktrace support to the Exception library 2002-12-28 03:31:59 +00:00
ian%hixie.ch
7d166375f0 Propagate the results out of the 'row' function correctly again -- the wantarray context isn't maintained inside a try block, unfortunately 2002-12-28 03:27:23 +00:00
ian%hixie.ch
4dba2cd88d Update PLIF to take advantage of the new PLIF exception handling library 2002-12-26 04:37:22 +00:00
ian%hixie.ch
99314b20ca Fix the context-sensitive code to actually work. Fix the result returning code to actually work too. Make wrapped exceptions include actual filename and line info. 2002-12-26 04:35:17 +00:00
ian%hixie.ch
0d0ae7d60a Rename 'handle' to 'catch' and 'unhandled' to 'fallthrough', so that we get fewer clashes with existing code. 2002-12-26 03:33:22 +00:00
ian%hixie.ch
0ee3e91c0f Remove trailing spaces, add a missing parenthesis, add 'otherwise' to the list of exported keywords, support 'ne' operator on exception objects. 2002-12-26 03:11:34 +00:00
ian%hixie.ch
d54b3e292e Add support for an "otherwise" block which is called if no exception is triggered. Also, refactor the code to shorten it a bit. 2002-12-26 02:07:19 +00:00
ian%hixie.ch
cc6612cb32 Handle exceptions raised inside exception blocks by reraising them after the finally block. This code is going to need some refactoring at some point... 2002-12-25 16:48:54 +00:00
ian%hixie.ch
1fb3cfa7e6 If the exception isn't handled, it should be re-raised. 2002-12-25 16:20:03 +00:00
ian%hixie.ch
08576caa95 Minor comment fixup 2002-12-25 14:14:11 +00:00
ian%hixie.ch
94ba618ca7 Change the semantics of |try| to return the result of the try block when no exception is raised. 2002-12-25 12:37:38 +00:00
ian%hixie.ch
549c37cfed Add basic stringification to exceptions 2002-12-25 12:20:34 +00:00
ian%hixie.ch
97dcbdca4b A standalone class to provide thorough Exception handling in Perl. This, like the Magic* classes, could easily be used separate from PLIF. 2002-12-25 00:39:40 +00:00
ian%hixie.ch
87e57b8706 Remove the annoying 'tried to log in but was already logged in' warning that would be hit each time someone clicked a link to, or used a bookmark to, a login page. 2002-12-23 11:49:01 +00:00
ian%hixie.ch
e31b3f03a1 Mark GET and HEAD requests as idempotent. Commands still have to explicitly support this, of course. 2002-12-23 11:47:20 +00:00
ian%hixie.ch
749f789e24 Add support for cookies using the new getSessionData() API. 2002-12-23 11:46:30 +00:00
ian%hixie.ch
fb9e51fe7c Minor fixups on the regexps. Add support for '--' to signal the end of the arguments (although at the moment it only cancels the previous argument rather than indicating the end of any flag arguments). Change the --batch-force-defaults to be the default --batch mode, and make the old --batch mode be called --batch-no-defaults. This could change again later. 2002-12-23 11:45:37 +00:00
ian%hixie.ch
0c01fe51db since the default getMetaData() does the same now, removing this redundant implementation 2002-12-23 11:42:57 +00:00
ian%hixie.ch
cbbe1c72bc Change getMetaData() to default to undef rather than requiring that it be implemented in descendants. Introduce getSessionData() for things like cookies. Introduce idempotent() so that protocols that can guarentee side-effect-free requests have a way of signalling their wishes. 2002-12-23 11:41:53 +00:00
ian%hixie.ch
3498a14071 user prefs should be a POST not a GET. 2002-12-23 11:39:43 +00:00
ian%hixie.ch
1251dcec2c Have to escape the error message, otherwise it gets treated as HTML, oops\! 2002-12-23 11:38:50 +00:00
ian%hixie.ch
6a68387af2 Minor typo fix in debug code 2002-12-23 11:37:42 +00:00
ian%hixie.ch
2c46254cc4 Change the Controller to inherit from PLIF::Service, so that we can reuse the 'dispatch' method from that class in Program.pm. Change the defaulting of the application name to be handled by a default name() implementation in Programepm rather than setting it in Controller.pm. Added a comment next to dispatchMethod() to clarify its role. 2002-12-23 11:35:06 +00:00
ian%hixie.ch
a51906cdd3 Round correctly. This makes the '1 hour' and other singular forms work correctly. 2002-12-22 22:21:59 +00:00
ian%hixie.ch
fee7932869 Add a 'sprintf' operator to scalars 2002-12-22 22:21:07 +00:00
ian%hixie.ch
2f950cccca Add a convenient 'time delta in seconds' to 'brief duration description in english' convertor. Escaped the values in an HTML output string. 2002-12-22 15:44:50 +00:00
ian%hixie.ch
39ce940866 Fix it so HEAD requests actually work rather than Apache aborting due to 'incomplete headers'. 2002-11-19 06:54:35 +00:00
ian%hixie.ch
b1b1a23aa5 Move FileStrings and GenericOutputs to below the MySQL string datasource. 2002-11-10 17:00:44 +00:00
ian%hixie.ch
183cbef007 Stop requiring that PLIF applications know about every last PLIF service in order to use PLIF. This will require a one-time change to every PLIF app's registerServices method, but will make future changes a lot easier. 2002-11-10 16:39:09 +00:00
ian%hixie.ch
b4421910e1 More debugging information, to make it easier to debug multiple PLIF-based projects that are outputting to the same error log. 2002-11-09 15:26:41 +00:00
ian%hixie.ch
574e9443e3 Adding more debug code to make my life easier. 2002-11-02 17:56:51 +00:00
ian%hixie.ch
ec55dafdc3 Two new filters (substr and acronymise), plus renaming uri_parameter to uriparameter to be consistent with the other filters 2002-10-26 22:43:01 +00:00
ian%hixie.ch
12a8e67be7 Switch to a template-based stylesheet. 2002-10-15 04:40:26 +00:00
ian%hixie.ch
7704309a18 Add support for post-processing output filters. Also, some minor clean-up. 2002-10-06 22:08:32 +00:00
ian%hixie.ch
a7bd00dfb1 HTTP HEAD support (unfortunately Apache screws it up, but theoretically this should work, I think...) 2002-10-06 22:06:51 +00:00
ian%hixie.ch
c327b415aa Typo: colon should be dot to be consistent with everything else in PLIF. 2002-09-19 18:23:36 +00:00
ian%hixie.ch
9fb1137821 Form submission cleanup: use ./ instead of blank actions, since some UAs leave the query string on POSTs with blank actions. Also switch some GETs to POSTs since we now support them. 2002-09-14 13:07:18 +00:00
ian%hixie.ch
d7fbc1c86c Add more debugging output to core parts of the run loop. 2002-09-14 12:47:02 +00:00
ian%hixie.ch
662bae0d99 The 'acknowledge' string could be used for more than blank requests. 2002-09-14 12:46:16 +00:00
ian%hixie.ch
25f761a622 Implement a way for requests to include referrer information. 2002-09-14 12:45:26 +00:00
ian%hixie.ch
4889c1fb44 To make debugging easier, move the level 9 output debugging dumps from failure cases in the datasources to always, in the generic output service. May need further tweaking later. 2002-09-12 11:45:17 +00:00
ian%hixie.ch
adba24c93e Adding a new way of executing database statements: attempt(). Works like execute() but doesn't raise an exception on failure. Check for failure by using the ResultsFrame's 'lastError' method. 2002-09-12 11:44:07 +00:00
ian%hixie.ch
ad095c7804 Add two new filters: One for theoretically valid URIs, and one for strings being embedded _into_ URIs. Note that the first overrides the Template::Filters version since that version is arguably incorrect. 2002-09-11 23:11:43 +00:00
ian%hixie.ch
791866856a Changing 'HTTP/1.1' to 'Status:' since we're now in a non-nph environment. 2002-09-09 19:23:04 +00:00
ian%hixie.ch
cae1696299 More debugging information at high verbosity settings. 2002-09-09 19:22:10 +00:00
ian%hixie.ch
2493903b1d Implementations should stop using nph- scripts now. (This may have more fallout.) 2002-09-09 15:38:05 +00:00
ian%hixie.ch
8ee8ff9e8b Return the HTTP headers as well in an array context. 2002-09-08 16:39:35 +00:00
ian%hixie.ch
6e7c01e16e Switch to using smart_encode, cos we are smart. Add support for <fault> in XML-RPC output to handle errors. 2002-09-06 10:37:17 +00:00
ian%hixie.ch
8091275c08 Add a comment to remind others of what I forgot... (that you probably need a propertyImpliedAccessAllowed to use methodMissing) 2002-09-06 02:01:48 +00:00
ian%hixie.ch
239d98ec13 Normalise the command argument so that we don't choke if it has a dot in it or something. (We don't always control what the command is, e.g. for XMLRPC.) 2002-09-06 02:00:26 +00:00
ian%hixie.ch
f865cddc1c Silly typo: the constructor arguments don't go on the class, duh 2002-09-06 01:54:14 +00:00
ian%hixie.ch
2a1af49e61 A wrapper around LWP::UserAgent and HTTP::Entities. (And maybe other things, in future.) 2002-09-05 21:16:24 +00:00
ian%hixie.ch
2c7166b3af Minor bug fixes: Make anonymous arguments start from 1 not 0; make a zero argument response have a response (a true boolean); make outputs with zero or one arguments be handled as outputs instead of implied property accesses. 2002-09-05 21:15:15 +00:00
ian%hixie.ch
3da4cfd8a2 Add a generic output: acknowledge. Used when nothing is particularily required as a response, e.g. for a one-way XMLRPC call. 2002-09-05 21:05:33 +00:00
ian%hixie.ch
6e682a075a XML RPC support. This is all you need to turn a PLIF application into a PLIF application with XML RPC. 2002-09-05 17:04:03 +00:00
ian%hixie.ch
533f6d4def Removing a few things which are now done or which will never be done. 2002-09-05 16:52:07 +00:00
ian%hixie.ch
8b10632835 Missing newline in the output. This was causing some hickups for some UAs (perfectly understandably...) 2002-09-05 16:27:04 +00:00
ian%hixie.ch
ded9adb65d Optimisation: move the importing of Template::Context to runtime. 2002-09-05 16:24:58 +00:00
ian%hixie.ch
1998746fe3 Untaint the statement as well as the values before handing them to the database, because some statements are made from tainted data. This should be made more secure at some point, because currently there's no checking of database statements. 2002-09-05 16:23:38 +00:00
ian%hixie.ch
e13d10f036 Split the CGI input module into one module per method and Content-Type. In the process, added support for MIME multipart POST, so in theory we now support file upload too. 2002-09-05 16:18:38 +00:00
ian%hixie.ch
aa2d09d401 Adding yet more layers to the output mechanism: now objects con hook in and do whatever they like to the output before it reaches the protocol (or generic) output service instance. Also, move the objects hash reset code to the end of the run loop so that an input device can add an object (before, the earliest you could add an object was the input verifier). 2002-09-05 16:11:25 +00:00
ian%hixie.ch
8db0d6ded5 Some minor code fixups with no semantic change. Also, fixed the getArgumentsAsString method to not screw up the output when there are empty arrays in the arguments hash (as can happen when you call createArgument, which happens when getArgument is called and the argument is missing) and when the arguments hash contains scalars. 2002-07-16 15:50:14 +00:00
ian%hixie.ch
a35d045656 Add support for a command which does nothing but pass its argument to the output system. This is especially useful for templates that want to show other templates without actually doing anything else, and so the command is called 'showTemplate'. 2002-07-16 15:46:28 +00:00
ian%hixie.ch
5a6c17d958 Let's try a different tactic in a scalar context. If there's no data, return undef. 2002-07-07 15:42:57 +00:00
ian%hixie.ch
299f260287 Update the string data source to use the new input metadata APIs 2002-07-07 00:13:29 +00:00
ian%hixie.ch
62165e7d5b Typo: adddress should be address. Doesn't make any particular difference to anything unless someone has already written automated installation scripts... 2002-07-06 17:59:10 +00:00
ian%hixie.ch
12d86e0428 Change the 'row' method of the ResultsFrame API to return an array in an array context, a hashref in a scalar context, and the value on its own if there is only one returned value. (Controversial change. This could introduce hard to spot regressions, and might be backed out at some point.) 2002-07-06 17:52:21 +00:00
ian%hixie.ch
c5ff59c053 Introduce the service.uaStringInterpreter.<protocol> service, which takes a UA string and splits it into name, version, manufacturer, platform and comment. This is the HTTP implementation of that service. 2002-07-06 17:49:22 +00:00
ian%hixie.ch
c931d0e91f Added the following filters to the Template Toolkit toolbox: htmlcomment, xmlcomment, xml, cdata, htmljs, js, css. Added support for named [% BLOCK %], which had been removed when the template processing code was overridden. 2002-07-06 16:14:58 +00:00
ian%hixie.ch
67ff1ef52d Remove XXX comment about needing an API to enable or disable UI elements, since that need has disappeared now that we use provide that information reliably in the user object. Also split a long line into two for no particular reason. 2002-07-06 16:12:42 +00:00
ian%hixie.ch
724d714a02 Changed the default handling of the generic output module. Now, if there's no generic dispatcher for an output command, it'll effectively synthesise one on the fly, using the method name as the string name and the arguments as an array of values for a 'data' variable. This means that applications can skip out on implementing a generic dispatcher now. Anyone using strings with dot separators (i.e. anyone writing libraries) still need to have generic output dispatcher methods though, to map the method call to a string name. 2002-07-06 16:05:48 +00:00
ian%hixie.ch
927a78dfd7 Made the SMTP 'timeout' value configurable at setup time (defaults to 5 seconds) 2002-07-06 16:02:07 +00:00
ian%hixie.ch
3f748a7c22 Implement getArgumentsTree(), which returns a hash tree representing the first value of each unique argument name in a branch, using dots as the separator. Finally replaced the hardcoded non-extensible meta data stuff with a proper getMetaData() API. Implemented that in the various Input modules. Renamed 'parameter' to 'property' in the CGI Input module. Added '--batch-force-defaults' as an argument handled by the CommandLine Input module. Made CommandLine derive from Default instead of Arguments, so that it can pick up the default handling of metadata and default output protocol. 2002-07-06 15:59:56 +00:00
ian%hixie.ch
7c56b08e2b Update to TemplateToolkit format 2002-06-30 21:35:27 +00:00
ian%hixie.ch
19251aa801 Include character set information in the HTTP headers 2002-06-30 21:34:57 +00:00
ian%hixie.ch
b0b0c2d2b3 HTTP needs RFC822 dates for its Date: line 2002-06-30 21:33:21 +00:00
ian%hixie.ch
24c018b496 Primitive POST support (work in progress) 2002-06-30 21:30:43 +00:00
ian%hixie.ch
f4a812c534 Oops, wrong repository... 2002-06-30 21:05:35 +00:00
ian%hixie.ch
71c3a67ce8 Initial checkin 2002-06-30 21:02:35 +00:00
ian%hixie.ch
ce4478beee Some versions of the Net::SMTP module handle the timeout by raising a SIG ALRM, so handle this case as well. Also increase the timeout by ten seconds since in the real world, some servers are actually that slow. We might need to make this asynchronous at some point. 2002-05-26 15:08:48 +00:00
ian%hixie.ch
42ac389024 Perl 5.005_03 compatability: the precedence of the not and comma operators changed at some point, so disambiguate this usage. 2002-05-26 15:05:37 +00:00
ian%hixie.ch
78a7589fdc Cache the Term::ReadLine input device. On some systems, it has to be cached, otherwise you end up trying to open too many input handles or something like that. This also means we can have session history where available. 2002-05-26 15:03:48 +00:00
ian%hixie.ch
8ffd16f0b1 Add some null checking -- if the string is undefined, then turn it into the empty string. This avoids many undefined value warnings when the data provided by the user is incomplete. 2002-05-26 15:02:33 +00:00
ian%hixie.ch
f5ec789f5f Implemented rowsAffected(), which will return the number of database rows that were affected by the last execution of the statement associated with the results frame. 2002-05-26 15:00:56 +00:00
ian%hixie.ch
4d9ba65cdd Preliminary work in making the user prefs notifications page nicer. 2002-05-07 12:16:24 +00:00
ian%hixie.ch
2eccf38d60 Add the hidden userPrefs.userID fields to the user prefs page so that changes to users other than yourself actually take effect. 2002-05-07 12:16:01 +00:00
ian%hixie.ch
50edfae326 pendingCommands.defined doesn't seem to work... Let's try pendingCommands.ref. It's technically more correct anyway. 2002-05-07 03:04:37 +00:00
ian%hixie.ch
e14122ee41 Forgot to fully convert the templates to Template Toolkit: nested dots need to be escaped differently now. 2002-05-07 03:03:00 +00:00