hakim-djz has asked for the wisdom of the Perl Monks concerning the following question:

Hi ALL

I am working with ADS design suite, and I found out it has some perl modules in it that help convert citi files to the data set format .ds that the suite uses. I am trying to use the module but not really getting anywhere as well the syntax is confusing me, if anyone can help explain it for me?

use strict; use warnings; use dKitCircuit; use dKitResults; my $dir = "build-2"; opendir DIR, $dir or die "cannot open dir $dir: $!"; my @file= readdir DIR; closedir DIR; dKitResults->convertCitifile2Dataset('pathToFile'[,'setName']); #the moduleit specifies to use this, but couldn't get it to work, #so tried the below statement #dKitResults->convertCitifile2Dataset('build-2/\$file[1]','x'); #this allows it to compile, but doesn't work either foreach(@file){ print $_,"\n"; #dKitResults->convertCitifile2Dataset($dir."/".$_,"X"); } #output# syntax error at C:\Users\QUB\Desktop\hakim\scripts\convert.pl line 12, + near "'build-2/\$file[1]'[" Execution of C:\Users\QUB\Desktop\hakim\scripts\convert.pl aborted due + to co mpilation errors. Press any key to continue . . .

As well in the .pm it has ($;$) for the subfunction

sub convertCitifile2Dataset($;$) #UPDATE# dKitResults->convertCitifile2Dataset('build-2/wafer_807_T1_ME_build2_d +cbk.cti','choclate'); #WORKS

Also needed to copy certain bin files and .dll files from the ADS bin directory to StrawberryPerl as it required to connect to some server the suite uses. May have been different on Linux?? My First Time using Strawberry

Thanks for comments & help

If it helps any in the future, I searched using the Windows in the start menu for gsl37.dll as it was also looking for this. Right clicked it and opened the file containing and copied everything in it to the C:\Strawberry\bin directory

Replies are listed 'Best First'.
Re: What does this mean?
by GotToBTru (Prior) on Jul 08, 2014 at 15:20 UTC

    It is objecting to

    dKitResults->convertCitifile2Dataset('pathToFile'[,'setName']);

    That looks like you misunderstood the documentation. Instead of 'pathToFile' you should have the actual file path there. The notation [,'setName'] indicates that setName is an optional parameter. I am thinking you need to put the dataset name there.

    1 Peter 4:10

      Hi Peter! No I know that, was just putting that there to illustrate. Here's the documentation I am trying to follow: http://hermes.eee.nott.ac.uk/teaching/ads/doc/dkver/dkver049.html#1123011

      As well it tries to connect to a server which works of bins in the ADS suite directroy. I've just copied them to the Strawberry Perls and it WORKS. But not using the syntax with square brackets. e.g:

      use strict; use warnings; use dKitCircuit; use dKitResults; my $dir = "build-2"; opendir DIR, $dir or die "cannot open dir $dir: $!"; my @file= readdir DIR; closedir DIR; #dKitResults->convertCitifile2Dataset('build-2/wafer_807_T1_ME_build2_ +dcbk.cti'[,'choclate']); #it specifies to use this, but couldn't get +it to work, so tried the below statement dKitResults->convertCitifile2Dataset('build-2/wafer_807_T1_ME_build2_d +cbk.cti','choclate'); #WORKS
Re: What does this mean?
by perlfan (Parson) on Jul 08, 2014 at 14:28 UTC
    That last bit is a subroutine prototype in Perl. See perlsub for more information. It's generally not used very widely nor accepted as a best practice, but it can give you some clues on what the subroutine might be expecting.

    In this case, I believe ($;$) is the prototype for 2 scalar values.

      In addition, as  convertCitifile2Dataset() is invoked as a class method, its prototype is completely ignored.

      c:\@Work\Perl>perl -wMstrict -le "package Foo; sub foo ($;$) { print qq{(@_)}; } ;; package main; Foo->foo; Foo->foo(); Foo->foo(1, 2, 3, 4, 5, 6); " (Foo) (Foo) (Foo 1 2 3 4 5 6)
Re: What does this mean?
by AnomalousMonk (Archbishop) on Jul 08, 2014 at 15:24 UTC
    #so tried the below statement #dKitResults->convertCitifile2Dataset('build-2/\$file[1]','x'); #this allows it to compile, but doesn't work either

    Without knowing what "doesn't work" means and without any experience of the modules in question, the expression  'build-2/\$file[1]' is certainly suspicious. This is, of course, a non-interpolating string. Do you really intend there to be a literal backslash followed by literal  '$file[1]' in the final string?

    c:\@Work\Perl>perl -wMstrict -le "my @file = ('foo', 'bar', 'baz'); my $s = 'build-2/\$file[1]'; print qq{'$s'}; " 'build-2/\$file[1]'