Re: [ILUG] OpenOffice.org Location

From: Mark Finlay (sisob at domain eircom.net)
Date: Sat 08 Jun 2002 - 23:37:53 IST


On Thu, 2002-06-06 at 23:59, Mark Finlay wrote:
> On Fri, 2002-06-07 at 22:31, Dave O Connor wrote:
> > Mark Finlay said on Thu, Jun 06, 2002 at 09:39:20PM +0100:
> > > open(SVERSION, $ENV{'HOME'} . "/.sversionrc") or die "Cannot open
> > > ~/.sversionrc";
> > >
> > > open(SVERSION, $location . "/instdb.ins") or die "Cannot open
> > > instdb.ins";
> > >
> > > but when I run it I get
> > >
> > > Cannot open instdb.ins at findlocation.pl line 19.
> > >
> > > I need to suck a variable out of $location/instdb.ins
> > > but on account of not knowing perl I seem to have bothched
> > > up the open() function
> >
> > Make sure $location/instdb.ins exists, and you can read it.
> >
> > Also try changing the arguemnt to die to something like:
> >
> > die "Cannot OPen $location/instdb.ins: $!";
> >
> > $! returns the last OS error in text form, so that'll be a little more
> > helpful.
>
>
> I think that the problem is that there is a crazy line return at the end
> of $location. It looks like an underlined M in joe and a box in gedit.
>
> it causes $location/instdb.ins to turn into
> /instdb.ins/OpenOffice.org1.0 or just /inistdb.ins in either bash or
> perl. Any idea how to strip this character. It should work then.

fixed it with:

#!/usr/bin/perl

my ($line,$location,$location2) = undef;

open(SVERSION, $ENV{'HOME'} . "/.sversionrc") or die "Cannot open
~/.sversionrc";

while ($line = <SVERSION>)
{
    if ($line =~ /^OpenOffice.+?file:\/\/(.+?)$/)
    {
        $location = $1;
    }
}

close (SVERSION);

$x = length ("$location"); #find length of location string
$y = $x - 1; # create variable one less than that length
$z = substr ("$location", 0, $y); # make new variable one character
smaller
print $z . "\/inistdb.ins\n";

>
>
> >
> > - DoC
> >
> > --
> > Irish Linux Users' Group: ilug at domain linux.ie
> > http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> > List maintainer: listmaster at domain linux.ie
> >
> --
> Mark Finlay
> "sisob's linux eXPerience"
> http://sisob.dyndns.org
> Registered Linux User: #243436
>
>
> --
> Irish Linux Users' Group: ilug at domain linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at domain linux.ie
>

-- 
Mark Finlay
"sisob's linux eXPerience"
http://sisob.dyndns.org
Registered Linux User: #243436


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:10 GMT