Top "Require" questions

In interpreted languages like Lua, PHP and Ruby, "require" is a statement that tells the interpreter to include a certain source-file at that position where the "require" statement has been placed.

What's better of require(dirname(__FILE__).'/'.'myParent.php') than just require('myParent.php')?

Lots of famous PHP scripts including WordPress use dirname(__FILE__).'/myParent.php' instead of just 'myParent.php' when including …

php include require
Is there a pluralize function in Ruby NOT Rails?

I am writing some Ruby code, not Rails, and I need to handle something like this: found 1 match found 2 matches …

ruby require pluralize
How can I require an optional Perl module if installed?

I have Perl code which relies on Term::ReadKey to get the terminal width. My installation is missing this module, …

perl module require
PHP: Require path does not work for cron job?

I have a cron job that needs to include this file: require '../includes/common.php'; however, when it is …

php include cron require absolute-path
What is the proper way to extend a class in another file?

This is what I have in foo.php class Foo { public $foo = NULL; public $foo2 = NULL; public function setFoo ($foo, $…

php class require extends
Is there a shorter way to require a file in the same directory in ruby?

Is there a shorter way to require a file located in the same directory (as the script being executed)? require …

ruby path require
Disabling warning about "require" function in JSHint

I'm writing some code for Node.js and I'm currently using JSHint to check over my code. However, when I …

node.js require jshint
How to catch error of require() or include() in PHP?

I'm writing a script in PHP5 that requires the code of certain files. When A file is not available for …

php error-handling try-catch require fatal-error
electron 5.0.0 "Uncaught ReferenceError: require is not defined"

I had initially been using electron stable (4.x.x), and was able to use require in both my browser and …

javascript node.js electron require
Require nodejs "child_process" with TypeScript, SystemJS and Electron

I'm working on a simple nodejs electron (formerly known as atom shell) project. I'm writing it using angular 2, using the …

node.js typescript require electron systemjs