Coding 101 25 (Transcript)

Today on Coding 101: How to create dynamic webpages with Perl.

Net Casts you love with people you trust. This is Twit! Bandwidth for Coding 101 Is provided by

Father Robert Ballecer: This episode of Coding 101 is brought to you by Learn what you want, when you want with access to over 2400 high quality online courses. All for one low monthly price. To try it free for seven days visit

Fr. Robert: Welcome to Coding 101, it is the Twit show where we let you into the world of the code monkey. I’m Father Robert Ballecer.

Shannon Morse: And I’m Shannon Morse. For the next 30 minutes we are going to show you everything, well not everything, but pretty close to what you need to know all about Perl.

Fr. Robert: No it is everything.

Shannon: Every single bit. All of it. Compiled in this 30 minutes.

Fr. Robert: We have been going through regular expressions, which thankfully we are not done with it in the sense that there is a lot more if you can learn about regular expressions. But I think we are done with it for this month. We need to move on to other things. And yet, Reg Ex is something incredibly important right Shannon?

Shannon: That’s right it is. So today, I decided to stir it up with with a little review, just a little overview, of the different regular expressions that we have worked. So first off there were the ones that are called match operators. And those ones include M, S and TR. Those stand for match, substitute, which is the one that we have been using a ton of, and then transliterate. There is also modifiers that go at the end and those include GIMOSX. And those stand for global, case insensitive and we’ve used both of those plenty of times. We also have the treat as multiple lines, which is super handy as well as treat a single line. There is also evaluate the line, only once. And you can also do one that is extended, that is the X. And that is for any white space that you have.

Fr. Robert: Now remember, the easiest way to remember Reg Ex is to cut it up into four pieces. So if you’ve got that line the first piece is going to give you the match operator, the second piece is going to give you the expression you are looking for, the third piece is if you decide to swap it or to substitute it, that is what you are going to substitute into its place and that fourth piece is all the modifiers that you can add. And just as you said, you get to choose exactly how you look for the string you are looking for.

Shannon: So those are regular expressions. We are pretty much, well hopefully we are done with those for a little while. Of course they do come into play quite a bit. But I also wanted to show one of our viewership submissions as far as cocoa’s, from our Google plus community. Because that is growing and we love you guys and thank you so much for sharing your code. We haven’t had a lot of Perl ones lately but we did get a really good one from Darrell. And this is from Darrell Matley. This is a vowel word counter. I am going to click on his code. It says enter any kind of sentence. I am going to say, my favorite match operators include substitute, and match. And then you hit enter and it counts all the vowels, all the words with fouls in them. And then down here we also have it using a loop. We pretty much get the same exact calculations out down at the bottom too. Just to enter out you hit enter and it closes. Some very, very simple. I will show you what the code looks like. So he includes tons of comments for its, which is extremely nice. And then we ran down here and we have a little loop, a main loop. And this one just had…

Fr. Robert: There is your standard input.

Shannon: And then we scroll down a little bit farther…

Fr. Robert: And there are wonderful regular expressions.

Shannon: There you go. So we have a ton of Reg Ex used in here. it is super, super handy. I love the fact that he includes so many in here because it totally works with what we have been talking about on the show. So, very cool code and thank you so much Darrell for sharing that. I also wanted to share mine too. So, this involves what we've learned from Patrick last week. So remember when he told us that you don’t only have to use Perl in a notepad you can also do it via the command line.

Fr. Robert: He called this the most important thing you will ever learn about programming, and if he was wrong he was going to give you one of his bunnies. Now the Internet came out and said give me a bunny because I think you are totally bogus. But, it actually is very useful. It is very useful because it takes something that we would typically only used inside of our developer environment and it makes it a command line function. Which is kind of cool. I would say it is close to one of the most important things you will ever learn. But I still think Patrick owes me a bunny.

Shannon: It is pretty cool. And I can definitely see how this could come in really handy. Especially if you are working a lot and you need to use Perl code to search and replace things. So this is Perl Pi, as they call it. I discovered on my Windows computer, and I did some searching around on the Internet, it doesn’t work exactly the same on Windows. Surprisingly we didn’t get any email feedback about this but I did figure out that it doesn’t work the same. So you will put in, say your wildcard down here, and I tried this a series of ways before I decided to go searching on to Google. I had my colon might there. So it says can’t find string term leaders so I changed it to that, and then it wanted to replace the wildcard TXT. So it is apparently an issue with Windows. Because it is not UNIX.

