How to run perl script on PC, please.....

Discussion in 'Perl Misc' started by -=[ apocalypso ]=-, Jul 11, 2005.

  1. Hi Guys,

    I nave no expirienc with it at all, but I find interesting info which may
    help to my members...

    Here it is...

    Nokia-File-NFB version 0.01
    ====================================

    This module provides methods to modify or create the backup files used
    by the Nokia PC Suite - Backup And Restore program.

    It can be used to extract or add new elements to the file.

    These elements contain items such as the Phone Book, Calendar, Radio
    Settings,
    Pictures, Photos, etc.


    INSTALLATION

    To install this module type the following:

    perl Makefile.PL
    make
    make test
    make install

    DEPENDENCIES

    This module requires these other modules and libraries:
    Compress::Zlib

    AUTHOR
    Robert Price

    COPYRIGHT AND LICENCE
    Copyright (C) 2004 by Robert Price

    This library is free software; you can redistribute it and/or modify
    it under the same terms as Perl itself, either Perl version 5.8.3 or,
    at your option, any later version of Perl 5 you may have available.
    Code:
    http://www.cpan.org/modules/by-module/Nokia/



    =======================================================
    =======================================================
    =======================================================
    =======================================================


    Contacts and messages application saves the details into a Microsoft Access
    compatible database called Contacts2.mdb. Once I had discovered this all I
    had to do was import the database into Access and save it as XML. I then
    wrote the following Perl script to extract the name, number and email
    information from the XML file and generate vCards for each contact. The
    generated vCards are then just dropped into the phones contacts folder when
    it is connected to the computer with the DKU-2 USB cable or with Bluetooth.


    #!/usr/bin/perl -w

    ## Perl script to take a Nokia contacts database saved from the Nokia PC
    Suite,
    ## that has been converted to XML with MS Access, and then turn the
    contents
    ## into individual vCards suitable for importing into a Nokia 7610 phone.
    ##
    ## Robert Price - 02/07/2004
    ## http://www.robertprice.co.uk

    use strict;
    use XML::LibXML;

    ## create a new XML parser object.
    my $parser = XML::LibXML->new();

    ## parse the contacts file.
    my $document = $parser->parse_file('Contacts2.xml');

    ## find each Contacts2 node.
    foreach my $contacts2_node ($document->findnodes("//Contacts2")) {

    ## extact the name, number and email from the contacts2 node.
    my $name = $contacts2_node->findvalue('./Name/text()');
    my $number = $contacts2_node->findvalue('./Number1/text()');
    my $email = $contacts2_node->findvalue('./Text1/text()');

    ## write the data to a vCard with the same filename as the contacts
    name.
    open(CONTACT, ">contacts/$name.vcf");
    print CONTACT "BEGIN:VCARD\r\n";
    print CONTACT "VERSION:2.1\r\n";
    ## we should make REV dynamic with a current timestamp,
    ## but as we're only running it once we won't bother.
    print CONTACT "REV:20040802T093000Z\r\n";
    print CONTACT "N:;$name;;;\r\n";
    print CONTACT "TEL;CELL:$number\r\n" if ($number);
    print CONTACT "EMAIL:$email\r\n" if ($email);
    print CONTACT "FN:$name\r\n";
    print CONTACT "END:VCARD\r\n";
    close(CONTACT);
    }


    =============================
    ######### portfolio #########
    =============================
    www.symbian-freak.com
    =============================
    Symbian Freak introduces various researches for symbian users like:

    - Latest news, Error Fixes, Modding, Guides, Tutorials ,Ask guru form,
    and offcourse a detailed forum with professional support for every single user.
    To get more out of your favourite device, visit the website.

    =============================
    Don't take life too seriously
    you're not going to survive it,
    anyway
    -=[ apocalypso ]=-, Jul 11, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wet Basement
    Replies:
    1
    Views:
    2,505
    BobMonk
    Jul 15, 2003
  2. dpackwood
    Replies:
    3
    Views:
    1,767
  3. KK
    Replies:
    2
    Views:
    524
    Big Brian
    Oct 14, 2003
  4. Replies:
    6
    Views:
    139
    Tad McClellan
    Apr 14, 2005
  5. hara
    Replies:
    6
    Views:
    154
    Peter Scott
    May 27, 2006
Loading...

Share This Page