Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

parse::mediawikidump::links(3pm) [debian man page]

Parse::MediaWikiDump::Links(3pm)			User Contributed Perl Documentation			  Parse::MediaWikiDump::Links(3pm)

NAME
Parse::MediaWikiDump::Links - Object capable of processing link dump files ABOUT
This object is used to access content of the SQL based category dump files by providing an iterative interface for extracting the indidivual article links to the same. Objects returned are an instance of Parse::MediaWikiDump::link. SYNOPSIS
$pmwd = Parse::MediaWikiDump->new; $links = $pmwd->links('pagelinks.sql'); $links = $pmwd->links(*FILEHANDLE); #print the links between articles while(defined($link = $links->next)) { print 'from ', $link->from, ' to ', $link->namespace, ':', $link->to, " "; } STATUS
This software is being RETIRED - MediaWiki::DumpFile is the official successor to Parse::MediaWikiDump and includes a compatibility library called MediaWiki::DumpFile::Compat that is 100% API compatible and is a near perfect standin for this module. It is faster in all instances where it counts and is actively maintained. Any undocumented deviation of MediaWiki::DumpFile::Compat from Parse::MediaWikiDump is considered a bug and will be fixed. METHODS
Parse::MediaWikiDump::Links->new Create a new instance of a page links dump file parser $links->next Return the next available Parse::MediaWikiDump::link object or undef if there is no more data left EXAMPLE
List all links between articles in a friendly way #!/usr/bin/perl use strict; use warnings; use Parse::MediaWikiDump; my $pmwd = Parse::MediaWikiDump->new; my $links = $pmwd->links(shift) or die "must specify a pagelinks dump file"; my $dump = $pmwd->pages(shift) or die "must specify an article dump file"; my %id_to_namespace; my %id_to_pagename; binmode(STDOUT, ':utf8'); #build a map between namespace ids to namespace names foreach (@{$dump->namespaces}) { my $id = $_->[0]; my $name = $_->[1]; $id_to_namespace{$id} = $name; } #build a map between article ids and article titles while(my $page = $dump->next) { my $id = $page->id; my $title = $page->title; $id_to_pagename{$id} = $title; } $dump = undef; #cleanup since we don't need it anymore while(my $link = $links->next) { my $namespace = $link->namespace; my $from = $link->from; my $to = $link->to; my $namespace_name = $id_to_namespace{$namespace}; my $fully_qualified; my $from_name = $id_to_pagename{$from}; if ($namespace_name eq '') { #default namespace $fully_qualified = $to; } else { $fully_qualified = "$namespace_name:$to"; } print "Article "$from_name" links to "$fully_qualified" "; } perl v5.10.1 2010-12-05 Parse::MediaWikiDump::Links(3pm)

Check Out this Related Man Page

ln(1)							      General Commands Manual							     ln(1)

Name
       ln - link to a file

Syntax
       ln [ -f ] [ -i ] [ -s ] name1 [name2]
       ln [ -f ] [ -i ] [ -s ] name ... directory

Description
       A  link is a directory entry referring to a file.  A file, together with its size and all its protection information may have several links
       to it.  There are two kinds of links: hard links and symbolic links.

       By default makes hard links.  A hard link to a file is indistinguishable from the original directory entry.  Any  changes  to  a  file  are
       effective independent of the name used to reference the file.  Hard links may not span file systems and may not refer to directories.

       Given  one or two arguments, creates a link to an existing file name1.  If name2 is given, the link has that name.  The name2 may also be a
       directory in which to place the link.  Otherwise it is placed in the current directory.	If only the directory is specified,  the  link	is
       made to the last component of name1.

       Given  more  than two arguments, makes links to all the named files in the named directory.  The links made have the same name as the files
       being linked to.

Options
       -f   Forces existing destination pathnames to be removed before linking without prompting for confirmation.

       -i   Write a prompt to standard output requesting information for each link that would overwrite an existing file.  If  the  response  from
	    standard input is affirmative, and if permissions allow, the link is done. The -i option has this effect even if the standard input is
	    not a terminal.

       -s   Creates a symbolic link.

	    A symbolic link contains the name of the file to which it is linked.  The referenced file is used when an operation  is  performed	on
	    the  link.	 A  on a symbolic link returns the linked-to file.  An must be done to obtain information about the link.  The call may be
	    used to read the contents of a symbolic link.  Symbolic links may span file systems and may refer to directories.

See Also
       cp(1), mv(1), rm(1), link(2), readlink(2), stat(2), symlink(2)

																	     ln(1)
Man Page