Skip to main content
Welcome guest. | Register | Login | Post

The Pike Language

1 reply [Last post]
supermike's picture
Joined: 2006-02-17

If you haven't tried out Pike, you might want to do so. It's kind of like PHP but with less lines of code to do similar tasks. It's great for Command-Line stuff and some are using it for making small GTK apps and short scripts for working with databases. It's still a little young, but is growing fast.

In Ubuntu, it's kind of hard to install. I had to turn on backports, multiverse, and universe options in /etc/apt/sources.list. Then, apt-get update. Then, I had to do:

apt-get cache search pike7.6 | grep -i "pike7.6" | sort

From there, I learned I had to do:

apt-get install pike7.6

and then do apt-get installs for any modules I thought I might be using, such as:

apt-get install pike7.6-manual
apt-get install pike7.6-reference
apt-get install pike7.6-gdbm
apt-get install pike7.6-pg
apt-get install pike7.6-mysql

and you know me, after installation, I had to turn off backports, multiverse, universe, and then do another apt-get update just so that I don't send my workstation into a convoluted OS where nothing works. I also *never* ran any suggested updates from inside the GUI (the red update button) until after I had done this last apt-get update without backports, multiverse, or universe.

From there, I knew that I had already created a PostgreSQL database called "test" with a set of logins inside a table called "logins". In logins, I had a column named "fullname". Therefore, I tested out this piece of code in a file that I named "sql.pike":

string names() {
	object db = Sql.Sql("postgres://localhost/test");
	array result = db->query("SELECT fullname FROM logins");
	return result[0]->fullname;

int main() {
	write(names() + "\n");
	return 0;

To run it, I typed:

pike sql.pike

It returned a list of fullnames. I dare say that's the shortest, most intuitive piece of code I've seen to do this similar task.

libervisco's picture
Joined: 2006-05-04

Sounds interesting. With such efficiency it might catch on, but I imagine it will take quite a while before it becomes nearly as popular as php because php is supported and runs everywhere while pike is yet to be introduced..

I suppose that after learning php learning pike may not be a problem though.


Comment viewing options