Perl catalyst application modification - perl

So I am attempting to modify an application written by another programmer. The program is written in Perl and apparently uses the Catalyst framework neither of which I have any experience with.
The code is well documented and my modifications seem pretty straightforward however when I try to change something (in the the controllers to be specific) the same to take no effect. Am I missing a step? I open the file edit it, save it, and try to load the web app in my browser. I've even deleted the entire contents of one of the controllers to see if it would break the application and it did not.
Please Help.
Thanks,
Ken

If the application was set-up in a sane way (using uri_for(_action) in templates and not specifically relying on the server/env/etc) you should be developing with the dev server. There are some practices that can make this difficult:impossible without modifications. This is all you should have to do–
cd {APPLICATION DIRECTORY}
# Read about it-
perldoc script/*_server.pl
# Run it-
script/*_server.pl -r -d
Unless there is something wonky in the setup, you’ll get http://localhost:3000/ running with your app.
Or, what is probably a good idea, run the application as the webuser in your apache setup. If there are files or access expected to be for that user, it might be important (e.g., if session or cache files are used and restricted to the user)–
sudo -u www script/*_server.pl -r -d
The flags turn on debugging output and the restarter so that every time you change files in the application, the server will restart automatically (if it compiles).
Catalyst is a joy to develop with and the dev server is part of why.

Related

Can't access admin panel for a website with CMS Made Simple: Class 'cms_cache_handler' not found

I'm working on setting up and migration of old sites to a new server from Dreamhost. I have 130 sites to migrate. 1 is successful. The version is: 1.12.1
The mods in the first site upgraded well. No problems. Have a procedure to migrate. That being said, the second site, as I followed my own documentation, fails when I try to access /admin/index.php
What I get is this below:
So, this is more informational than code... so please forgive me. I don't understand why CMS MADE SIMPLE is actually not simple.
That seems like an annoying issue. Forgive any repetition but here is what I would check:
that is is 100% functioning on existing server
correct php version 5.4.3+ (5.6+ recommended) on new server
that all files & database are copied fully & without errors
config.php settings are updated for new hosting & database
that .htaccess, php.ini/.user.ini settings are appropriate
check php error log
are there any additional modules installed that may require additional php modules
try more coffee or a nights sleep - both have helped me solve all sorts of issue in the past!
consider posting on CMSMS forum - will get a wider range of CMSMS users/experience and suggestions
Good luck
Chris
Not sure what process you are using. So presuming that the site was working correctly on existing hosting and that the new hosting meets recommended requirements, especially PHP version:
Export database
Zip/Compress all website files into a single file
Copy zipped file to new hosting
Create new database & user with full access
Unzip files and make sure that they are in the right location (probably website root)
CHMOD config.php to 0644 and edit database, username & password settings for new hosting, CHMOD back to 0444
Make sure .htaccess is using correct settings for new hosting
Login to admin and clear cache
Sorry that the instructions are so basic, but the process really is Simple.
Possible issues can occur if:
the PHP version is older than 5.4.3 (5.6+ recommended).
files copied individually using ftp and some are corrupted/not copied.
Apart from that it is pretty straight forward.
Hope it helps

Downloading entire sites for offline viewing

I'd like to download a website to whiten it into a private network.
I know it's being done a lot with StackOverflow itself, I just don't know how to do it myself.
The specific site I want to download is CPP-QUIZ with all the questions and explanations.
I've tried doing it with HTTrack, but it seems to download just a couple of questions and then it fails.
What is usually done to do something like this?
You can use a tool like wget or curl. If the site had an index then you could use wget's recursive option. It seems like it does not (the homepage just seems to choose a question at random for that specific site).
In that case you can just start generating commands:
wget http://cppquiz.org/quiz/question/1
wget http://cppquiz.org/quiz/question/2
wget http://cppquiz.org/quiz/question/3
And so on. After running those commands you would have the files downloaded to the directory you ran the commands from.
I was also wondering the same thing & stumbled upon this Github project this week called Diskernet
it saves resources to your file system as your browsing using your web browser (when launched with the diskernet binary or CLI tool)
It's still an early project, but I found I already started making use of it this week & it worked great!
https://github.com/i5ik/Diskernet
Highlights:
is able to download Single Page Web applications (doesn't use wget)
once you download a site, it works offline
There are alternative tools like SiteSucker, but I found Diskernet to work even for websites that require authentication

spine.js hem server, hem build FAQ for Windows

I'm trying to mimic some basic functionality of the Todos example. After reading spinejs.com, many articles, and taking a few attempts and not getting off the ground, I do need to ask and get some help here. I wish this was more clear-cut, and I'd like to help others as well. I'm on Windows7 and I'm using spine.app to create my app, controllers, models - also using jQuery.tmpl
I'm using CS, but pretty new to it.
I'm not really sure where I need to use require (if at all) - I'm using an modules.exports = .... statement on all M, C
so index.coffee should be able to find, I assume
Maybe this is not the case - I see even though controllers/contacts used a modules.exports statement, the index still used a require.
Is index.coffee just particular about visibility ?
I see Contacts uses Contact without any require statement.
I've seen the main.App Controller be instantiated, from CS, as in Todos
or in the jQuery() script in the html, as in Contacts.
I'm assuming you should either
-build the whole thing and include application.js OR
-use the jQuery() function to create your App via javascript.
If this does compile, will it end up in public/application.js ??
I'm getting a nasty parse error,
and yes, I'm aware you consistently have to use spaces (no tabs)
That being out of the way, I'm getting hung up on the 1st require line
require('lib/setup')
Am I going to need some Cygwin stuff ? I can get it if it helps.
and I've seen the Google Groups, guillaume86's comments, contrib and CS irc channel.
I'm not sure what (date) version of hem I have
but I did try the minify: false, option and a few other things, to try to debug this.
The good news: I'm pretty stubborn and will get this to work, if I can get a little help here.
More to come, but I'm going to close at this point.
Thanks in advance for your suggestions.
I don't think this will help the OP too much, but thought I'd write this up to help anyone else who is looking to get started with these awesome tools.
Before you go further: I've rewritten this with updates at How to manage client-side JavaScript dependencies?
Here's a basic list for getting set up with a Spine, hem, coffeescript app. I only develop on Linux, so I'm not sure if some of these steps would have problems on windows, namely npm commands. Should work fine on Mac; I know other who use the same toolchain.
Install NPM: curl http://npmjs.org/install.sh | sh on a *nix system. I'll assume it's available from the command line.
npm install -g spine.app will make spine available as a global command
spine app folder will make a Spine project called app in folder, generating the right directory structure and a bunch of skeleton files to get started.
cd to folder and edit dependencies.json for the libraries you need. Add them to slug.json so that hem knows where to find them as well. You can install hem globally (npm install -g hem) or locally, as in the next step.
npm install . to download all the dependencies you just entered in, including hem.
If you take a look at the default spine config, there is a app/lib/setup.coffee where you require all the libraries you need from your dependencies. Examples:
# Spine.app had these as dependencies by default
require('json2ify')
require('es5-shimify')
require('jqueryify')
require('spine')
require('spine/lib/local')
require('spine/lib/ajax')
require('spine/lib/manager')
require('spine/lib/route')
# d3 was installed via dependencies.json
require 'd3/d3.v2'
In index.coffee, you just require lib/setup and load the main controller for your app. In addition, you need to require any other classes in those other controllers.
The default generated index.html will usually be fine for loading your app, but modify as necessary.
From folder, run node_modules/hem/bin/hem server to start a hem server, and navigate to localhost:9294 to see your app. If you installed hem globally (npm install -g hem), then hem server by itself may work, but sometimes it gets confused about the path.
Build the rest of your app using proper MVC techniques, and use stylus for CSS and eco for views.
One more thing: normally, hem server will update automatically as you update your code and save files, which makes it a cinch to debug. Running hem build will compile your app into two files, application.js, which is minified and application.css. If you run hem server after this, it will use those files and no longer update automatically. So don't hem build until you actually need a minified version of your app for deployment.
See this other thread about that: Spine.js & hem getting started
Windows is supported (there were concerns in the past, but they have been resolved). There is actually a branch of hem that being more actively developed, since the original branch is no longer being maintained by the developer. You can check out branches version0_2 or version0_3 which have been getting updates and may eventually get windows support.
HTH.

Launch ColdFusion from command line

Is there a way to launch ColdFusion from the command-line?
I am not talking about launching the CF and related services with the net start command.
I remember doing this in the past. Basically, running CF from the command-line offered two advantages:
You didn't need to keep it as a Service and either have it always launch at boot-up or have to deal with the Services Manager
(more importantly) It echoed back to the screen all kinds of messages, especially error messages, which were helpful when actively developing (because you didn't need to go dig in the ColdFusion log files to find them)
It is possible that I'm mis-remembering and that this hasn't been available since ColdFusion 5.0. Is it at all possible with ColdFusion 9?
Update: Environment: Multi-server configuration with JRun.
Two ways to do this:
In development, add the server to ColdFusion Builder, and all the messages you talk about will show up in the console tab.
Start ColdFusion from the command line. The instructions are slightly different per environment but basically you want to get to bin directory and issue jrun start cfusion or coldfusion start or something similar . Post your environment for more specifics.
Go to C:\JRun\bin and issue jrun start cfusion
In your ColdFusion9/bin Folder you can find stop.bat and start.bat. Executing the latter gives you exactly what you want.

Rackup to use Thin instead of WEBrick

New to Sinatra, just development server up and running but rackup is using WEBrick instead of Thin, Thin gem is already installed, this has to be a simple configuration tweak but I don't know where. Oh while you are at it, does Thin auto-refresh when I change the source code? It appears that I have to stop and restart WEBrick when I make source code changes.
EDIT
As suggested, thin start works with a tweak for my setup. By itself, it throws an error "start_tcp_server": no acceptor (RuntimeError) which means I already have another service running on that port. To resolve the issue, I simply run thin start -p 9292. Hope this helps someone else.
I believe you'll likely just want to start up thin via something like:
bundle exec rackup -s thin
If you're on OSX you might want to check out Pow for your development environment.
For reloading files between requests: How to get Sinatra to auto-reload the file after each change?
You can start the server with Thin using just $ thin start.
If you want code reloading, use one of the several reloading libraries in the wild: Shotgun (which will fork and exit for every request, does not work on Windows), Rack Reloader (which is a Rack middleware) or Sinatra Reloader. I personally favor Sinatra Reloader, since it just reloads files that have changed and is therefore faster. Also there's the possibility to add additional files which shall be reloaded and files that must not be reloaded.