Fr. Robert: Come on Windows. Stop letting me down.

Shannon: So instead of dealing with that and trying to fix it myself, I was well screw this I’m going to go into my VM player and I’m going to do it via Kalli Linux. So I just got into Kalli Linux and I proceeded to do it here. So I LS’ed into it and then CD’d into the desktop. I have read text documents over on the desktop, best websites and this is just a series of SDR websites first software defined radio. And I have software defined radio listed a couple of different times in these different documents, so I have that. I have five episodes listed where I have tutorials, beginner and intermediate. And I have Know How episodes.

 Fr. Robert: While you are looking for that I will say that you can make this work in Windows, you just have to slightly changed the text. Don’t learn it. The reason why we didn’t show it is because we don’t want you to learn that because it does not work like that on Linux or Mac. It is a little bit of a pain in the butt, so yeah.

Shannon: I have my three notepad documents in here. They all have software defined radios spelled out in each one. I want to change that to just say SDR. So what I will do is I will ride out Perl-Pi-E and they I have S for substitute/software defined radio/SDR and it is going to replace software defined radio with SDR/g. Then you just do wildcard,TXT. so when I hit enter it doesn’t say anything in here, but if I go into the best websites you will notice that appear where it says software defined radio now it says SDR. This one did not change because there is no spaces between software and defined and radio. But it did change again down here. And then same thing happened with my hack five episodes, these all change to SDR four tutorial and all that stuff. So, it totally works in my Kalli Linux machine. Not so much in Windows.

Fr. Robert: I am still kind of sulking that it doesn’t work right in Windows. Come on, stupid windows. Okay so we found something that Windows doesn’t do. But it does do everything else actually. So no hate mail please.

Shannon: Super, super fun.

Fr. Robert: Now before we actually get to that ad, you included something in the dock on the lighter side of programming that I really kind of like this. Do you want to explain that what this is?

Shannon: It is so funny. So, first off I found this I believe it is from XKCD. This is a cute little comic that one of our followers decided to post. This is from Next Craft and it says, “If you’re having problems I feel bad for you son, I got 99 problems so I used regular expressions now I have 100 problems”.

Fr. Robert: And Dennis, if you talk to experienced programmers there is a little bit of love hate. They understand it can be kind of confusing but seriously it is a very useful tool to have. You know what else is a useful tool to have?

Shannon: What’s that?

Fr. Robert: I just need to go someplace online where I can learn stuff. Because I have a bagel knowledge hole and I need to stuff it.

Shannon: I know a place like that. Where you can learn all sorts of things from different tutorials and people have made it in their videos are super professional and they look good.

Fr. Robert: I like that. That is the kind of knowledge that I need in this whole.

Shannon: That’s right. It is called Have you heard of it?

Fr. Robert: I’ve heard of it.

Shannon: So at helps You learn and keep up to date with everything you need to know about your software. You can pick up brand-new skills, you can do anything that you want. And you can explore new hobbies with their easy to follow video tutorials. So whether you want to master the fundamentals of programming, or you want to learn new programming languages like Python or Perl or you want to develop into design and engaging websites. offers thousands of courses in a variety of topics. released a new iPhone and iPad app for iOS seven and in hence their android app to provide chrome cast support. This is so cool. Comcast support. That is awesome. The iOS app includes a more visual intuitive interface and both new apps offer off-line courses in video viewing so you don’t have to be connected to the Internet to be able to use your account. This makes it easy and convenient to learn even in the environment without Internet access. So you could totally learn what your camping. That is amazing.

Fr. Robert: I see that RTD has some sort of fetish circling around Go Pro. I don’t know what that is. We were talking about programming a little earlier…

