Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I am attempting to call a function from within a perl script that will contact a monitoring program. I am getting compilation errors on this line of code.

 $testmessage = system(/usr/bin/postemsg -S tecserver -r(harmless) -m "(This is a test message)" hostname=(Trapeze) notify_action=email alias_notify=(pbkhk) (Event_Message_Class) (SOURCE));

I am getting the following as output:

Bareword found where operator expected at TDC-fabric-monitor.pl line +172, near "/usr/bin" (Missing operator before bin?) Unquoted string "tecserver" may clash with future reserved word at TDC +-fabric-monitor.pl line 172. Unquoted string "harmless" may clash with future reserved word at TDC- +fabric-monitor.pl line 172. Bareword found where operator expected at TDC-fabric-monitor.pl line 1 +72, near "m "(This is a test message at the end of the script)" hostn +ame" (Do you need to predeclare m?) Bareword found where operator expected at TDC-fabric-monitor.pl line 1 +72, near ") notify_action" (Missing operator before notify_action?) syntax error at TDC-fabric-monitor.pl line 172, near "/usr/bin" Execution of TDC-fabric-monitor.pl aborted due to compilation errors

Is there any way to format the system call so that Perl just passes that call to the outside shell? Should I be using something other than system() to call the postemsg command?

Thanks,

-Bill

In reply to Launching an external command from Perl in Linux by wruehl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-19 02:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found