Texture scaling to real world measurements?
If you only work with planes or meshes in which all faces have 90° angles between them, following the local object's coordinates, yes (typically planes and cubes which were only rotated in object mode and on which you didn't apply the rotation). You have to apply scale first with Ctrl + A -> scale.

1) Unwrap in edit mode with U, select the cube projection mode. By default it will make the smallest image's side to be 2 Blender Units long.

2) In Node Editor: Connect a Texture Coordinate Node with UV output to a Mapping node. Connect this Mapping node output to the vector input of your Image Texture Node.

3) Choose the appropriate Scale values in the Mapping node. "Scale factor" = 2 / "image's smallest side in Real World distance". The 2 is because of the cube projection scaling the smallest side to 2 BU. If you know your image is 1m on x and on 4m on y (in the real world), then give 2/1= 2 for x an y scale in the Mapping node


Other UV projection modes aren't predictable. If you want an always working solution, I think you will have to write it in OSL, but your render time will be 4-5 times slower.