Shannon: Definitely go there and you can check out how to ride a motorcycle. And you can go in search for creating coupons. So see you have a website and you have an e-commerce site and you want to draw in more customers to your site, to buy your T-shirts or to buy your attack. You can go to this site, you can go to and you can learn how to create e-coupons for people to use and it will show you how to create expiration dates and how to do multiple coupon uses and things like that. it is really cool. also offers users a seamless way between mobile and desktop applications to be able to view courses wherever they want. New courses include essential training, simple android development tools, Photoshop, CC for photographers. They have 2400 courses with more added every single week. courses are produced at the highest quality, not like the homemade YouTube videos that you sometimes see. works with software companies To provide you updated training, the same day that new versions hit the market. So you will always have the very latest skills. Instructors are accomplished professionals at the top of their fields, there are passionate about teaching. They have beginner, intermediate and advanced courses for everybody. You can watch from your computer, your tablet, mobile device so whether you've got 15 minutes or 15 hours, each course is structured. So you can learn from start to finish. You can also search the transcripts, which is supercool. So you can find quick answers or you can read along with the video, if you prefer to read. Also offers certificates of completion when you finish a course. So you can publish that onto your linked in profile and get yourself a really nice job. It is only $25 a month for access to the entire lead course library. Were $37.50 a month you can subscribe to the premium plan, which includes exercise files that let you follow along with the instructors project. So you can use these exact same project assets that they do, which makes life very interesting for if you are following along with the tutorial. And you can try right now with a free seven day trial. Visit to access the entire library. That is 2400 courses, free for seven days. I love and you should too. They are very, very useful and we thank them.

Fr. Robert: Now one of the things I do like about lynda is that we were showing examples that were not tech related about the Go Pro and couponing. So it really does contain a nice breath of knowledge. It’s not just the depth, there is a lot of stuff there. Speaking of a lot of stuff there. We want to pull away from some of the stuff we’ve been doing in the first couple of episodes. We want to talk about webpages. Specifically about dynamically generated webpages. When you think about the most basic of webpages what do you think is in there?

Shannon: I think of an HTML file from when I was 15 years old and wanted to host my own animated gallery.

Fr. Robert: Exactly. And that is how we wrote the first webpages right? They were all static. So we had the HTML tag the body, close text at the bottom and then everything in the middle is what you saw.

Shannon: And no matter where you go, or what computer you were on it was always the same.

Fr. Robert: It would always be the same information. It would always be formatted the same. And that is what we learn for we designed static webpages. You put a little bit of text, a couple of images and we didn’t really have video links back then because it took too much bandwidth.

Shannon: Under construction!

Fr. Robert: But that is the most basic kind of webpage. Which you can still do. That still has a place if you are just creating some sort of informational page with data that is never going to change. But that is a very, very minimal period

Shannon: It is very rare.

Fr. Robert: And it looks ugly. It is not great. So what we have transferred is that we have transferred over to dynamically generated webpages. We don’t have static text that never changes, but we rely on some sort of process and we are going to talk about the possible processes to generate the code, generate the way the page looks based on settings that we have given it. Like we want to use this template and we want it to be this wide, we want it to hold these pictures, and this text. That is the sort of web that we have come to expect.

Shannon: That is all that you see now. Is dynamic websites.

Fr. Robert: Think about it. For example, I know a lot of people are still using WordPress. I still use WordPress. That is I’d dynamically generated content database. The easiest way to picture that is when you write your blog post you can change the way the page looks without changing the text. Right? So let’s say I’ve got my blog post and I don’t like the way the look is so why go to the settings of my WordPress blog and I want to use this template. And it changes the style, it will change the pictures, it will change the colors and it may even change the order of the text. The I don’t have to rewrite that. I don’t have to go back in to each and every page and rewrite it.

Shannon: You don't even have to copy and paste your body of text into the new theme. It just does it for you.

Fr. Robert: It just does it for you, because that is how it is when you dynamically generate your pages. Imagine when I was first starting and we didn’t have any of those technologies. There was nothing that could dynamically generated page easily. If you designed a page, and then you decided that you wanted to make a change to the format and let’s say your the site was 1000 pages, you would have to go into each and every one of those pages and change the element that you wanted. Not good. So we don’t do that anymore. Thank goodness. We are done with that. Now when we talk about dynamically generating webpages there are two ways to do it. There is client side and there is server-side.

Shannon: Okay, I've dealt with a little bit of that in some hacking tutorials I have done.

Fr. Robert: Especially the hacking tutorials. Because we are talking about scripting languages. A lot of exports will take advantage of these scripting period especially scripting on client side.

Shannon: So what are client and server for anybody that doesn’t know.

Fr. Robert: Let’s talk a little bit about that. When we talk about client side, it is just like the name implied. The processing, the interpreting happens on the client side. So that is on your computer. So, for example, when you go to my webpage and I want it to have a certain menu and has to be a little bit of animation I am going to write it in scripted code. But I’m going to write it in scripting that will be executed on your computer. Your browser will interpret all that as it is also loading up the HTML for the page. And it will give you what you see.

Shannon: So that is all happening on my client side.

Fr. Robert: That is all happening on the client side. Now the languages that people have for client-side scripting would include things like JavaScript, which includes Ajax which is with JavaScript and things like Action Script which is used for Adobe Flash, and Dart, VBScript, Type Script. Those are all client side scripting languages. Now the way you can tell most easily is unless they have done something weird because they want to obfuscate their scripting code the developers will include the code in the main page that loads. So in your browser you can go to file and this is actually a great way to play with scripting languages. You find something that you like and if it is a client-side script you can get it. Because it is on your browser. So you can go ahead and find out how they did it, take that and put it in your program, play with the parameters to see how this thing works period with that people in the chat room saying sometimes when I want to do something I just go to Google and I find this script I like and I copy and paste. There is nothing wrong with that.

Shannon: That is what I used to do when I was making my AnimeCons websites.

 Fr. Robert: And that is so cool. In the process of copying and pasting and then making it work for your page, you will learn how it works. That is a great way to learn, there is no shame in that. Now when we talk about client side, just remember that everything is happening in your browser so a lot of it is going to be dependent on the browser that you are using, the computer you are using and the processing power that you have.

Shannon: I want to explain why sometimes if I go to a website that is not set up correctly and I have a certain browser extension or a plug-in that doesn’t work right, when it gets to my browser it doesn’t work so well.

Fr. Robert: Yes. And that is why sometimes like if you have something in Firefox and it won’t work in chrome or you have something in chrome but it won’t work in IE…

Shannon: And if you email tech support they say what browser are you using? Do you have any extensions on right now?

Fr. Robert: Not always. Because you also can have a compatibility issues with server-side plug-ins on certain browsers. Just the way that they work. But most of the time, whenever they say what browser are you using it is because they are running some kind of client-side script that doesn’t play nicely. For example, this is something that I have been playing with. This is a fantastic map that shows you attacks around the world. So this is real-time information from the IP Viking network. They have honeypots all around the world that let you see what country is attacking what country. What the targets are. You can even see the IP’s that are initiating the tax and what IP’s they are heading for. I had this on all of July 4 weekend and it is kind of mesmerizing. You just watch it and say wow what is China doing right now. This only works in chrome period a lot of this does happen on the server side, but this is very heavy on JavaScript which is a client-side, browser side, your computer side initiated. Which means that if you have a slow computer it is not going to look very good. So there you go. That gives you a clarification of what the difference is between server-side and browser side. All right, now we have got the client side let's talk a little bit about the server side. Just like client side, of course, server-side means that all of the interpretation, all of the generation of the page is happening on the server side.

Shannon: So that is like whoever built the website, their server that they saved all that code on.

Fr. Robert: It dynamically generates your code. So it will be using the language like some of the more popular server-side scripting languages would be things like Python, PHP, ASP.NET, Perl, Ruby, Java, or JavaScript (server side), ColdFusion. but that means that all of the pages are dynamically generated on the server side before they are sent to the client. Now the advantage of that is that you are not as dependent on the client computer. So if the client has a really old computer or a busted browser, as long as they can understand HTML or XHTML it is going to be able to understand what you are sending it. On the other side, however, the client side, some people really like to use client-side computing because it gives you a bit more control over the individual computer. There are advantages, there are pros and cons to using client-side or server-side. But what you most need to know is that most of the advanced webpages that you might visit probably use a mixture of both. So you need to know a little bit of client-side, you need to know what little bit of server side because each of them has a strength and each of them has a weakness.

Shannon: So what does all this have to do with Perl?

Fr. Robert: What this has to do with Perl is that Perl is an absolutely fantastic server side scripting language. We use it here at twit to dynamically generate a page that will be sent out to individuals. In fact, one of the people that we have who is most responsible for doing that is our code warrior who I think maybe we should bring into the show. Ladies and gentlemen, it is Mr. Patrick Delahanty. Who is not just start CodeWarrior but who is the CodeWarrior for Twit TV. Patrick, thank you for coming back on the show.

Patrick Delahanty: My pleasure. I’m glad to be here.

Fr. Robert: We were just talking a little bit about dynamically generated webpages and that is what you do right? Could you imagine creating a static page in today’s era?

Patrick: Impossible, for what we have to do.

Fr. Robert: You just plain wouldn’t do it. Unless you were doing a practical joke. Now can you tell us a little bit how server-side scripting works here at Twit?

Patrick: Will actually most of the server-side stuff that we do here is in PHP, not Perl. But I do have a few Perl scripts behind the scenes. But in terms of Perl, I use it on my site to read the database and then present the data on a page without having to make a page for every possible data combination.

Shannon: That makes sense. Because that would take hours.

Fr. Robert: Let me ask you this because we are starting a little bit of a discussion in the chat room. People always have their favorite scripting language. How do you choose which server-side scripting language you are going to choose?

Patrick: It probably just depends on what you want to do with it. If you wanted to parse some input using regular expressions, Perl is really going to help you out. But if you change a lot of data inside the page, PHP would be a good option. But also it is what you are familiar with which is a good one to go with.

Fr. Robert: Let’s get down to the nitty-gritty. Why don’t you show us how we are going to use Perl to dynamically generate a webpage.

Patrick: Okay. First, before you can even dynamically generate the webpage you need the Web server setup. And that is a whole another thing. This isn’t server administration 101, so what I did was last week I downloaded Mamp and put that on my Matt. Now I have a Web server running on my Mac. It is an Apache server. You can also install the MySQL server. I can run PHP or Python or Perl with this. They do a version for Windows that is in beta, but there are other server options for Windows two. So this only took a minute or two to set up. It was very easy. Then I got it running and I have all my files in a directory here. Under Mamp, I have a cgi-bin directory which is where I put my Perl Scripts. I named it C101 just to have it nice and organized. so I've got for example scripts here that we can go through.

Fr. Robert: It is interesting to know and we should probably point this out, that we are heading into a little uncharted territory. Because previously when we were running Perl code we were doing it on our computers and we were assuming that we would create a problem that someone would download on their computer and run. We are now starting to talk about things that you would not do on your computer. You would not have these scripts on a server that people would be accessing period you have to change your thinking because you are not executing it here, you are actually executing it remotely, or the server is actually executing it for you.

Patrick: Right. And so I’ve got this local on my Mac with my Mamp server. And Mamp is just one of many options for a web server. but I can just as easily put it up on a server I have on Dream Host. Or if it is another script I can put it on the Twit server and have it there. It doesn’t have to be on my local machine. I am just doing that for this example. And so, other people outside the network can’t necessarily get into my machine because of the firewalls. But I can at least run it here and test it and show everybody.

Fr. Robert: So your computer is basically acting like a server for you.

Patrick: Yeah. And I’ve got it set up as my own little server.

Fr. Robert: All right.

Patrick: All right. So I've got this first script, which is Hello World. And so we will look at the code for that script. We will walk through this. So, I've got tell it where Pearl is. And you don’t have to do this on Windows apparently but on most environments you do have to say where Pearl is. I even do it on Windows just to be sure. And then you just start it by setting the content type for the page. So what I do is I type in content type: space text/ASCII. So I am just telling that Web server or that it is presenting ASCII text. And then I do two new lines. One is a blank. And then I am free to do whatever. You have to do two or it won’t work. Or you can do three and then it will print a blank line before your content. Then I do whatever scripting I want. I just put Hello World. And that gives me the Hello World webpage.

 Fr. Robert: I know they're going to be a lot of people who were going to say, Wait a minute I could just write as an HTML page. Why would I do it this way? That what we are trying to show is that the very basics of creating a page that could use the code that we have been playing with the last four weeks to dynamically generate something that the user will see on screen. Patrick do you have an example of that?

