Results 1 to 6 of 6

Thread: Perl and XML

  1. #1
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Perl and XML

    Im working on this project at work that requires me to learn PERL (which I havent touched in years) and I need some advice on implementation. I have this Excel document that I need to retrieve data, assign that data to an array, and email the data required recipients.

    Thats the short of it, here's an example of what the Excel document looks like :

    Server A John Doe Jane Doe
    Server B John Does Jane Doesnt
    Server A John Doe Jane Dobe
    Server D Doe John Jane Whitman

    And I want to be able to have the script read the file and extract rows that match whatever criterium I give it. So that whoever is the contact for Server A gets an email letting them know that Im about to do something to the server.

    Am I making sense here? Im a little fatigued and I fear youre all reading this and scratching your noggins....

  2. #2
    Mentor Stuart's Avatar
    Join Date
    May 2002
    Location
    nb.ca
    Posts
    1,087

    Re:Perl and XML

    Hi coltrane.
    I suggest you brush up on your perl, and then take a look at the CPAN, search for excel modules, and a module for whatever you use to send email.

    Install them using perl -MCPAN -e'install XML::Excel'
    (XML::Excel is the module you want)

    This sounds like a very interesting project. When I get home, I'm going to play around with the idea of opening up Excel files with perl.

    Let us know how this goes.

  3. #3

    Re:Perl and XML

    Stuart is on the right track. I would do the same thing and include Mail::Mailer for the mailing. Maybe get the data into a hash is possible with the server being the key so you can easily get all the names with just the servername.

  4. #4

    Re:Perl and XML

    I did a project using perl and excel a few years back at work as well. I used http://search.cpan.org/~kwitknr/Spre.../ParseExcel.pm that module to read data from excel sheets...worked like a charm. As for mailing, I'm afraid I can't help you save to say that perl can definitely do it

  5. #5

    Re:Perl and XML

    Something like this would probably work for sending the mail:

    Code:
    use Mail::Mailer;
    
    # %myheaders - hash of headers with to, from, etc...
    # $body - body string
    
    $mailobj = new Mail::Mailer 'smtp', 
                                 Server => 'localhost';
    $mailobj->open(\%myheaders);
    print $mailobj $body;
    
    $mailobj->close;

  6. #6
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Re:Perl and XML

    The mail is the easy part, I just wasnt sure if I could refer to a XML or XLS document as a flat file database.

Similar Threads

  1. PHP & Perl??
    By SwampDonkey in forum Linux - Software, Applications & Programming
    Replies: 8
    Last Post: 07-25-2004, 04:12 PM
  2. CGI, SSI, Perl
    By vwgtiturbo in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 10-29-2003, 06:05 PM
  3. Perl Help
    By pwrhouse in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 04-06-2003, 11:57 PM
  4. Need Perl help please.
    By pwrhouse in forum Linux - Software, Applications & Programming
    Replies: 7
    Last Post: 01-20-2003, 01:49 PM
  5. perl question from a perl newb
    By tolstoy in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 09-06-2002, 01:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •