Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Router Backup.pl failing (operator error no doubt)

by kcott (Chancellor)
on Feb 15, 2013 at 04:14 UTC ( #1018837=note: print w/replies, xml ) Need Help??


in reply to Router Backup.pl failing (operator error no doubt)

G'day rmagin,

Welcome to the monastery.

The message indicating a potential "runaway multi-line" is due to the chop() statement:

$ perl -ce 'chop ($status=\Q$snmpset $oid s $rtr.cfg\Q);' Substitution pattern not terminated at -e line 1.

\Q escape sequences are terminated with \E (not another \Q) and are applied to strings (i.e. they're not standalone operators):

$ perl -ce 'chop ($status="\Q$snmpset $oid s $rtr.cfg\E");' -e syntax OK

Take a look at quotemeta for a more complete description.

toolic may well be correct in suggesting you want `...` instead of \Q...\Q; however, you may also want to escape the ASCII non-"word" characters in the return value - something like this (untested) might do what you want:

$ perl -ce 'chop ($status = quotemeta(`$snmpset $oid s $rtr.cfg`));' -e syntax OK

-- Ken

Replies are listed 'Best First'.
Re^2: Router Backup.pl failing (operator error no doubt)
by Anonymous Monk on Feb 15, 2013 at 14:20 UTC

    Thank you Ken! that looks like it worked. Now just getting cp: cannot stat `/home/cisco/bkup/storage/LATEST/*': No such file or directory Can't open /home/cisco/bkup/RTR_LIST file at backup.pl line 29.

    This is no doubt because I have no file for it to run across so I can bang away at this...your explanation on the /Q and /E was right on the money and I tried your alt format and it runs clean on checks...thanks again for looking at it.

    After consideration I still think this is wrong way for me to go. I have stuff that won't download from snmp or mibs so I am going to search for a good perl/expect combo that I can use to telnet in get the prompts and send the downloads to a tftp server that i kick on and off

    Thank you both for the assist

    Rich

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018837]
help
Chatterbox?
[Corion]: marioroy: So you live dangerously ...
[Lady_Aleena]: s/latter/ladder/; # ? marioroy
[karlgoethebier]: marioroy: Praise the Lord
[marioroy]: Well, that's why there must be angels around, invisible or not.
[marioroy]: Lady_Aleena yes, ladder.
[marioroy]: Corion, no not intentionally. not at all.
[Lady_Aleena]: /ne tries to decide whther or not to take a hammer to hubby's alarm clock.
[Lady_Aleena]: He never hears it.
[marioroy]: Back in HighSchool, I came late to Gym class. There was a fellow who was picked last, no team wanted him for racketball. So it was us two against everybody. I looked at him in the eye and said to let your body loose and let the powers to be help us win.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2017-05-29 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?