Patrick: I do. But I wanted To give another example first. First, to run this I just went to the URL appear, local host, cgi-bin, C101 and 25 demo one. That is just where my file is located. And so that is the URL of my page. Since it is local host you guys can’t get to it outside. Now on my second script it is a little different because what I did I told it this is HTML content it is not XD text.

Fr. Robert: Which means it will now understand HTML tags.

Patrick: Yes, so now, I have print the HTML in text. Which does the print is <EOF. Which means it will print everything until it gets to the EOF. So here, I am just printing out this HTML. So if you view the source of this page we will see.

Shannon: It should be the exact same thing. Cool.

Patrick: It is exactly what I printed.

Shannon: So you change the font size by putting in the five. This is all HTML for anybody who hasn’t played with it.

Patrick: This is the basic HTML.

Fr. Robert: Because he changed mode to HTML Perl knew by what this file was called what it would do is that it would push out HTML tags so that the browser would be able to understand it.

Shannon: Now if you had just changed the slash HTML to slash ASCII in your code would it end up printing out…

Patrick: Let’s take a look.

Fr. Robert: people are asking where is that being printed to, and where is that coming from. It is all coming from the script. So what the script is doing is that it is generating HTML code. That code does not exist until the script runs. When the script runs, it sends it to the browser. That is what the browser actually reads. Which is nice.

 Patrick: You can look at my script here, and I have changed it to slash ASCII and let’s go back here I will reload the page and it prints out…

Shannon: Ohhhh.

Fr. Robert: since you didn’t tell it that it was a HTML file, Perl said I am just going to send this as text, which means the browser did not have the proper wording to interpret it. It thought it should just print all this stuff.

Shannon: I've seen a website do this before.

Fr. Robert: Which is kind of funny.

Patrick: So now we will go into the third example. In this one, I have numbers one through 10. Is that not the most thrilling thing you have ever seen?

Shannon: That does not look like ASCII either.

Patrick: No. I did that as HTML and I could have done it as ASCII, but I chose HTML. Looking at the script…

Fr. Robert: Is start seeing it because nowhere here did he write an HTML file that said 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Now he is using Perl code. Now you see why this is so popular.

Patrick: Now I have one through one hundred and I will reload the page and now I’ve got numbers all the way down to 100.

Fr. Robert: And again, this is being dynamically generated. That file does not exist until the script is run and the server generates it and sends it to the browser.

Patrick: And so this is just one example of a script. You can have anything coming here and do whatever dynamics seeing it needs to do and then printed out period I just did printing numbers because that is pretty easy to understand.

Shannon: That is really cool.

Fr. Robert: Now, Patrick obviously, hopefully people at home are starting to see why this is useful. Because when I want to create a webpage for someone I don’t have to… just like when I wanted to print something on my screen I didn’t want it to write everything that goes on screen, I could use a couple of loops, I could use a couple statements to dynamically change what I could see. This means that I can use those exact same methods, that exact same way you are thinking to dynamically generate a webpage that someone will see over the Internet. There is no application I have to download. They just run it and the browser sees it. But, I know the question people are going to be asking is okay is that all I can do? I can just print stuff? Is that all that Perl is good for?

Shannon: I can do backgrounds and images period

Fr. Robert: Can I import different kinds of text? Can I reach into a database and pull links from videos on YouTube? Patrick, how would that work?

Patrick: You could call it APIs, like to twitter or to YouTube and there are whole other systems out there where you can get and send information to.

Shannon: Similar to Python.

Patrick: That is way beyond Coding 101, but there is a whole interface and you can just use all that data to interface with my SQL database. This is a start of a whole new world of being able to present the information on one page.

Fr. Robert: We’ve got Steve in the chat room who is saying so the loop is executed on the server? Yes. Because it is a server-side script. Now Patrick if you can go back to your example of counting to 100, if you could go and show them the page. Not the code, but the source. This is what the browser is seeing. Notice all the browser sees is HTML code to go in and print those numbers. It is not seeing any code to execute the program. That is the difference. If this was a client-side script you would see the script generating the numbers. Because it is a server-side script, because it is being done on the opposite side of the connection all you see is the result. This is the difference between client-side and server-side script.

