CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Symbolic Links



Jun 7, 2000, 2:25 PM

Post #1 of 4 (1236 views)
Symbolic Links Can't Post

What is the "-l" for a symbolic link?? I cant seem to find anything about this in my Perl book. All the book does is mention it!


Jun 7, 2000, 7:07 PM

Post #2 of 4 (1236 views)
Re: Symbolic Links [In reply to] Can't Post

Oops, now that others have responded, I see that you use an l and not a |. It's hard for me to see the difference.

P.S. It's almost impossible to read 'code' text. Who's idea was it to set it to size 1?


Assuming we are talking about the same thing, it's a pipe. I've never heard it called a symbolic link, but I can see the connection.

Essentially, it allows you to fork (run simultaneously) a command and either provide it's input or read it's output.

To access a program's output, you put the fork at the end (i.e. -| ). Example:

open (PIPEFROM, "who|");
while (<PIPEFROM> ) { print; }

All that code performs a `who` command and reads it's output.

You can't supply input and read output, so if you needed to do that, you need to do something like this:

open (FILE, "|command > output.txt");

You could "print FILE ...." to supply input and read the resulting file (output.txt) to read the output.

`who` and `command` are just examples. You will need to supply your own commands.

Dr. Zed

[This message has been edited by DrZed (edited 06-08-2000).]


Jun 8, 2000, 1:08 AM

Post #3 of 4 (1236 views)
Re: Symbolic Links [In reply to] Can't Post

A symbolic link is a Unix concept - somewhat like a shortcut in Windows, but better Smile


<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

There are two concepts of `link' in Unix, usually called
hard link and soft link. A hard link is just a name for a
file. (And a file can have several names. It is deleted
from disk only when the last name is removed. The number of
names is given by ls(1). There is no such thing as an `ori-
ginal' name: all names have the same status. Usually, but
not necessarily, all names of a file are found in the
filesystem that also contains its data.)

A soft link (or symbolic link, or symlink) is an entirely
different animal: it is a small special file that contains a
pathname. Thus, soft links can point at files on different
filesystems (possibly NFS mounted from different machines),
and need not point to actually existing files. When
accessed (with the open(2) or stat(2) system calls), a
reference to a symlink is replaced by the operating system
kernel with a reference to the file named by the path name.
(However, with rm(1) and unlink(2) the link itself is
removed, not the file it points to. There are special sys-
tem calls lstat(2) and readlink(2) that read the status of a
symlink and the filename it points to. For various other
system calls there is some uncertainty and variation between
operating systems as to whether the operation acts on the
symlink itself, or on the file pointed to.)

ln makes links between files. By default, it makes hard
links; with the -s option, it makes symbolic (or `soft')


Jun 8, 2000, 10:40 AM

Post #4 of 4 (1236 views)
Re: Symbolic Links [In reply to] Can't Post

-l is covered in perlfunc

-l "x" test whether x is a symbolic link


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives