prerequisites to install perl on OpenSuse 13.1 :: adding perl-repo

hello dear linux-experts

the question of the day:prerequisites to install perl on OpenSuse 13.1 :: adding perl-repo

while i wanted to install some perl-modules on my opensuse -version 13.1 i am willing to get some insights into the system <-

what is allready installed.
which prerequisites do i need to get installed perl modules

  • probably i need a make -
    i had lots of troubles some months ago - with a bad bad make…
    some perl modules were not (!!!) not installable.

to day i added the perl repo:

martin@linux-70ce:~> zypper repos -d
# | Alias                        | Name                         | Aktiviert | Aktualisieren | Priorität | Typ    | URI                                                           | Dienst
--+------------------------------+------------------------------+-----------+---------------+-----------+--------+---------------------------------------------------------------+-------
1 | All_of_Packman               | Packman                      | Ja        | Ja            |   10      | rpm-md | http://packman.inode.at/suse/openSUSE_13.1/                   |       
2 | M17N                         | M17N                         | Ja        | Ja            |   99      | rpm-md | http://download.opensuse.org/repositories/M17N/openSUSE_13.1/ |       
3 | openSUSE 13.1 NON-OSS        | openSUSE 13.1 NON-OSS        | Ja        | Ja            |   99      | yast2  | http://download.opensuse.org/distribution/13.1/repo/non-oss/  |       
4 | openSUSE 13.1 NON-OSS Update | openSUSE 13.1 NON-OSS Update | Ja        | Ja            |   99      | rpm-md | http://download.opensuse.org/update/13.1-non-oss/             |       
5 | openSUSE 13.1 OSS            | openSUSE 13.1 OSS            | Ja        | Ja            |   99      | yast2  | http://download.opensuse.org/distribution/13.1/repo/oss/      |       
6 | openSUSE 13.1 OSS Update     | openSUSE 13.1 OSS Update     | Ja        | Ja            |   99      | rpm-md | http://download.opensuse.org/update/13.1/                     |       
7 | openSUSE-12.3-1.7            | openSUSE-12.3-1.7            | Ja        | Nein          |   99      | yast2  | cd:///?devices=/dev/disk/by-id/ata-TEAC-DV-W28S-R,/dev/sr0    |       
8 | repo-update-non-oss          | openSUSE-13.1-Update-Non-Oss | Ja        | Ja            |   99      | rpm-md | http://download.opensuse.org/update/13.1-non-oss/             |       
martin@linux-70ce:~> 



how to get an overview on the - allready installed - perl-modules?

love to hear from you

Since perl is already installed, I would think you could probably manage by just installing some modules from the CPAN site.

On 2014-05-25 23:26, nrickert wrote:
>
> Since perl is already installed, I would think you could probably manage
> by just installing some modules from the CPAN site.

Or the perl repo:

http://download.opensuse.org/repositories/devel:/languages:/perl/openSUSE_13.1


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

good eveing dear linux-experts.- hello dear Robin and Nrickert,

many many thanks for all you did - i like the help - it is appreciated very very much!!

i will do all you advice me. I will add modules and i will try to do it via the repos this may help to avoid some dependencies and issues with the installationn. if i have more needs and do need modules furthermore i will digg deeper into the usage of the cpan - i e. to install them via console.

i have a set of XML data, - it is derived from a planet file and looks like the following:

what i do: with the use of a Perl program that reads XML data and posts it into a MySQL database.
in other words: i want to store the data i gathered form the planet-file in a mysql-db.
i am using XML::Twig and DBI for storing a xml-file into a myql-db

See the sample data and the program -(below)

The data i have it is derived from the planet-file - cf. openstreetmap -
after receiving the data subsequently i d like to pass it over to the mysql db.

note- can i use the allready installed and activated a mysql-database
see the code - the perl code that uses DBI


 
#!/usr/bin/perl  
use strict ; 
use DBI; 
use XML::Twig; 
 
# prepare database 
my $dbh=dbh(); # connect 
init(); 
$dbh->do('USE db123'); 
#$dbh->do('DELETE FROM pois'); 
 
# sql 
my $sql = 'REPLACE INTO pois VALUES (?,?,?,?,?,?)'; 
my $sth = $dbh->prepare($sql); 
 
# set up handler 
my $t = XML::Twig->new(  
  twig_handlers => { 'node' => \&node } 
); 
 
# parse xml 
my $xml = do { local $/; <DATA> }; 
$t->parse($xml); 
#$t->parsefile('.osm'); 
 