Shannon: That is so cool.

Fr. Robert: This is one of the things that you are going to see any time we start talking about actual dynamic webpages. Obviously you don’t just want to write programs that loop numbers and things, you want to call from useful information. You can do that if you use a dynamically generated webpage. Because he could do something like, for example let’s say you have a calendar. Someone can click on a calendar number and then it will query your database and it will say, give me all the appointments between 3 o’clock and 7 o’clock on this day. And then it just dynamically prints it. That page does not exist until you call that script. That script executes on the server side which means the browser, the client about browser, will only receive the finished HTML code.

Shannon: So basically you are just going to call that script whenever you click on that link, whenever you open the website.

Fr. Robert: But before that, that page doesn’t exist. That is the dynamically created webpage. It is out here somewhere, there is no link to that script were to that page because it doesn’t exist until the script creates it. Now you know how it works. Now, all of the server-side scripting languages are going to work pretty much the same. And it can as Patrick explained, in depends on what you want them to make. If you want to do regular expressions and that kind of deep database querying, Perl is a great language to use. We use mostly PHP. M PHP is a really good language for making rich content on the web. Patrick is there something else that they should know about scripting before they go off and tried on their own?

Patrick: One more thing. Now that you are on a Web server and you have access to some environment variables. And so this fourth one, this fourth example I have, I’ve got some crazy HTML formatting here and this displays some of the variables that you can use. So here I’ve got my server name, the server port, the document root, this is actually where on the machine my files are located, so this is where the Web server is. The user agent, this tells me I am using Mozilla five. It tells me I am on a Mac and that I am running Mac OS 10, so I can get all that information from here. The script name that I’m actually running, so it knows itself. And then down here it has request method get and query string. Which is empty right now. Those are important for next week. but I can show you the script behind here, so I’ll step through this here. I set it as HTML and then I set some headers, I just do a head tag and title tag. In here, I’m printing the environment server name. So the title of the page is Local Hosts Environment. And so my HTML title I’ve got environment server names. So that sets the title. I do a body tag, the font, and then I do the same thing for the title of the page and then I set an array with the variables I want to display and for each of these variable, print, the name of the variable and then the value.

Shannon: So you didn’t have to put any specific information about your computer into the code, you are just doing this environment attack.

Patrick: It is pulling all this information from the Web server itself to know what script is running, what browser I’m using.

Fr. Robert: A quick note about server-side language, server side scripting languages. We are getting this question in the chat room. People are saying, so the server just automatically understands Perl? No, it doesn’t. Scripting language, just like any other language, needs to be installed on either the client or the server that it is going to be interpreted on. So if you want to use Perl on your server, if you want that to be a server side scripting language then you have to install Perl on your server. If you want to use PHP, same thing. In fact all the scripting languages you need to put that module so that when that link is called, when that page or that file is called, the server knows how to deal with it. Very simple to do, but remember all the computing, all the processing, albeit interpreting takes place on the server side. The only thing that the client gets, that your browser gets, is the finished product. The HTML file that you need to see.

Patrick: Most hosts out there will support Perl and PHP, Python. They’ve already got it installed for their customers. So if you choose a web host, definitely make sure that it supports the language that you need.

Fr. Robert: And actually, most web hosts today will have automatically run Perl and PHP, Ruby not so much. I think you have to request Ruby. I haven’t found a whole lot of posts that make better standard thing. But unless you are actually creating your own server that you are going to either host on your network you don’t have to install. Normally your hosting agent will.

Patrick: Absolutely.

Fr. Robert: That is Patrick Delahanty, he is our code warrior here at and we want to thank you again for being on the show. Do you want to tell the folks were they can find you when you are not coding?

Patrick: This week they can find me at It’s a podcast where we destroy toys for fun. We’ve been doing it for eight years now.

Shannon: He just destroyed a sailor chibi.

Fr. Robert: No! Don’t do it.

Patrick: That is how Shannon and I met.

Fr. Robert: What did you do?

