Re: [Catalyst] Return a TT view
On 5/20/2011 2:21 PM, jeff robinson jeffreyianrobinson-at-gmail.com |Catalyst/Allow to home| wrote: Hi, I need to be able to process a view through a TT template but instead of subjecting it to the usual chain of processing (pre-process, wrapper etc) I just want to return it as text to the calling function. I am basically using TT to process a file GET and will return the text in a $c-response-body(). Thanks - J See http://template-toolkit.org/docs/manual/Intro.html ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Return a TT view
On 5/20/2011 3:10 PM, jeff robinson jeffreyianrobinson-at-gmail.com |Catalyst/Allow to home| wrote: Not quite sure how an intro to TT answers my question, but I did find it here: Because it shows how to call TT to return a string to the caller. http://search.cpan.org/~abraxxa/Catalyst-View-TT-0.36/lib/Catalyst/View/TT.pm Thanks anyway - J On Fri, May 20, 2011 at 3:33 PM, John M. Dlugoszwxju46g...@snkmail.com wrote: On 5/20/2011 2:21 PM, jeff robinson jeffreyianrobinson-at-gmail.com |Catalyst/Allow to home| wrote: Hi, I need to be able to process a view through a TT template but instead of subjecting it to the usual chain of processing (pre-process, wrapper etc) I just want to return it as text to the calling function. I am basically using TT to process a file GET and will return the text in a $c-response-body(). Thanks - J Seehttp://template-toolkit.org/docs/manual/Intro.html ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Moose Upgrade
On 4/17/2011 9:55 PM, Dave Rolsky autarch-at-urth.org |Catalyst/Allow to home| wrote: Running moose-outdated | cpanm should upgrade everything that needs upgrading. I don't have cpanm, but moose-outdated is good to know about! Thanks. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Accessing the catalyst user data from a template
On 4/17/2011 8:14 PM, Adam Jimerson vendion-at-gmail.com |Catalyst/Allow to home| wrote: I am trying to display display information about the user currently logged into my catalyst app but for some reason it is returning blank (or even null). I am trying to display the uniqid (user id) and username of the current user. From my template I am calling [% c.user.object.username %] and [% c.user.object.uniqid %] respectively. I know that my authentication is working because the $c-user_exists() calls in my controller is passing. The first thing I would try is DUMPing the c.user.object to see if it's what you expect. I've had blankness in templates where things were really objects, not strings; or perhaps the name is wrong. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Moose Upgrade
I just updated Moose to 2, on my development system, prepatory to doing some Moose explorations. Catalyst didn't like it one bit. I'm still installing other updates based on things mentioned in errors, when I try and run script/myapp_server. Any specific advice? I see the latest Catalyst::Runtime is marked TRIAL. Should I use a different one on the server? --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] What text editor to use?
On 4/13/2011 11:26 AM, Mesdaq, Ali amesdaq-at-websense.com |Catalyst/Allow to home| wrote: Try the full version of Komodo. It understands tt files by default. It's been great to me the past few years. I can't imagine working in a heavy perl/catalyst environment without it. Too bad Komodo Edit is such a disappointment. I'm not in a position to spend $300 on it right now. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] What text editor to use?
I use Eclipse (EPIC) too with the Amateras HTML Editor to open .tt and .tt2 file extensions: Window - Preferences - General - Editors - File Associations OK, y'all have convinced me to try Eclipse next. I installed it on Windows x64, along with Amateras. Setting the association to tt and tt2 gives me some html tag highlighting, but I can't find any settings for adjusting it, or any instructions for Ameratas at all other than that it has many features. So, how do you turn on TT syntax support? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] POST value line-endings in Textarea
The string I end up with, when the user supplied stuff using a TEXTAREA in a form, contains 0D 0A line endings. This gets passed through as-is until the data runs into something that doesn't like it. I would think that the strings imported into Perl would be immediately massaged into Perl's preferred internal form, which is different from the network format used by HTTP. It seems that this would be the best place to deal with it; nip the problem in the bud. After all, if reading text files, I absorb the line-ending differences at that point. It's no different here, right? If I'm thinking along the right lines, how do I set up Catalyst to do it at that point? --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] server memory usage
On 4/11/2011 8:54 AM, Jorge Gonzalez jorge.gonzalez-at-daikon.es |Catalyst/Allow to home| wrote: You can be assured that it's being done that way. Certainly all modern operating systems do Copy-On-Write on memory pages, which means that several processes with a common set of code will share much of it. This is not being done by Apache/fastcgi/Catalyst, but by the very operating system itself. I don't think so. If two different Perl processes are started up, and each loads modules and loads data, they will be writing all that to separate pages. Rather, it needs to load all the stuff and _then_ fork, so that the stuff is identical and shared. Thanks for the pointer to the top command; I'll read up on it. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Validation of entered content
Thanks for the comprehensive reply! That will keep my busy for a while. On 4/11/2011 10:25 AM, Peter Edwards peter-at-dragonstaff.co.uk |Catalyst/Allow to home| wrote: There are two main JS editors, the one above and TinyMCE, you have to be careful though. 1) People paste a Word document paragraph in as HTML and it becomes invalid. Try offering a paste-from-word button to bring up a box they paste into, then send that to the backend to be run through http://search.cpan.org/perldoc?Text::Demoroniser before you add it to the content area. 2) Hitting bugs in these editors giving you invalid XHTML. What you can do is - validate by sending the content server-side before save and check with a DTD schema validator like http://htmlhelp.com/tools/validator/ and on failure disallow save with a popup warning - then offer an option to correct invalid XHTML where you send the content to the backend, run it through htmltidy, then bring it back to the content area; see the HTML - XHTML docs in http://tidy.sourceforge.net/docs/tidy_man.html ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] What text editor to use?
On 4/11/2011 2:01 PM, Eden Cardim edencardim-at-gmail.com |Catalyst/Allow to home| wrote: Emacs also has a set of extensions written by jrockway that facilitate the writing of perl code in general. I use that combined with yasnippet and the perltidy extension for maximum throughput and it's very satisfying. Thanks. I installed Emacs, and found that it's too alien for me. Basic things like selecting with the mouse and keyboard together are different from my current habits. Is there a more GUI front-end? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Validation of entered content
On 4/11/2011 10:25 AM, Peter Edwards peter-at-dragonstaff.co.uk |Catalyst/Allow to home| wrote: I've used this before - perhaps it will work for you: http://ckeditor.com/ That looks interesting, but digging through the documentation it seems that its native output format is XHTML, and although it mentions that plugin providers _could_ provide processors for BBCode etc. it doesn't link to any page of available plugins, nor do I see that on their site. I'm convinced that as a first step I should make the user-supplied content be stored in some other format. Then, replacing the textarea with a fancy WYSIWYG editor would be an optional step, and I would like that to be invisible to the app. So, the GUI editor should populate the POSTed data with the same kind of markup that I would ask the user to type directly. Of course, I suppose the Catalyst way would be to allow any kind of markup as long as there's an adapter for it. The abstractions I've seen already in CPAN spit out whole HTML files with header and body, not fragments. And I'm not terribly interested in building something like that right now. I will however keep the decision abstracted and isolated in the code. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] server memory usage
You are right in this case: the pages would be shared just after the fork, but would probably start to get copied individually for each process again as soon as the process starts doing something useful. For perl, which works as some kind of JIT compiler, the script executable code is just data and probably gets rewritten very often, so each process would end with its own set of pages. I'd bet for a KSM capable machine and OS. You can activate and deactivate it, so benchmarking it with your app would be trivial. I would suppose that loading all the modules needed would generate the internal perl representation, and that won't change during execution. It doesn't get rewritten unless it's unloaded, which doesn't happen to named package contents. It's plausible that multiple fire-ups of the same program would wind up with identical pages, if no memory allocation ever depends on timing or anything other than static configuration. In Windows, the executable code of a process is backed by the exe file and shares physical pages with every process that loaded it. Paging out just forgets it, and paging it reads it from the exe file again. Would you know if Linux, with its fork/exec model, does likewise? Of course, I know that doesn't help the Perl code, which is data as far as the Kernel is concerned. FWIW, VMWare does its own KSM at a higher level, across virtual machines. So if that is possible it does reduce the real load on the host hardware. But it doesn't change how I'm billed! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Validation of entered content
I have a form where an admin can change a part of the content on a page. The form lets someone do it without having to update the files on the server in a more traditional manner; BUT, it must be correct XHTML. If the admin types a p or a stray '' for that matter, it will render the resulting page not well-formed. Combine that with the feature of serving XHTML to browsers that accept it, and the site breaks on browsers other than IE. What's a good way to validate something programmatically before committing it? Better yet, is there a rich editor or wiki- or phpbbs-like translator that I might use for soliciting the input that I might use instead? The current content has a couple paragraphs and a bulleted list. So it's not just a simple blank, but must allow an amount of rich content. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] server memory usage
Looking at the server's processes, I see three of script/myapp_fastcgi.pl, which I suppose co-inside with the Apache configuration option where I said to start 3 fastcgi processes to handle this app. WebMin tells me size, which can't be the actual load of server RAM needed since it doesn't add up with the total usage. Some basics here... is Apache/fastcgi/Catalyst smart enough to load the app and get it running to the point where it is ready to start handling requests, and THEN fork it? The Perl runtime and all the loaded modules can certainly be shared! Do I need more advanced configuration or app tuning to maximize this ability? How can I tell, through WebMin or command-line tools via ssh, how much memory is really being used by my apps? Thanks for any pointers! --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Mistake in documentation
I would suppose that the maintainers follow this mailing list? Near the beginning of Catalyst::Manual::Intro, it reads: Note that actions with the |:Global | attribute are equivalent to using a |:Path('action_name') | attribute, so our action could be equivalently: However, the preceding listing it is referring to uses :Local, not :Global. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] help with :Path and config
I want to make an admin page available on a URL that's not called admin, but is something less obvious that people might guess. Even though it will have a password, it will stop people from just trying to find it. I thought to configure it using the normal config features: use 5.10.1; use utf8; package LEDft::Controller::Admin; use Moose; use Method::Signatures::Simple; use namespace::autoclean; BEGIN {extends 'Catalyst::Controller'; } has url_name = ( is = 'ro', required = 1, ); method index($c) :Path($url_name) :Args(0) {} However, the debug screen tells me that the Loaded Path action is /admin/$url_name. Why did it take the stuff in parens as a literal string, when I didn't use any kind of quotes around it? An example in the manual is sub bar : Path('foo/bar') { } which shows that it is quoted normally: not :Path(foo/bar). ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Typo in documentation
In Catalyst/Manual/Intro.pod, The URL (for example http://localhost.3000/foo/bar) consists of two parts The dot should be a colon. --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] help with :Path and config
To achieve what you want, change the config: __PACKAGE__-config-{path} = '/secret_path'; method index($c) :Path {} Charlie Thanks. I found that mentioned in the COntroller docs, once you mentioned it. However, it also refers to :PathPrefix as well as :Local, :Path, etc, which I've not seen documented elsewhere. What's that? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] living without Apache 'deflate'
Since fastcgi doesn't get along with the deflate module, I've turned it off, per the installation instructions and Catalyst tutorials. But I'm wondering about SVG images. Can I pre-compress the files on disk and have the browser see the same thing as the deflate wrapper around the actual content type? That's certainly better for the server anyway, instead of deflating it on every request. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] living without Apache 'deflate'
On 4/4/2011 8:09 PM, Andrew Rodland andrew-at-cleverdomain.org |Catalyst/Allow to home| wrote: For starters: you don't need to do without mod_deflate. Just install a non-broken version of mod_fastcgi (version SNAP-0811090952, from 2008, or newer). I did think it was odd that the current version is from 2007 and it's been fixed but no new release since then. Why not? Should I make an end-run around Debian's packaging system and integration testing of stable versions for this exception? Why wouldn't a newer version not be in there already? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending Email from Page?
On 3/27/2011 12:22 PM, Tomas Doran bobtfish-at-bobtfish.net |Catalyst/Allow to home| wrote: And I would say that sending an email is a state change, and behavior of the application domain here. That's a stretch, because you can argue that any side-effect is a change of state to the universe at large and there happens to be no accessor to read the results of the change. It clearly matches side effect, not state, unless you stretch the definition to make all side effects into state and lose all distinction. An arbitrary helper subroutine used by the Controller is not a Model. Since it is side-effect only, it matches one of the links in the graph (Controller TO Model) so it fits in the architecture provides the proper connectivity. But that is a kludge, not its proper usage. Again, I think that the sending of email from the application is _very much_ behavior. If behavior includes causing side effects, sure. That is certainly something the Controller is allowed to do, and is the Controller's responsibility. In future you may want to replace the implementation of it, or wrap it with extra functionality (e.g. to count the number of emails sent), or reuse it in an application context beyond the web app (e.g. sending email from a batch script). So? That is an argument for encapsulation and abstraction, not for making it a Model. With a model all of these things are not only possible, they're easy, and you've got a framework for the abstraction and use outside Catalyst already provided... I think we are in agreement that using the auto-discovery/loading, and the dissemination of settings, and whatever else a Catalyst component does for you, might be handy for writing helper code, as opposed to making it a plain Perl module. But that doesn't make it a Model. Saying it is (to promote auto-discovery and loading) is just a hack, done for that purpose only. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Response Headers
Where is Content-Type being set? I'd like to send it instead as application/xhtml+xml, if the Accept header of the request claims to take that. I found this example of rewriting it in Apache, but it would be far easier to target the necessary pages, not to mention more elegant, if I did this within Catalyst. | AddType text/html .xhtml RewriteEngine on RewriteBase / RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml\s*;\s*q=0 RewriteCond %{REQUEST_URI} \.xhtml$ RewriteCond %{THE_REQUEST} HTTP/1\.1 RewriteRule .* - [T=application/xhtml+xml]| ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Encoding UTF8 ?
I don't understand why |Catalyst::Plugin::Unicode::Encoding| is necessary, based on the writup: it takes request arguments and converts them from whatever they came in to Perl's native encoding, and likewise for the response. But Perl is using UTF-8 in its strings anyway. So what's it have to do with the engine error I noticed before? Now, with the plugin present, any literal characters in my template that take more than one byte in UTF8 are being interpreted as bytes and converted to UTF-8, improperly. My template text is already in UTF8 ! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Encoding UTF8 ?
On 3/28/2011 1:25 PM, Jorge Gonzalez jorge.gonzalez-at-daikon.es |Catalyst/Allow to home| wrote: Did you set ENCODING = 'utf-8' in the configuration of your TT View? Ah, thanks! That worked. I looked again carefully at http://search.cpan.org/~rhandom/Template-Alloy-1.016/lib/Template/Alloy.pod#CONFIGURATION and it turns out I was reading about HTLM::Template Style configuration, which only listed a smaller number of items. When I searched the text of the page, I found ENCODING in the previous section. My bad. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending Email from Page?
On 3/27/2011 2:24 AM, Tomas Doran bobtfish-at-bobtfish.net |Catalyst/Allow to home| wrote: Erm, why? Why should it be called an 'accessory', rather than a 'model', what's the difference other than the nomanclature you want to use? Cheers t0m A view queries the model in order to generate an appropriate user interface In M-V-C, and Model is fundamentally a source of information to be used by the View. The *model* manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller). An arbitrary helper subroutine used by the Controller is not a Model. Since it is side-effect only, it matches one of the links in the graph (Controller TO Model) so it fits in the architecture provides the proper connectivity. But that is a kludge, not its proper usage. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Wide (Unicode) character problem?
On 3/23/2011 8:58 AM, Bill Moseley moseley-at-hank.org |Catalyst/Allow to home| wrote: Post the smallest possible example (20 lines?) that clearly shows the problem. OK, I verified that it still chokes if I strip it down to the bare essentials. If the view produces a stream that includes a wide character, I get the exception. Here is my Controller: package LEDft::Controller::Root; use Moose; use namespace::autoclean; use Mail::Builder::Simple; use Try::Tiny; BEGIN { extends 'Catalyst::Controller::HTML::FormFu' } # # Sets the actions in this controller to be registered with no prefix # so they function identically to actions created in MyApp.pm # __PACKAGE__-config(namespace = ''); my %Data= ( priceline = 10\x{2032} poll, ); sub index :Path :Args(0) { my ( $self, $c ) = @_; $c-{stash}-{AdminContent}= \%Data; } sub end : ActionClass('RenderView') {} __PACKAGE__-meta-make_immutable; 1; Here is the index.tt file: p[% AdminContent.priceline %]/p Also, the app's config states: default_view = 'Alloy', So the tt file is being processed using Alloy. I get the same result if I use 'TT', the more common choice. = So, if the template produces a result that includes a wide character, I get the exception. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending Email from Page?
On 3/22/2011 3:07 AM, Jorge Gonzalez jorge.gonzalez-at-daikon.es |Catalyst/Allow to home| wrote: ... my $mail = Mail::Builder::Simple-new; $mail-send( from = MyApp-config-{Mail}{from}, to = MyApp-config-{Mail}{to}, subject = MyApp-config-{Mail}{subject},, plaintext = Hello,\n\nHow are you?\n, ); ... Your sentiments echo my own. Thanks for pointing out the config usage; I'll do that. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending Email from Page?
If Catalyst had something called an accessory that could draw upon the auto-discovery, loading, configuration, etc. of Components, but did not claim to be a model, I might agree. On 3/22/2011 4:42 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: From: Jorge Gonzalez El 21/03/11 20:58, Octavian Rasnita escribió: Yes, it is very simple to use Mail::Builder::Simple directly, but there are some advantages when using it in a model: - You can share the configuration data among more controllers and even external programs; You can do it also without the model. Just create a new section in the application config file: (YAML): ... Mail: from: source_addr...@yoyo.com to: whoe...@wherever.com subject: Hello ... And then from the controller: ... my $mail = Mail::Builder::Simple-new; $mail-send( from = MyApp-config-{Mail}{from}, to = MyApp-config-{Mail}{to}, subject = MyApp-config-{Mail}{subject},, plaintext = Hello,\n\nHow are you?\n, ); ... - You need to write less code in your controllers; As we can see by the above example, it's more or less the same amount of code. In this example yes, you are right, because Mail::Builder::Simple requires very few lines of code in any case, but if the mail sender is SMTP and needs to specify the host name, possibily the port if it is not a common one, the username and the password if it requires authentication, and also specify if it uses SSL... then it would be more simple to use a model to access Mail::Builder::Simple. The model is very thin anyway. But as you said... TIMTOWTDI. Octavian ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Engine problems: Wide character in syswrite ?
Caught exception in engine Wide character in syswrite at /usr/share/perl5/Catalyst/Engine.pm line 675 When I had a literal U+2032 (a U.S. feet measurement mark) in my tt file, Catalyst didn't mind one bit. I moved that particular content into a model, and now it's expanded into the template rather than being part of the template's own source. But Catalyst shouldn't know the difference, right? Now when I run, I get this error. Removing this one character from the data makes it go away. What's the deal here? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Wide (Unicode) character problem?
Any clues what this means: Caught exception in engine Wide character in syswrite at /usr/share/perl5/Catalyst/Engine.pm line 675 When I had a literal U+2032 (a U.S. feet measurement mark) in my tt file, Catalyst didn't mind one bit. I moved that particular content into a model, and now it's expanded into the Alloy template rather than being part of the template's own source. But Catalyst shouldn't know the difference, right? Now when I run, I get this error. Removing this one character from the data makes it go away. What's the deal here? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending Email from Page?
On 3/21/2011 1:48 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: You can use any of them or Catalyst::Helper::Model::Email. The plugin is no longer recommended. So I see. It's a simple wrapper that just integrates Catalyst config files, and that suits by purpose. But trying to figure out how to use it I find the underlying stuff is deprecated. Reading the page for Catalyst::Helper::Model::Email, and assuming that a ')' keeps getting lost, it's just a simple to use but you look up an object via Model first. What is the benefit of that? I suppose you can have more than one configuration pre-set, but I don't see that happening. Is there some other advantage or conceptional purpose for making a feature or content sink or side effect call presented as a Model? The most simple way is not the best. The best way is to send the messages in a job queue and let the worker module to send the message immediately or whenever the mail server is free. If you send the message directly from your application, in that moment the server might not be free and the user would need to wait too much until the message is sent, or the mail server might give a timeout and in that case the message is lost because the application doesn't send it again when the mail server is free. I like being able to get a return result so I know it was sent! If that is not possible on a real server, is there some module already that does this? Hmm, maybe it depends on the mailer used? Postfix just queues the incoming message anyway! Why am I needing to duplicate what it already does? Would another queue process in front of it be less likely to get stuck? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending Email from Page?
On 3/21/2011 11:45 AM, Kutbuddin Doctor ksdoctor-at-sanfordburnham.org |Catalyst/Allow to home| wrote: Can someone post instructions for using postfix withing catalyst? I have been seeing several (earlier) posts recommending Email::Sender. I see instructions in Email::Sender for SMTP and sendmail, but no config options for postfix. I was only able to find Postfix mentioned in unrelated Perl modules (Mail::Postfix::Postdrop). So if you have a local postfix running, how do you send an email to that service from within catalyst? I'm hoping the example will show how to setup connections to server in MyApp.pm and use it throughout the catalyst application. Nothing to it: I just used the NMTP option in Sender or whatever fancier module defers to it (I'm usig Mail::Builder::Simple). I think the default 'sendmail' would just call it, too. If some mail server is running locally and listening to the usual ports, it should work! For Postfix, the relevant option is smtpd_recipient_restrictions= ... ,permit_mynetworks, ... which allows it to accept mail from a server on the same machine without pestering for a password or client certificate or anything. I also had to make sure the submitted email was just right, as my rules are rather picky. The error messages are clear: need full From address, etc. --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Requesting example code for postfix and Email::Sender
On 3/21/2011 1:37 PM, will trillich will.trillich-at-serensoft.com |Catalyst/Allow to home| wrote: $c-stash-{*email*} = { from = $c-config-{email_from}, 'reply-to' = $c-user-email_name, to = $c-user-email_name, cc = join(',', @cc), subject= $subj, body = $message, }; $c-forward( $c-view('Email') ); I didn't like that one (the mail view) because I don't follow: if your function sends email instead of generating a web page, what happens to the UA on the other end of the network who triggered that URL? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Requesting example code for postfix and Email::Sender
On 3/21/2011 4:46 PM, Dave Rolsky autarch-at-urth.org |Catalyst/Allow to home| wrote: Usually, this will be implemented as something that just writes a file to the server's mail queue, without relying on the server actually running. The server will pick it up when it runs, and will handle it from there. TL;DR - Use Email::Sender::Transport::Sendmail unless you have a really good reason to use something else. Ah, that's very good to know. However, I don't seem to have a program called 'sendmail' on the path. I had installed Postfix via the Debian package. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Requesting example code for postfix and Email::Sender
On 3/21/2011 9:07 PM, Andrew Rodland andrew-at-cleverdomain.org |Catalyst/Allow to home| wrote: There doesn't need to be any instead of. The email view doesn't set any response body, so the default view will still run later on by whatever means usually runs it (i.e. RenderView). I thought forward was like a redirect, in that it stopped working here and went there instead. The examples are misleading, as that is the last line in the body! I see from the docs that forward is indeed a call ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Sending Email from Page?
Any pointers as to the right (or best) way to send an email from my Catalyst App? I see there is a Plugin::Email and also a View::Email, which seems to be something totally different? Obviously any integrated module should be simpler than just calling sendmail or Email::Send::SMTP from the controller's function. However it's done, the question remains on how to properly secure the ability to send mail. The SMTP server on the machine is normally secured, with Postfix configured to require authentication and password to drop off new outgoing mail. A different port communicates with other public servers and only accepts messages for local delivery. My current idea is to set up another port on Postix that only allows local connections and only accepts mail TO: the addresses that are used by the web app. Is there a better (or simpler) way? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Where are my modules?
On 3/17/2011 4:24 AM, Carl Franks fireartist-at-gmail.com |Catalyst/Allow to home| wrote: It looks like cpan installed it, though its dependancies didn't install cleanly. Makefile.PL fails to require() it, so thinks its not installed. Try installing Data::Visitor - and check cpan's output for errors. If that still doesn't work, force install the listed modules: cpan i -f Catalyst::Plugin::ConfigLoader I know in the past cpan would continue to install modules, even if their prereqs failed - I can't remember if this was fixed by a cpan upgrade or a cpan config setting. Carl Thanks for the advice, everyone. I ended up rolling back and trying again. If I install the modules myself from cpan, it works fine. If I let 'make' pull stuff in, it goes crazy! I noticed the latter is using cpanplus at least sometimes. I wonder if that's the difference? I could not find a place in the cpanplus configuration to add 'sudo' like I did with cpan. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] How to use fastcgi
I've set up my app on an Apache server using fastcgi. Following the instructions in the cookbook and a few other places, The Virtual Server block looks something like this: ServerName www.ClientsDomainName.com ServerAlias CLientID.dlugosz.com ServerAlias ClientID.LocalCloneOfServer # Serve static content directly DocumentRoot /var/www/MyApp/MyApp-0.01/root Alias /static /var/www/MyApp/MyApp-0.01/root/static ErrorLog/var/www/MyApp/MyApp-0.01/logs/error_log CustomLog/var/www/MyApp/MyApp-0.01/logs/access_log combined FastCgiServer /var/www/MyApp/MyApp-0.01/script/MyApp_fastcgi.pl -processes 3 Alias / /var/www/MyApp/MyApp-0.01/script/MyApp_fastcgi.pl/ I went with unpacking the archive within a base directory of the same name, so that the base directory can be given permissions different from the main www directory. Any more suggestions and tips thus far? My question at this point concerns reloading and cycling of the fastcgi server. If I update the app's files, how do I reload it? I didn't see any feature similar to the -r on the development server. Looking at the process list, I see lots of Apache2 processes, none named fastcgi. I'm guessing that the fork done by Apache doesn't change the process name and command-line identification? So I can't just kill them off because I don't know which ones they are! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Please help with deployment problem
When I try to move my app to (a clone of) my Debian server, I get an error installing Perl modules. I've determined that just loading the module URI::SmartURI gives an infinite recursion. It seems that 'blessed' keeps calling AUTOLOAD to handle it! I've updated everything, to no avail. I'd pester Perlmonks, but I'm having trouble getting my password recovered. Eventually they'll respond again. Any clues? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] What are these files?
When I generate a makefile, I also get directories called inc and blib. What are those for? They are not used by the app. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Basic help with deployment
I'm going through the Packt Publishing book, and I can't help but wonder first of all why I had to return to it, instead of finding this in the online documentation? I find tips on configuring fastcgi, but it completely leaves out all mention of the makefile and the available options! I did find some tips on using PAR instead, but I want to do the regular way since I should install modules on the server machine and don't need to end-run around cpan. So, following chapter 9 in that book, it states to run $ perl Makefile.PL $ make distclean but distclean removes the makefile itself, so make it again. $ make manifest inspect the MANIFEST file for junk and create a skip file, as needed. I notice the mysterious 'inc' directory is being included, but 'blib' is not. Finally, $ make dist and you get a tar.gz file. Then it states to copy the tarball to the server, and issue: $ tar xzvf MyApp-0.01. tar. gz $ cd MyApp $ perl Makefile.PL $ make make test Ah, but what is extracted is not a subdirectory called MyApp, but MyApp-0.01. This won't match the following instructions, and naturally doesn't match the Apache config file. Now maybe I should go with it and generate /var/www/MyApp/MyApp-0.01/files, and point all the Apache lines to the inner directory? This would facilitate switching them easily. Running tar from /var/www is problematic because doing this as a user can't create the directory, and doing it as root will create all the subdirs as root, not as the user. And it's called MyApp-0.01, not MyApp. Now, does 'make' by itself load the Perl dependancies? Copying it from dev to the Apache directory on the same machine, naturally everything was found, and it told me it checked. But I seem to recall there being a different make item that specifically populated any dependencies? Now, another question I need settled before I proceed: I found that I need to run cpan -i Module as root, because sometimes it needs to create directories. Does that mean that this 'make' step needs to be done as root? That's also why I want to use a make step that only does the Perl dependencies, so I can do that separately. Finally, the favicon is missing when I serve the app via Apache/fastCGI. The file is under static/favicon.ico, it just doesn't work. In general, how do I verify that Apache is indeed serving static content without going through the app, as intended? Thanks! --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Escaping of argument of private path
On 3/16/2011 2:02 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: Why would you like to need to escape every path component by using the TT uri filter for more times and escape the reserved chars even where they can be used as they are, instead of using the html filter once? If you want, you can uri-escape even the [a-zA-Z0-9] chars, but why would you want to escape chars where they don't need to be escaped? :-) Octavian Only the component that is dynamic (not chosen when I created the program) needs any kind of processing. These are actual file names found in some directory. What I really want is a call to escape anything that would cause problems, for whatever reason as one step. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Basic help with deployment
On 3/16/2011 8:15 AM, will trillich will.trillich-at-serensoft.com |Catalyst/Allow to home| wrote: Probably you've already run this as root (or via sudo) and paths have been created with root ownership. Your normal user isn't allowed to frob those. Under Debian Squeeze, it appears that the directories in this vicinity are owned by 'staff' which is a pseudo-account, and I can normally write to them. The issue is in creating a new directory, and is not necessary with every cpan install, just sometimes. I think the intention was that staff could install modules, but it doesn't quite work. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Basic help with deployment
On 3/16/2011 4:21 AM, Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 daxim-at-cpan.org |Catalyst/Allow to home| wrote: This is not a good idea. Instead configure the cpan options `make_install_make_command` and `mbuild_install_build_command` to employ sudo. http://p3rl.org/CPAN#Config_Variables Just inserting sudo in front of what is already there, I get: 'make_install_make_command' = q[sudo /usr/bin/make], 'mbuild_install_build_command' = q[sudo ./Build], Is that right? --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Escaping of argument of private path
On 3/15/2011 1:38 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: uri_for() escapes each component, but I guess that it doesn't escape it if it contains a slash in it. For example, you can do: img src=[% c.uri_for('/static', 'ham and eggs.jpg').path %] It will print: img src=/static/ham%20and%20eggs.jpg Octavian I see... it wants you to pass separate arguments rather than building the path first. I was thinking that uri_for might be more trouble than it's worth since I don't like fully-qualified URLs in my generated source anyway. But if it escapes (sometimes?) then that is indeed more helpful. img src=[% c.uri_for(/static/gallery,rec.dirname,rec.filename) %] alt=photo / That works (using Smart_URI settings to leave off the host). But it did not escape out the '' in the filename! Is that a bug? I notice you changes my example from '' to 'and' -- that's cheating! img src=[% /static/gallery/${rec.dirname}/${ rec.filename | uri } %] alt=photo / gives the correct answer: ham%20%26%20eggs.jpeg ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Escaping of argument of private path
On 3/15/2011 4:56 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: uri_for() escapes only the chars which are not in the following list (from URI.pm): $reserved = q(;/?:@=+$,[]); $mark = q(-_.!~*'());#'; emacs $unreserved = A-Za-z0-9\Q$mark\E; The char is a valid char in the URI, so it should not be escaped.. With other words, the following url is OK: http://localhost/dir1/dir2/ham%20%20eggs.jpg uri_for() generates the URI as it needs to be accessed on the server and not as it should be printed in an HTML page. In order to be printed correctly, the char must be HTML-encoded, so the html TT filter must be used: a href=[% c.uri_for('/path', 'eggs ham.jpg', {a=1, b=2}).path_query | html%]label/a It will give: a href=/path/eggs%20amp;%20ham.jpg?a=1amp;b=2label/a In contrast, the 'uri' filter in TT converting any characters outside of the permitted URI character set (as defined by RFC 2396) and that includes ||, |@|, |/|, |;|, |:|, |=|, |+|, |?| and |$|. The 'url' filter in TT is less aggressive, and does not include those. The '' is a Reserved Character according to §2.2 of RFC 2396. That is what the code sample you quoted notes: the set of reserved characters. They may have specific meanings as delimiters within the overall URI, so should be escaped. Just skimming, I see that it's reserved within the query component. Anyway, using the TT 'uri' filter on the dynamic path component means I don't have to use the html filter also! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: Escaping of argument of private path
On 3/15/2011 6:03 AM, Aristotle Pagaltzis pagaltzis-at-gmx.de |Catalyst/Allow to home| wrote: * John M. Dlugoszwxju46g...@snkmail.com [2011-03-15 08:10]: img src=[% c.uri_for(/static/gallery,rec.dirname,rec.filename) %] alt=photo / That works (using Smart_URI settings to leave off the host). But it did not escape out the '' in the filename! Is that a bug? No. It’s exactly the right answer: ` ` → `%20` is URI escaping (which `uri_for` does, as it should), `` → `amp;` is HTML escaping (which `uri_for` has nothing to do with). You want img src=[% c.uri_for(/static/gallery,rec.dirname,rec.filename) | html %] alt=photo / Regards, Catalyst's uri' encoding is == TT's url encoding, and different from TT's uri encoding. That is, escaping all reserved characters vs escaping (only) illegal characters. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Escaping of argument of private path
Consider this TT fragment: [% fname = rec.filename | uri %] img src=[% c.uri_for(${directory}/${fname}) %] alt=photo / There is no reason to suppose that the filename following URL naming conventions, and may be something like ham eggs.jpeg. This in fact works as written, but I'm wondering if it's quite correct. In fact, I'm surprised that uri_for doesn't do this for me! I pass in a file name and get a URL back, right? Munging the file name first doesn't make sense since that's no longer the file name and won't work in a call to Open, for example. But escaping each component, and not the component delimiters, after getting the perported uri back would be much more work. This should be simpler. What am I missing? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: How to get uri_for something with a fragment?
On 3/9/2011 4:55 AM, asjo-at-koldfront.dk |Catalyst/Allow to home| wrote: Catalyst doesn't need to specifically handle fragments because URI objects do so, and Catalyst returns those. That's what I ended up doing. With TT it was a little more awkward since it didn't chain the calls: presumably the call to add the fragment doesn't return self? If I did a lot of that, I'd just add a tiny function that takes the fragment param too. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: How to get uri_for something with a fragment?
On 3/8/2011 10:27 AM, Ashley Pond V apv-at-sedition.com |Catalyst/Allow to home| wrote: Well, the original message was: How do I call uri_for_action and pass it the '#id' part? It's not an arg and it's not part of the query string. This is called the fragment identifier in the final URL. uri_for_action makes it implicit that he was seeking a server side use of the fragment. -Ashley I just wanted the page that contained the item I knew was on it, without hard-coding the URL like the good people on this list taught me. I know the browser takes care of jumping to that spot on the page. --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] How to do .htaccess?
I want to make one path in my app password protected, and a very simple way will be fine. Also, while in development, I want to make the whole think password protected. I thought I'd just use .htaccess. But, since this isn't really an appache directory (except for static files), where would I put this information? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] How about Template::Alloy?
Reading the FormFu documentation, I was referred to Template::Alloy. After reading about that, I want to switch from TT to using that! So, if it's everything it claims to be, why isn't that the default and used by all the examples I've seen? Should I think twice about it? --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How to get uri_for something with a fragment?
On 3/7/2011 9:34 AM, Ronald J Kimball rkimball-at-pangeamedia.com |Catalyst/Allow to home| wrote: On Sun, Mar 6, 2011 at 6:46 AM, John M. Dlugoszwxju46g...@snkmail.com wrote: On 3/6/2011 5:28 AM, Andrew Rodland andrew-at-cleverdomain.org |Catalyst/Allow to home| wrote: Or, since you know that what it generates *doesn't* have a fragment you could always just $c-uri_for_action(...) . '#id' which will be perfectly valid (although no longer a URI object). I considered that a hack until I knew better, since it won't work if there are query arguments. Why won't it work if there are query arguments? Seems correct to me. Ronald ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ My bad. I thought the ? came after the #. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How to get uri_for something with a fragment?
On 3/7/2011 1:35 PM, Ashley Pond V apv-at-sedition.com |Catalyst/Allow to home| wrote: Using the fragment is probably a bad idea. It's not supported by all servers so it can end up lost on the backend depending on your setup. -Ashley I've never heard of a web server that didn't have fragments. I link to anchors all the time! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Browser Detection?
I'm supposing that there must be something in the request object that lets me know if I'm serving to particular browsers, in particular to whatever version of IE. Then, in some single place in the app, automatically digest that and stick a flag in the stash. Now, the TT files can test for that flag and skip advanced features or serve alternative content. Has this already been swept up into a nice module of some kind? If not, can you give me some pointers on those two things: how to tell what the browser is, and where to put the code so it's executed on every action? Thanks. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] How to get uri_for something with a fragment?
How do I call uri_for_action and pass it the '#id' part? It's not an arg and it's not part of the query string. This is called the fragment identifier in the final URL. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Browser Detection?
Thanks. I guess everything is easy if you know what you're looking for! I'd like to set flags based on what that contains, like send SVG images. Where would I put that in MyApp so it gets called some time before rendering the view? On 3/6/2011 5:00 AM, Tobias Kremer tobias.kremer-at-gmail.com |Catalyst/Allow to home| wrote: On 06.03.2011, at 11:56, John M. Dlugosz wrote: I'm supposing that there must be something in the request object that lets me know if I'm serving to particular browsers, in particular to whatever version of IE. Then, in some single place in the app, automatically digest that and stick a flag in the stash. Now, the TT files can test for that flag and skip advanced features or serve alternative content. Has this already been swept up into a nice module of some kind? Let me CPAN this for you: http://search.cpan.org/dist/Catalyst-TraitFor-Request-BrowserDetect/ --Toby ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How to get uri_for something with a fragment?
On 3/6/2011 5:28 AM, Andrew Rodland andrew-at-cleverdomain.org |Catalyst/Allow to home| wrote: Or, since you know that what it generates *doesn't* have a fragment you could always just $c-uri_for_action(...) . '#id' which will be perfectly valid (although no longer a URI object). I considered that a hack until I knew better, since it won't work if there are query arguments. This worked: [% IF c.action != 'index' ; SET toplink = c.uri_for_action('/index') ; CALL toplink.fragment('galleries') %] lia href=[%toplink%]Gallery Index/a/li [% END %] though I'd certainly be interested in hearing how I could do it better. --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Best form library?
What's the best form-generating/processing library for Catalyst, assuming I don't need to worry about old baggage and can move forward with the latest and greatest stuff? --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Browser Detection?
On 3/6/2011 8:06 AM, Charlie Garrison garrison-at-zeta.org.au |Catalyst/Allow to home| wrote: Good morning, On 6/03/11 at 5:36 AM -0600, John M. Dlugosz wxju46g...@snkmail.com wrote: I'd like to set flags based on what that contains, like send SVG images. Where would I put that in MyApp so it gets called some time before rendering the view? I do browser detection (checking) in the `auto` method (so I can redirect to 'upgrade browser' page). But it could also be done in the `end` method if you just want to put stuff in stash for the view. If you've got a base method that all other actions chain from (which seems to be current best practices) then you could put it there too. Charlie Ah, I see: the 'end' is the end of the controller phase and is still done before calling TT. My general policy is not to forbid older browsers, but to withhold the CSS and add a banner. So, I did that in the page-wrapping template for the site. I also plan to start using SVG, so a flag that tells the TT template to give the IMG or the OBJECT, based on whether the browser is on the list of those chosen to get SVG. Looking toward the future, I'm hoping that IE9 will be a sea-change. So as with normal programming languages, I'm thinking that a new project should use up-to-date features. By chaining actions, you mean how http://site.com/foo/bar/baz will have a base action at foo, then more action at bar, etc? I don't think my current project works well for that. Is the current trend to chain back to the root? I don't see how that adds anything over 'auto', but I'll re-read that section carefully. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Initialization
On 3/5/2011 3:01 AM, Tomas Doran bobtfish-at-bobtfish.net |Catalyst/Allow to home| wrote: Ergo you can just do your work in the BUILD method for your model. Thanks for that, and the example. Just pass in the root you want the model to see as config, add an attribute, and the value will be there for you.. The root is already being set up somehow. That's what path_to('root') in the example is finding? Why does this need to be set again on Model's config? Is the model not seeing that information at BUILD time? Something like: package MyApp::Model::Foo; use Moose; use namespace::autoclean; has root = ( is = 'ro', required = 1, ); sub BUILD { my $self = shift; ... your code here, and you can call $self-root ... } and then in MyApp.pm: __PACKAGE__-config( 'Model::Foo' = { root = __PACKAGE__-path_to('root'), }, ); Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] debug prints
How do I send stuff to the console running the script/Appname_server.pl -d from a component method? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Initialization
I want to do something once ahead of time, not every time my Model is used by a page. Where is the correct place to put code that will execute once during app set-up, and how can it know what the configured root directory is? Thanks, --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Cache of unchanging content
On 3/3/2011 1:58 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: From: will trillich Here's our current dev-to-deploy approach -- we use mercurial and a three-step staging process: I think that it could be helpful to add a page to the Cat site that describe the workflow for deployment because it is not clear which are the possible/recommended methods. Octavian ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ I'll second that. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] What text editor to use?
On 3/3/2011 11:28 AM, Cliff Green green-at-umdnj.edu |Catalyst/Allow to home| wrote: On 3/3/2011 11:11 AM, John M. Dlugosz wrote: On 3/3/2011 9:24 AM, Cliff Green green-at-umdnj.edu |Catalyst/Allow to home| wrote: On 3/3/2011 9:27 AM, Mesdaq, Ali wrote: I have been using Komodo for years and its the best Perl editor I have found. I wondered if anyone was going to mention Komodo. FWIW, it looks like Ali is talking about KomodoIDE (which I also own), not the free KomodoEdit, which is fundamentally the same editor, sans source code management (svn, etc.). On the other hand, it does allow one to open and save files remotely (I use scp), which is convenient. I already checked out the free Komodo editor. It was quite disappointing. Basically no configuration possible. Under the heading of ymmv... What kind if configuration was lacking? c I don't remember the details now. Only that I was disappointed and underwhelmed based on the hype. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] What text editor to use?
What's a good text editor to use for Catalyst/TT development? The editor I really like for C++ doesn't handle XML well. I've been using Notepad++ for windows, but the syntax highlighting doesn't understand mixing TT inside the base language, and it has tabs only instead of multiple visible windows. I would entertain both Windows and Linux solutions. TIA, --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] What text editor to use?
On 3/2/2011 5:49 AM, Kieren Diment diment-at-gmail.com |Catalyst/Allow to home| wrote: Padre: http://padre.perlide.org/ is rated by some. Works everywhere Wx does. Looks very interesting. How do I set it for XML + TT syntax? Scintilla is also what Notepad++ uses, so it must be a matter of it having a suitable syntax file somewhere, or better support for embedding sublanguages languages? --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] What text editor to use?
On 3/2/2011 10:44 AM, Shlomi Fish shlomif-at-iglu.org.il |Catalyst/Allow to home| wrote: First of all, see: http://perl-begin.org/IDEs-and-tools/ I'm personally using GVim, which is the GUI version of Vim ( Thanks for your tips. I see many of the things listed are for Perl development, and so are geared to highlighting Perl source code and do things like execute snippets of Perl immediately. What I'm looking for is mixed mode support, to handle XML files with TT stuff embedded in it. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Cache of unchanging content
On 3/2/2011 11:24 AM, Tomas Doran bobtfish-at-bobtfish.net |Catalyst/Allow to home| wrote: Installing to production servers via rsync / unison is insane, as there is exactly no way of knowing what version the production server is on, with what bugs... Which means that all bug reports become useless - as you never know if the user was using the site before or after you fixed (or, more often, you think you fixed, but didn't really fix a bug).. I don't follow. If it changes the files around on the server to match the build you have locally, what difference does it make whether it used a per-file patching method or if it wiped out everything and copied all the files including huge graphics that didn't change at all? Either way, it now matches what you said to put up there. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Cache of unchanging content
On 3/2/2011 11:27 AM, Pedro Melo melo-at-simplicidade.org |Catalyst/Allow to home| wrote: Of course you can. You can include a file .version at the root created with 'git describe --always' .version before you rsync, and then include it on your test reports. Nice tip. Thanks. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Cache of unchanging content
Say I want to use TT in the .css, so (for example) I can name my colors and other repeated content easily. I'm assuming that I can define a Path of some kind on a rule to serve those. Any recipes to share? More critically, I want the browser to know that it doesn't have to keep re-fetching it on every view of every page. How would I manage that? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Cache of unchanging content
That's only part of it. It should also answer status 304, and set headers to tell the client not to even bother asking again any time soon. On 3/1/2011 4:45 AM, Jorge Gonzalez jorge.gonzalez-at-daikon.es |Catalyst/Allow to home| wrote: So what you need then is a templating system which caches the generated content from the templates and then when asked for it again later, it checks if the template has been changed, and if it hasn't (so the content generated will be the same if executed), answer the browser with a Content not changed instead of sending the content. Looks like you might need Template::Plugin::Cache: http://search.cpan.org/~perrin/Template-Plugin-Cache-0.13/Cache.pm http://search.cpan.org/%7Eperrin/Template-Plugin-Cache-0.13/Cache.pm Specially interesting the Any gotchas... section of the docs :-) Regards J. */Jorge González Villalonga/* Director Técnico */DAIKON Integración y Desarrollo S.L./* Telf: (+34) 91 188 08 28 Fax: (+34) 91 632 65 42 *www.daikon.es* El 01/03/11 10:23, John M. Dlugosz escribió: Say I want to use TT in the .css, so (for example) I can name my colors and other repeated content easily. I'm assuming that I can define a Path of some kind on a rule to serve those. Any recipes to share? More critically, I want the browser to know that it doesn't have to keep re-fetching it on every view of every page. How would I manage that? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Cache of unchanging content
On 3/1/2011 9:58 AM, Bill Moseley moseley-at-hank.org |Catalyst/Allow to home| wrote: At build time I minimize and compress css and js (and images) and combine into single files grouped by page(s). They could be pre-processed by TT very easily. The final file names include an MD5 of their content forcing a re-fetch only if they ever change. So you added that to the makefile somehow? I take it the generated name must be supplied to the page's template once it is known. I'd like to learn more about your system. So if you make a small change, you have to re-install the whole app? If the file name changes, I can't just use Unison to sync the directory on the production server. As for reaching for templates in CSS: Sure, you can break common lines into different tags so you only specify a color once: #this, #that, div p .theother { color: x } but that doesn't help making (say) a border color and a background color the same value. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Details of config options
A module documented to put Plugin::SmartURI disposition hostless /Plugin::SmartURI in the myapp.conf file. But, what is the equivalent __PACKAGE__-config( syntax for the MyApp.pm file? I can't find documentation on how the names are mapped, and I've even seen different syntax in different guides. What's the correct rule? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Simple literal Model
On 2/25/2011 4:06 AM, Tomas Doran bobtfish-at-bobtfish.net |Catalyst/Allow to home| wrote: __PACKAGE__-meta-make_immutable; 1; And you then call $c-model('Foo')-data; The implementation of the 'data' method could then later be replaced by an attribute (i.e. has data = ( is = 'ro', isa = 'HashRef' );), and would then get the data from config, or something more complex (e.g. to get the data out of DBI, or another model, or whatever). HTH Cheers t0m Thanks. Is '$c-model('Foo')-data' what something like DBIC gives us, too? That is, is a method named 'data' the convention? That is, if code was given a result set (I think that is the right term) of a query that was made on one of the main standard model types, what would the list of records look like? Does 'MyApp_create.pl model' have any built-in stuff to generate a blank ad-hoc model like you showed me? Thanks for the help. --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Simple literal Model
On 2/25/2011 9:30 AM, Ashley Pond V apv-at-sedition.com |Catalyst/Allow to home| wrote: What t0m suggested is perfectly fine but if you want to mimic the DBIC API with a different engine, this example does that (superficially and as a tutorial only): http://sedition.com/a/2739 Log file model–Apache access log. The reason that example makes sense is because the underlying model/data is similar: searchable, sortable rows. If you're trying to shoehorn in something dissimilar, you might be making a mistake. -Ashley I'm not sure to what extent it is wise or correct. The whole point of models is that it abstracts the model and I can change where the data comes from later, right? So don't they all have an underlying abstract interface regardless of how they are sourced? I can see that DBIC itself abstracts which database is used; e.g. SQL Lite for testing and MySQL on a dedicated server for deployment. But I was thinking that the Model, over all, did a similar level of abstraction: change from a database to a XML file or other representation, and the data is still presented the same way. For example, I currently have 8 items, and want to just list them in Perl so I don't have to worry about another data representation or parsing it. But if needs to become user-changable or grows to a few dozen items, a separate XML file would be better. And if it grows to a search result of a few thousand items, it should be in a database. Clearly there are differences in capabilities of a Model: to wit, all in or searchable. And a full database can return different results depending on selected columns, across joins, etc. So I think the level of abstraction is that of a list of records. The View is given a list of records, and the Controller knows to pull it by name directly, perform a search on a more complex model, or access an attribute of a more encompassing model. It obtains the list and passes it to the View via the stash. The examples I've read using DBIC use [% WHILE ( item = list.next) %] and I can imagine that in general we don't have efficient random access to the rows; in C++ I would characterize this as a forward iterator or even weaker, if I can't make a copy of the earlier state and go forward a second time. I would have hoped that the TT [% FOREACH %] directive would work here. That seems like the natural means of abstracting the list. That is, the controller can set anything into the stash that FOREACH knows how to handle, including a plain Perl array. So, is it an oversight of the documentation examples or of the framework that FOREACH isn't used on the DBIC result set? --John ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Simple literal Model
I'm planning several web pages that will be the same except for the actual content. Rather than code the details in the TT template or prepare a list literally in the Controller, I'm thinking that this ought to go into a Model. But, it can just be a Perl declaration. Something like: my @data= ( { foo='bar', items=[qw/first second third/], bar='baz }, # 7 more rows ); and add to that some subs to slice and dice the information so the TT doesn't have to; e.g. give a list of all the foo's. How do I create a static, literal Model? And, what would its form be in order to make it properly abstract, so it =could= be replaced with a standard DBIC or other model back-end without affecting the code? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Root page for site (my first attempt!)
I just started trying Catalyst. I went through the Packt Publishing book, but now want a more technical explanation with details. Any suggestions on what documentation to read? With the situation as set-up by default, I would write: img src=/static/images/bad_logo.png / to access a site image. How can I configure it so I can write src=foo/bad_logo.png instead? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Root page for site (my first attempt!)
On 2/23/2011 5:41 AM, Carl Franks fireartist-at-gmail.com |Catalyst/Allow to home| wrote: On 23 February 2011 11:30, John M. Dlugoszwxju46g...@snkmail.com wrote: I just started trying Catalyst. I went through the Packt Publishing book, but now want a more technical explanation with details. Any suggestions on what documentation to read? With the situation as set-up by default, I would write: img src=/static/images/bad_logo.png / to access a site image. How can I configure it so I can write src=foo/bad_logo.png instead? Using TT, that would be: [% c.uri_for('/foo/bad_logo.png') %] Cheers, Carl I mean make the things under /foo serve as static files! My understanding is that uri_for takes a Controller's private spec and produces the URL. So what you wrote would be if I had a controller named Foo with a method named bad_logo.png. Am I missing something here? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Root page for site (my first attempt!)
On 2/23/2011 6:26 AM, Octavian Rasnita orasnita-at-gmail.com |Catalyst/Allow to home| wrote: But you can create one or more directory with static files, for example /images, /js, /css. These directories must be created under the root directory. And of course, it is recommended to configure the web server to not send the requests to those directories to the Catalyst app. That's exactly what I want. How do I tell Catalyst that /images should be static files under /root/images, rather than a controller named Images? And as Carl recommended, it is good to not hard-code the URLS in the templates because they won't work if you'll want to make some changes and want to put the whole application to listen to a different base than /, for example /old-site. So use $c-uri_for('/path/to/static/file'); or $c-uri_for_action('/path/to/action'); #for the dynamic pages I see, so do that for static files too, not just actions? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/