sub node { 
  my ($t,$elt) = @_; 
   
  my %data=( 
   'id'  => $elt->att('id'), 
   'lat' => $elt->att('lat'), 
   'lon' => $elt->att('lon'), 
   ); 
  for my $tag ( $elt->children() ){ 
    $data{$tag->att('k')} = $tag->att('v'); 
    #print $tag->att('k').' = '.$tag->att('v')."
"; 
  } 
  
  # update database 
  my @f = map{ $data{$_} }('id','lat','lon','name','amenity','operator'); 
  if ($f[3] ne '' && $f[4] ne '' && $f[5] ne ''){ 
    print "-- INSERT --
". 
    (join "
",@f). 
    "

"; 
    $sth->execute(@f); 
  } 
} 
 
 
sub init { 
  $dbh-> do('CREATE DATABASE IF NOT EXISTS db123  
             DEFAULT CHARACTER SET latin1  
             COLLATE latin1_german2_ci'); 
  $dbh->do('USE db123'); 
  $dbh->do('CREATE TABLE IF NOT EXISTS pois ( 
           id       BIGINT(20) UNSIGNED NOT NULL, 
           lat      FLOAT(10,7) NOT NULL, 
           lon      FLOAT(10,7) NOT NULL, 
           name     VARCHAR(255) COLLATE utf8_bin NOT NULL, 
           amenity  VARCHAR(255) COLLATE utf8_bin NOT NULL, 
           operator VARCHAR(255) COLLATE utf8_bin NOT NULL, 
           PRIMARY KEY  (id) 
          ) ENGINE=MyISAM DEFAULT  
            CHARSET=utf8  
            COLLATE=utf8_bin'); 
} 
 
sub dbh { 
  my $dsn = "DBI:mysql:database=;host=localhost"; 
  my $dbh = DBI->connect($dsn, 'user', 'pwd', 
            {RaiseError => 1, PrintError => 1})  
            or die (Error connecting " $DBI::errstr"); 
}




see the xml-file that comes out of a osm-parser - it is formatted in xml: which method fits if i want to store the output of this request to a mysql database the dataset i have gathered from this site: http://overpass-turbo.eu

see the output here - the xml file that has the data that i want to store in the mysql database.



<node id="2064639440" lat="49.4873181" lon="8.4710548"> 
    <tag k="amenity" v="restaurant"/> 
    <tag k="cuisine" v="turkish"/> 
    <tag k="email" v="info@lynso.de"/> 
    <tag k="name" v="Kilim  - Café und Bar Restaurant"/> 
    <tag k="opening_hours" v="Su-Th 17:00-1:00; Fr, Sa 17:00-3:00"/> 
    <tag k="operator" v="Cengiz Kaya"/> 
    <tag k="phone" v="06 21 - 43 755 371"/> 
    <tag k="website" v="http://www.kilim-mannheim.de/"/> 
  </node> 
  <node id="2126473801" lat="49.4851170" lon="8.4756295"> 
    <tag k="amenity" v="restaurant"/> 
    <tag k="cuisine" v="italian"/> 
    <tag k="email" v="mannheim1@vapiano.de"/> 
    <tag k="fax" v="+49 621 1259 779"/> 
    <tag k="name" v="Vapiano"/> 
    <tag k="opening_hours" v="Su-Th 10:00-24:00; Fr-Sa 10:00-01:00"/> 
    <tag k="operator" v="Vapiano"/> 
    <tag k="phone" v="+49 621 1259 777"/> 
    <tag k="website" v="http://www.vapiano.de/newsroom/?store=29"/> 
    <tag k="wheelchair" v="yes"/> 
  </node>



well - questions are the followings

  • how to handle the xml-file.
  • can i make usage of the allready installed mysql - db
  • how to make usage of the xml-file. - note the xml-file is very very big file.

btw - what bout the fields of the db

[FONT=Arial]||
|—|

update database

my @f = map{ $data{$_} }(‘id’,‘lat’,‘lon’,‘name’,‘amenity’,‘operator’)

[HR][/HR]

so - in other words. if i need more fields in the database - for the POI (that is the
dataset that i get from the planet-file) then i extend the above mentioned code-line!?

love to hear from you

greetings
[/FONT]

XML::Twig and DBI are part of the standard distribution, no need for an additional repo in this case.
Just install the packages perl-XML-Twig and perl-DBI.
Btw, openSUSE’s perl module packages provide things like “perl(XML::Twig)”, so to install the module XML::Twig, you could also run:

sudo zypper in perl(XML::Twig)

which would install the openSUSE package perl-XML-Twig.

note- can i use the allready installed and activated a mysql-database
see the code - the perl code that uses DBI

Yes, of course.
You just have to specify the correct user/password in your code of course. You already connect to localhost anyway AFAICS.

hello dear wolfi

many many thanks for your quick reply. great to hear from you.

great to hear that the perl modules are allready inlcuded in the repo. And that i can make usage of the allready installed database.
That sounds very very good.

well - some final questions are the followings - that reflect the perl-code that you see above.

see the perl-code - note: i am pretty new to Perl.

btw - what bout the fields of the db


[FONT=Arial]# update database  
  my @f = map{ $data{$_} }('id','lat','lon','name','amenity','operator')[/FONT]

[FONT=Arial]
[/FONT]
[FONT=Arial,Helvetica, sans-serif]
so - in other words. if i need more fields in the database - for the POI (that is the dataset that i get from the planet-file) then i extend the above mentioned code-line!? is this correct!? Can i do so!? i guess
[/FONT]

btw - all the ideas of getting the data out of the planet file are derived from two sites that inspired me.

what i aim is to have a perl sciript that helps me to the data stored that i gatherd out of the request of www.overpass-turbo.eu
(a method to request the openstreetpap). Therefore i have a Perl program that reads XML data and posts it into a MySQL database.

some thougts that are important:
**what IS AIMED: **aimed is to transform data out of German osm-pbf-files - in order to get the data (not to creat maps again)

see the source (s)= Geofabrik Download Server ranging form 10 MB (Bremen) to 390 MB (Nordrhein Westfalen) the osm.pbf-files are not too big; Question: which method is the best - the most appropiate? - to store the results in a mysql-db or just have big calc-sheets (with csv-data)

  • only straightforward from files that
  • no backimport of data to OSM from a .csv file

i am inspired by the pages:

first page:

http://oegeo.wordpress.com/2012/03/06/a-self-updating-openstreetmap-database-of-us-bridges-a-step-by-step-guide/

I had what I thought was a pretty straightforward use case for OpenStreetMap data:
I want all bridges in the US that are mapped in OpenStreetMap in a PostGIS database.

There are about 125,000 of them – for now loosely defined as ‘ways that have the ‘bridge’ tag‘. So on the scale of OpenStreetMap data it’s a really small subset. In terms of the tools and processes needed, the task seems easy enough, and as long as you are satisfied with a one-off solution, it really is. You would need only four things:

A planet file
A boundary polygon for the United States
A PostGIS database loaded with the osmosis snapshot schema and the linestring extension
osmosis, the OpenStreetMap ETL swiss army tool.

note this guy makes usage of postgis. - perhaps i start with mysql - or postgresql - since i do not need maps in the end- i only need
the text-data - for the pois - no mapping data for rebuilding maps again…

the second inspiration: User:Brogo/OpenLayers Datenbankanbindung - OpenStreetMap Wiki

see the ideas of database connecting to osm - with perl


CREATE DATABASE `db123` DEFAULT CHARACTER SET latin1 COLLATE latin1_german2_ci;
USE hans;
 
CREATE TABLE `pois` (
  `id` BIGINT(20) UNSIGNED NOT NULL,
  `lat` FLOAT(10,7) NOT NULL,
  `lon` FLOAT(10,7) NOT NULL,
  `name` VARCHAR(255) COLLATE utf8_bin NOT NULL,
  `amenity` VARCHAR(255) COLLATE utf8_bin NOT NULL,
  `operator` VARCHAR(255) COLLATE utf8_bin NOT NULL,
  `vending` VARCHAR(255) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;




see the code

#!/usr/bin/perl -w
 
use strict ;
use OSM::osm ;
 
my $file ;
my $nodeUser ;
my @nodeTags ;
my $nodeTags ;
my $ref1 ;
my $line ;
my $tag;
my $nodeName;
 
my $id ="1" ;
my $lat ;
my $lon ;
my $name ;
my $amenity ;
my $operator ;
my $vending;  
 
 
$file = "c:/osm/planet/pois.osm" ;
 
openOsmFile ($file) ;
open(AUSGABE, ">c:/osm/planet/mysql.txt");
($id, $lon, $lat, $nodeUser, $ref1) = getNode2 () ;
 
while ($id != -1 ) {
    $name ="" ;
    $amenity ="" ;
    $operator ="" ;
    $vending ="" ;
 
    @nodeTags = @$ref1;
        foreach my $tag    (@nodeTags) {
            if ($tag->[0] eq "name") { $name = scalar ($tag->[1] )};
            if ($tag->[0] eq "amenity") { $amenity = scalar ($tag->[1] )};
            if ($tag->[0] eq "operator") { $operator = scalar ($tag->[1] )};
            if ($tag->[0] eq "vending") { $vending = scalar ($tag->[1] )}
            }            
        if     ($name ne "" | $amenity ne "" | $operator ne"" | $vending ne"")
            {print AUSGABE "$id^$lat^$lon^$name^$amenity^$operator^$vending
";}
        ($id, $lon, $lat, $nodeUser, $ref1) = getNode2 () ;
 
}
close(AUSGABE);
closeOsmFile () ;



  • wolfi, Robin Listas and Nrickert - how do you find these ideas.

i want to** follow only one goal: what IS AIMED: **aimed is to transform data out of German osm-pbf-files - in order to get the data (not to creat maps again)

see the source (s)= Geofabrik Download Server ranging form 10 MB (Bremen) to 390 MB (Nordrhein Westfalen) the osm.pbf-files are not too big; Question: which method is the best - the most appropiate? - to store the results in a mysql-db or just have big calc-sheets (with csv-data)

  • only straightforward from files that
  • no backimport of data to OSM from a .csv file

love to hear from you

greetings

hello dear buddies

l found the following data


martin@linux-70ce:~> zypper search --installed-only | grep perl
i | apache2-mod_perl                           | Perl-Einbettung für Apache                                                                                           | Paket  
i | devel_perl                                 | Perl-Entwicklung                                                                                                     | Schema 
i | openSUSE-2014-225                          | less: Fix lesspipe.sh for removing properly the leftover tmp files when viewing patch files without colordiff        | Patch  
i | openSUSE-2014-368                          | glibc: Properly handle forced elision in pthread mutex trylock                                                       | Patch  
i | patterns-openSUSE-devel_perl               | Meta package for pattern devel_perl                                                                                  | Paket  
i | perl                                       | Der Perl-Interpreter                                                                                                 | Paket  
i | perl-Archive-Zip                           | Provide an interface to ZIP archive files                                                                            | Paket  
i | perl-Bootloader                            | Library for Configuring Boot Loaders                                                                                 | Paket  
i | perl-Clone                                 | recursively copy Perl datatypes                                                                                      | Paket  
i | perl-Config-Crontab                        | Read/Write Vixie-kompatible crontab(5)-Dateien                                                                       | Paket  
i | perl-Crypt-SmbHash                         | Perl-Modul Crypt::SmbHash                                                                                            | Paket  
i | perl-DBD-SQLite                            | Self-contained RDBMS in a DBI Driver                                                                                 | Paket  
i | perl-DBI                                   | Database independent interface for Perl                                                                              | Paket  
i | perl-Data-Dump                             | Pretty printing of data structures                                                                                   | Paket  
i | perl-Digest-HMAC                           | Keyed-Hashing zur Nachrichtenauthentifizierung                                                                       | Paket  
i | perl-Digest-MD4                            | Perl-Schnittstelle für den MD4-Algorithmus                                                                           | Paket  
i | perl-Digest-SHA1                           | Perl Interface to the SHA-1 Algorithm                                                                                | Paket  
i | perl-Encode-Locale                         | Determine the locale encoding                                                                                        | Paket  
i | perl-Error                                 | Error/exception handling in an OO-ish way                                                                            | Paket  
i | perl-File-Listing                          | parse directory listing                                                                                              | Paket  
i | perl-File-RandomAccess                     | Random Access Reads of Sequential File or Scalar                                                                     | Paket  
i | perl-HTML-Parser                           | HTML-Parser-Klasse                                                                                                   | Paket  
i | perl-HTML-Tagset                           | Datentabellen für das Parsen von HTML                                                                                | Paket  
i | perl-HTML-Tidy                             | (X)HTML validation in a Perl object                                                                                  | Paket  
i | perl-HTTP-Cookies                          | HTTP cookie jars                                                                                                     | Paket  
i | perl-HTTP-Daemon                           | a simple http server class                                                                                           | Paket  
i | perl-HTTP-Date                             | Date conversion routines                                                                                             | Paket  
i | perl-HTTP-Message                          | HTTP style message (base class)                                                                                      | Paket  
i | perl-HTTP-Negotiate                        | choose a variant to serve                                                                                            | Paket  
i | perl-IO-HTML                               | Open an HTML file with automatic charset detection                                                                   | Paket  
i | perl-IO-Socket-INET6                       | Object interface for AF_INET/AF_INET6 domain sockets                                                                 | Paket  
i | perl-IO-Socket-SSL                         | Nearly transparent SSL encapsulation for IO::Socket::INET                                                            | Paket  
i | perl-Image-ExifTool                        | Perl module to read and write meta information                                                                       | Paket  
i | perl-LWP-MediaTypes                        | guess media type for a file or a URL                                                                                 | Paket  
i | perl-LWP-Protocol-https                    | Provide https support for LWP::UserAgent                                                                             | Paket  
i | perl-MLDBM                                 | store multi-level Perl hash structure in single level tied hash                                                      | Paket  
i | perl-Net-DBus                              | Perl extension for the DBus message system                                                                           | Paket  
i | perl-Net-Daemon                            | Perl extension for portable daemons                                                                                  | Paket  
i | perl-Net-HTTP                              | Low-level HTTP connection (client)                                                                                   | Paket  
i | perl-Net-LibIDN                            | Net::LibIDN Perl module                                                                                              | Paket  
i | perl-Net-SSLeay                            | Perl extension for using OpenSSL                                                                                     | Paket  
i | perl-NetxAP                                | Interface to the protocol family IMAP, IMSP, ACAP, and ICAP                                                          | Paket  
i | perl-Params-Util                           | Simple, compact and correct param-checking functions                                                                 | Paket  
i | perl-Parse-RecDescent                      | Generate Recursive-Descent Parsers                                                                                   | Paket  
i | perl-PlRPC                                 | Perl Extension for Writing PlRPC Servers                                                                             | Paket  
i | perl-RPC-XML                               | A set of classes for core data, message and XML handling                                                             | Paket  
i | perl-SQL-Statement                         | SQL parsing and processing engine                                                                                    | Paket  
i | perl-Socket6                               | IPv6 Sockets (Perl Module)                                                                                           | Paket  
i | perl-Term-ReadKey                          | Module for Simple Terminal Control                                                                                   | Paket  
i | perl-TermReadLine-Gnu                      | Perl extension for the GNU Readline/History Library                                                                  | Paket  
i | perl-Text-Wrapper                          | Word wrap text by breaking long lines                                                                                | Paket  
i | perl-Tie-IxHash                            | ordered associative arrays for Perl                                                                                  | Paket  
i | perl-TimeDate                              | Parse date strings into time values                                                                                  | Paket  
i | perl-URI                                   | Uniform Resource Identifiers (absolute and relative)                                                                 | Paket  
i | perl-WWW-RobotRules                        | database of robots.txt-derived permissions                                                                           | Paket  
i | perl-X11-Protocol                          | Perl module for the X Window System Protocol, version 11                                                             | Paket  
i | perl-X500-DN                               | Provides an interface for RFC 2253 style DN strings                                                                  | Paket  
i | perl-XML-LibXML                            | Perl Binding for libxml2                                                                                             | Paket  
i | perl-XML-NamespaceSupport                  | Eine einfache generische Namespace-Support-Class                                                                     | Paket  
i | perl-XML-Parser                            | Ein Perl-Modul zum Parsen von XML-Dokumenten                                                                         | Paket  
i | perl-XML-SAX                               | XML::SAX Perl-Modul                                                                                                  | Paket  
i | perl-XML-SAX-Base                          | Base Class SAX-Treiber und Filter                                                                                    | Paket  
i | perl-XML-SAX-Expat                         | SAX2 Driver for Expat (XML::Parser)                                                                                  | Paket  
i | perl-XML-Simple                            | Easily read/write XML (esp config files)                                                                             | Paket  
i | perl-XML-Twig                              | A perl module for processing huge XML documents in tree mode.                                                        | Paket  
i | perl-XML-XPath                             | Ein Set an Modulen für das Einlesen und Auswerten von XPath-Anweisungen                                              | Paket  
i | perl-XML-XPathEngine                       | Re-usable XPath engine for DOM-like trees                                                                            | Paket  
i | perl-apparmor                              | Perl interface for libapparmor functions                                                                             | Paket  
i | perl-base                                  | Der Perl-Interpreter                                                                                                 | Paket  
i | perl-doc                                   | Perl Documentation                                                                                                   | Paket  
i | perl-gettext                               | Message handling functions                                                                                           | Paket  
i | perl-libwww-perl                           | The World-Wide-Web library for Perl                                                                                  | Paket  
i | perlref                                    | Perl 5 Reference Guide                                                                                               | Paket  
i | yast2-perl-bindings                        | YaST2 - Perl Bindings                                                                                                | Paket  
martin@linux-70ce:~> 
martin@linux-70ce:~> 

guess that i am able to go on - and to run the first tests with the script