Shannon: I was so sad. I saw it happen and I was like what you doing?

Patrick: Brian brushwood creates fire on this sailor set and Shannon was not happy about that.

Fr. Robert: Will have you one next time to talk a little, you just teased a little about what we’re going to be playing with, more dynamically generated webpages. We are going to get you into this and we are going to show you exactly how it works. So you can make something beautiful.

Shannon: What shall be asked audience to do this week?

Fr. Robert: That is a good question. I think what we need to do is most of you, I’m almost positive that most of you have some way to host something. I’m sure most of you have either a Web server that you are already playing with, or perhaps you’ve been having one that you been wanting to play with. Something that house like a free introductory offer. This is the time to do it. Go ahead and create some Perl script, drop it on your Web server, get it working and then send us the links in RG plus group. Now that we can actually view the source. go ahead and make sure that it is in there so we understand that you are out there. You are loud, you are proud and you are making Perl server-side scripts.

Shannon: Oh fun, I love it.

Fr. Robert: Now this is a lot of information. This is always a lot of information. So Shannon where do they go if they are a little lost and they want to find some step by step?


Fr. Robert: Go there. What you will find is that you will find all of our show notes. We are still looking for a much better way to host all of our show notes because this kind of breaks a lot of coding format. So we have been using a link to the GetHub, so that you can get over there and get our code. Now the code is what you actually want. That is the stuff that you can download onto your computer and follow along with each and every single episode. So go ahead and go to 101 and go ahead and find us. We've also got a cheap plus community right Shannon

Shannon: That’s right, we do! It is You can go over there enjoying the 1200 people that we already have in there and share your comments, your questions. There is a lot of information going on back and forth in there. Everybody is very helpful and I love that community.

Fr. Robert: I do. It is a lot of really fun people. Also, you can follow us live. Did you know that we actually do the show? We are here right? Every Thursday at 1:30 PM specific time you are going to find us at and you get to see the pre-show, the post show and all the bloopers. Also, if you are going to be here we have a chat room.

Shannon: We do. It is over at and you can join in and ask us questions during the life show, and we will answer them. We look for questions whenever we are doing a live show. So definitely join in.

Fr. Robert: He snubs!

Shannon: Hey what?

Fr. Robert: There is this thing that we are both going to be doing sometime in August.

Shannon: Is this the reason why we are pre-recording?

Fr. Robert: It might be. It might be why we are pre-recording. What are we doing again?

Shannon: Defcon! We are super excited! Both of us are going to Defcon for our own things but we are just going to happen to be there together. Defcon is the largest hacker conference in the United States, it is over in Las Vegas and it is from August 7-10. If you guys were planning to go definitely join us in the fun. It is $200 at the door and they don’t do preregistration. But there is even a lot of stuff happening in the casino after. If you don’t want to actually go to the convention itself. You don’t have to be a hacker to go. Just have some kind of techie interest. They have a lock picking Village, a gamer village…

Fr. Robert: Hardware hacking village, that is my favorite. I love that place.

Shannon: I will be spending most of my time in the vendor area with my booth. Of which will be super fun. It is a big surprise.

Fr. Robert: Now I know there is a lot of people out there who they kind of freak out every time we mention Defcon because they say “we are not a hacker”.

Shannon: You don’t have to be! I’m not.

Fr. Robert: If you are a newb, and you know nothing about security, you know nothing about programming Defcon is still a really good place to go because there is a lot of experts who love sitting down with newbies and saying let’s get you started. You want to learn how to lock pick? Here let me show you what it looks like here’s the tools are going to need. You want to learn how to solder something? Go to the hardware hacking village and Smitty who has been on our show Know How is awesome and he will show you the right way to do it. So you start off the right way. And, if you want to check out some of the security talks that is always a good place to get an ear on what is happening in the community.

Shannon: I have never been to a Defcon, but it is really fun to meet everybody who is going there. Because you get to talk to the experts in their league.

Fr. Robert: Don’t miss hacker jeopardy. Seriously, I can’t explain it but definitely go there. Until next time…

Shannon: I’m Shannon Morse.

Fr. Robert: And I’m Father Robert Ballecer.

All Transcripts posts