Hi,

Les Stott wrote on 19.01.2007 at 11:27:56 [Re: [BackupPC-users] Syntax error?]:
> [...]
> hmmm.....it all looks right.

that I agree with, but ...

> i assume its just word wrapped and the line above starting with sudo 
> belongs at the end of line 2? If it sees the sudo line as a separate 
> line then thats where the problem is.

Nope, it's within single quotes, and they're allowed to contain multiple
lines (in fact, that holds for all forms of quoting in Perl). In fact, you
can insert line breaks anywhere whitespace is allowed, because a newline
counts as whitespace.

    $Conf
      {XferMethod}         # you can even comment individual lines
        =
          'smb'
            ;

looks ugly, but is perfectly valid. Perhaps you were thinking of TCL, where
the matter of line breaks (and especially comments) is a real pain?
That 'ssh' or 'nice' might choke on the embedded \n in the string is a
different matter.

> check the file for proper carriage returns (in vi do a :set list) and 
> make sure it doesn't have control M's (dos2unix).

Perl supports \r\n line breaks, which is (outside of strings ;-) really only
another instance of the above rule: blanks, newlines, returns, even form feeds
- it's all just whitespace.

Oh, ':set list' is something to remember. Thank you for that.

> one other thing....change the order of lines when troubleshooting. move 
> them around and watch the errors and see if they change line numbers. 
> Often an error is in an earlier line but syntax checks only hit the 
> later lines.

In my experience, Perl is surprisingly accurate. Of course, some errors are
only detectable later on. If you leave out the last single (or double) quote
in a program, the error will be detected at the end of the file (Perl is
quite helpful even in this case though). A missing semicolon will show up as
an error in the following line (or wherever the next statement begins). With
the code in question, I'm almost certain that a
'syntax error ... in line 4, near "$Conf"' (with "$Conf" being the first
five characters of line 4) means that there's some invisible
garbage behind the semicolon in line 3. In fact, the lines from the posting
give a "syntax OK" on my system, so whatever it is doesn't seem to have
survived cut&paste to the mail client.

Moving lines around is a good idea, but, frankly, in a script with four (4!)
statements, I'd say "delete line 3 (the whole line, including the line break)
and type it in again", and "test with
'perl -wc /var/lib/backuppc/pc/charles/config.pl', not by trying to run a
backup ;-)". Perhaps even test without line 3 (before re-inserting it),
presuming it's a statement of its own and not only part of one.

Regards,
Holger

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
BackupPC-users mailing list
BackupPC-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Reply via email to