Perl script to figure out change in service schema

As we have already shipped OpenSSO Enterprise 8.0; and we are working on the next official release, service schema XML files are likely to change (upgrade). Here is the PERL script that finds them.

Remember to set the values of $EIGHT_DOT_ZERO and $CURRENT

#!/usr/bin/perl -w

use strict;

my $EIGHT_DOT_ZERO = '/home/dennis/workspace/opensso8.0';
my $CURRENT = '/home/dennis/workspace/opensso1';

my %eightdotXMLs;
my %currentXMLs;


foreach (keys %currentXMLs) {
    my $name = $_;
    my $rev = $currentXMLs{$_};
    if (! defined $eightdotXMLs{$name}) {
        print "$name ($rev) \n";

sub getServiceXMLs {
    my $base = shift;
    my $hash = shift;
    opendir(DIR, $base);
    foreach (readdir DIR) {
        my $f = $_;
        if (($f !~ /^\./) && ($f =~ /\.xml$/)) {
            getRev("$base/$f", $hash);
    closedir DIR;

sub getRev {
    my $file = shift;
    my $hash = shift;
    my $f = $file;
    $f =~ s/.+\///;
    my $buff = '';
    open(FILE, $file);
    while () {
        $buff .= $_;
    close FILE;
    if ($buff =~ /<Schema .+?revisionNumber="(.+?)"/) {
        ${%{$hash}}{$f} = $1;       
    } else {
        ${%{$hash}}{$f} = 0;

2 Responses

  1. I just did a cursory look at the code.

    I think your blog server created a defect to your script, by removing what it probably thought was an HTML tag.

    The loop in the while loop in getRev subroutine be:

    while (<FILE>) {

  2. Oops, you are right. is “eaten up”. Thanks Paul

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: