Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Looking up an "A road" on a web site
The Common Gateway Interface example from a Well House Consultants training course
More on The Common Gateway Interface [link]
Source code: roadfinder.pl Module: P403
#!/usr/bin/env perl

=head1 Single page web example.

A form will be displayed to allow the user to enter an A road number
and the following page will display the road's end points.

=cut


print "content-type: text/html\n\n";

while ($line = <DATA>) {
        push @roads, $line;
        }

# $whichroad = "A12";
($whichroad) = $ENV{QUERY_STRING} =~ /=(.*)/;
$whichroad ||= "A17";

print <<"HEADER"
<html><head><title>A great page in Leeds</title></head>
<body bgcolor=#CCFFCC><h2>Find a road</h2>
Ere you go ...<br><br>
HEADER
;

for ($k=0; $k<=$#roads; $k++) {
        if ($roads[$k] =~ /^$whichroad\s/) {
                print $roads[$k];
        }
}

$now = localtime();

print <<"FOOTER"
<br><br>
<form>Please enter a road number <input name=whichone></form>

<hr>
Copyright $now
</body>
</html>
FOOTER
;

__END__
A1 London to Edinburgh (The Great North Road)
A10 London to King's Lynn
A11 London to Norwich
A12 London to Colchester
A13 London to Shoeburyness
A14 Felixstowe to M1/M6 junction near Rugby
A15 Hull to Peterborough
A16 Stamford to Grimsby
A17 King's Lynn to Newark-on-Trent
A18 Doncaster to Ludborough
A19 Doncaster to Seaton Burn
A2 London to Dover (Watling Street)
A20 London to Dover
A21 London to Hastings
A22 London to Eastbourne
A23 London to Brighton
A24 London to Worthing
A25 Wrotham Heath to Guildford
A26 Maidstone to Newhaven
A27 Whiteparish to Pevensey
A28 Margate to Hastings
A29 Beare Green to Bognor Regis
A3 London to Portsmouth (Portsmouth Road)
A30 London to Land's End
A31 Guildford to Bere Regis
A32 Alton to Gosport
A33 Reading to Southampton
A34 Salford to Winchester
A35 Honiton to Southampton
A36 Bath to Southampton
A37 Bristol to Dorchester
A38 Bodmin to Mansfield
A39 Bath to Falmouth
A4 London to Bristol (The Great West Road, or Bath Road)
A40 London to Fishguard
A41 London to Birkenhead
A42 Appleby Magna (M42) to Kegworth (M1)
A43 Cherwell Valley to Stamford
A44 Oxford to Aberystwyth
A45 Birmingham to Thrapston
A46 Newark to Bath
A47 Great Yarmouth to Birmingham
A48 Highnam to Camarthen
A49 Ross-on-Wye to Bamber Bridge
A5 London to Holyhead (Watling Street)
A50 Leicester to Warrington
A51 Chester to Kingsbury, Warwickshire
A52 Newcastle-under-Lyme to Mablethorpe
A53 Buxton to Shrewsbury
A54 Buxton to Tarvin (Chester)
A55 Chester to Holyhead (The North Wales Expressway)
A56 Chester to Broughton (A59)
A57 Liverpool to Lincoln
A58 Prescot to Wetherby
A59 Liverpool to York
A6 St Albans to Carlisle (The A6 splits off from the A5 at St. Albans - though the A6 as numbered today starts at Luton)
A60 Loughborough to Doncaster
A61 Derby to Thirsk
A62 Manchester to Leeds
A63 Leeds to Hull
A64 Leeds to Scarborough
A65 Leeds to Kendal
A66 Grangetown to Workington
A67 Bowes (A66) to Crathorne (A19)
A68 Edinburgh to Darlington
A69 Carlisle to Blaydon
A7 Edinburgh to Carlisle
A70 Edinburgh to Ayr
A71 Edinburgh to Irvine
A72 Galashiels to Hamilton
A73 Cumbernauld to Abington
A74 Carlisle to Glasgow
A75 Gretna to Stranraer
A76 Dumfries to Kilmarnock
A77 Glasgow to Portpatrick
A78 Prestwick to Greenock
A79 Prestwick to Doonholm
A8 Edinburgh to Greenock
A80 Glasgow to Bonnybridge
A81 Glasgow to Callander
A82 Glasgow to Inverness
A83 Tarbet to Campbelltown
A84 Stirling to Lochearnhead
A85 Oban to Dundee
A86 Spean Bridge to Kingussie
A87 Invergarry to Uig
A88 Larbert to Stenhousemuir
A89 Glasgow to Newbridge
A9 Edinburgh to Thurso
A90 Edinburgh to Fraserburgh
A91 Bannockburn to St Andrews
A92 Dunfermline to Stonehaven
A93 Perth to Aberdeen
A94 Perth to Forfar
A95 Aviemore to Meld
A96 Aberdeen to Inverness
A97 Banff to Dinnet
A98 Fraserburgh to Fochabers
A99 Latheron to John O'Groats

Learn about this subject
This module and example are covered on the following public courses:
 * Deploying LAMP - Linux, Apache, MySQL, Perl/PHP
 * Linux Web Server
 * Using Perl on the Web
Also available on on site courses for larger groups

Books covering this topic
Yes. We have over 700 books in our library. Books covering Perl are listed here and when you've selected a relevant book we'll link you on to Amazon to order.

Other Examples
This example comes from our "The Common Gateway Interface" training module. You'll find a description of the topic and some other closely related examples on the "The Common Gateway Interface" module index page.

Full description of the source code
You can learn more about this example on the training courses listed on this page, on which you'll be given a full set of training notes.

Many other training modules are available for download (for limited use) from our download centre under an Open Training Notes License.

Other resources
• Our Solutions centre provides a number of longer technical articles.
• Our Opentalk forum archive provides a question and answer centre.
The Horse's mouth provides a daily tip or thought.
• Further resources are available via the resources centre.
• All of these resources can be searched through through our search engine
• And there's a global index here.

Web site author
This web site is written and maintained by Well House Consultants.

Purpose of this website
This is a sample program, class demonstration or answer from a training course. It's main purpose is to provide an after-course service to customers who have attended our public private or on site courses, but the examples are made generally available under conditions described below.

Conditions of use
Past attendees on our training courses are welcome to use individual examples in the course of their programming, but must check the examples they use to ensure that they are suitable for their job. Remember that some of our examples show you how not to do things - check in your notes. Well House Consultants take no responsibility for the suitability of these example programs to customer's needs.

This program is copyright Well House Consultants Ltd. You are forbidden from using it for running your own training courses without our prior written permission. See our page on courseware provision for more details.

Any of our images within this code may NOT be reused on a public URL without our prior permission. For Bona Fide personal use, we will often grant you permission provided that you provide a link back. Commercial use on a website will incur a license fee for each image used - details on request.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/resources/ex.php • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb