Hi

I'm working with a program that uses GetOptions to process command line options. The code that does this is as follows:

if (!GetOptions( 'user=s' => \$user, 'group=s' => \$group, 'cliaddr=s' => \$cliaddr, 'cliport=s' => \$cliport, 'daemon' => \$daemon, 'diag' => \$diag, 'httpaddr=s' => \$httpaddr, 'httpport=s' => \$httpport, 'logfile=s' => \$logfile, 'audiodir=s' => \$audiodir, 'playlistdir=s' => \$playlistdir, 'cachedir=s' => \$cachedir, 'pidfile=s' => \$pidfile, 'playeraddr=s' => \$localClientNetAddr, 'priority=i' => \$priority, 'stdio' => \$stdio, 'streamaddr=s' => \$localStreamAddr, 'prefsfile=s' => \$prefsfile, 'quiet' => \$quiet, 'nosetup' => \$nosetup, 'noserver' => \$noserver, 'd_artwork' => \$d_artwork, 'd_cli' => \$d_cli, 'd_command' => \$d_command, 'd_control' => \$d_control, 'd_display' => \$d_display, 'd_factorytest' => \$d_factorytest, 'd_files' => \$d_files, 'd_firmware' => \$d_firmware, 'd_formats' => \$d_formats, 'd_graphics' => \$d_graphics, 'd_http' => \$d_http, 'd_http_verbose' => \$d_http_verbose, 'd_info' => \$d_info, 'd_ir' => \$d_ir, 'd_irtm' => \$d_irtm, 'd_itunes' => \$d_itunes, 'd_itunes_verbose' => \$d_itunes_verbose, 'd_mdns' => \$d_mdns, 'd_moodlogic' => \$d_moodlogic, 'd_musicmagic' => \$d_musicmagic, 'd_mp3' => \$d_mp3, 'd_os' => \$d_os, 'd_paths' => \$d_paths, 'd_perf' => \$d_perf, 'd_parse' => \$d_parse, 'd_playlist' => \$d_playlist, 'd_plugins' => \$d_plugins, 'd_protocol' => \$d_protocol, 'd_prefs' => \$d_prefs, 'd_remotestream' => \$d_remotestream, 'd_scan' => \$d_scan, 'd_scheduler' => \$d_scheduler, 'd_select' => \$d_select, 'd_server' => \$d_server, 'd_slimproto' => \$d_slimproto, 'd_slimproto_v' => \$d_slimproto_v, 'd_source' => \$d_source, 'd_source_v' => \$d_source_v, 'd_sql' => \$d_sql, 'd_stdio' => \$d_stdio, 'd_stream' => \$d_stream, 'd_stream_v' => \$d_stream_v, 'd_sync' => \$d_sync, 'd_sync_v' => \$d_sync_v, 'd_time' => \$d_time, 'd_ui' => \$d_ui, 'd_usage' => \$d_usage, 'd_filehandle' => \$d_filehandle, )) { showUsage(); exit(1); };
The argument I'm interested in / having problems with is --logfile. I'd like to pipe log output to an external program (multilog) and am specifying the logfile parameter as follows:

SLIMSERVER_LOG="|/usr/local/bin/multilog t s1000000 n20 /var/log/slims +erver" SLIMSERVER_ARGS="--daemon --prefsfile=$SLIMSERVER_CFG --logfile=$SLIMS +ERVER_LOG"
The program then gets called with $SLIMSERVER_ARGS on the command line, i.e. slimserver $SLIMSERVER_ARGS

This works in that output does indeed get written to the multilog program and logged in the correct directory. However, the only output I get is a usage message which I think is caused by GetOptions thinking that the tokens in the logfile name are options to the slimserver program.

Is there some way round this?

Thanks,

R.

--

Robin Bowes | http://robinbowes.com

Edit by castaway, moved node-text out of sig


In reply to Problem with GetOptions by robinbowes

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.