Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Rather than describing a solution that you can't find, how about describing the problem you are trying to solve. Not the little piece you are having trouble with, but the whole thing.
Well, OK. Since I might run into problems at the far end of it as well, I guess it makes sense to do that. I'm trying to grab a list of all apps registered in the GNOME applications list and convert it to a menu format used by several other window managers. The first format, or at least the parts of it that mean anything, you've already seen (and used in your script); the second one looks like this:
menu Applications folder { menu Editors folder { prog vim vim vim prog Lyx emacs lyx } menu "Mail Agents" folder { prog Mutt mutt xterm -e mutt } menu "WWW Browsers" folder { prog Mozilla mozilla mozilla prog Firefox /usr/share/pixmaps/firefox.png firefox prog Seamonkey /usr/share/pixmaps/firefox.png seamonkey prog w3m lynx xterm -e w3m prog Links lynx xterm -e links } menu Graphics folder { prog Gimp gimp gimp } menu Development folder { prog ddd ddd ddd } prog "Acrobat Reader" pdf acroread prog "DVI Previewer" xdvi xdvi } menu Games folder { prog "Koules for X" koules xkoules -f prog Xboing xboing xboing prog Xboard xboard xboard prog XGalaga xgalaga xgal prog XDemineur xdemineur xdemineur prog ppracer /usr/share/pixmaps/ppracer.xpm /usr/games/ppracer prog Arena arena openarena } ...
Please note that folders (e.g., Applications) can contain other folders (e.g., Editors). Any folder can also contain program entries, which are structured as
prog "Program name" icon.ext executable_name
where the program name must be quoted if it contains whitespace, the icon name must be either a filename or a dash (i.e., no icon), and the executable name can be a PATHed program, an absolute path to a program, or a shell construct to be executed. The menu can contain a few other things, but I'm not concerned with any of those at the moment. The overall problem I'm having is creating the folder/program structure that I want reflected in the menus. That's a chain of categories that terminates in one or more programs belonging in that category - i.e.
menu "Games" folder { menu "GNOME" folder { menu "Action" folder { prog "Arena" arena.png openarena prog "ppracer" /usr/share/pixmaps/ppracer.xpm /usr/game +s/ppracer } } menu "KDE" { ...
If you can help with the overall problem, I'd appreciate it.

In reply to Re^2: Building an arbitrary-depth, multi-level hash by Anonymous Monk
in thread Building an arbitrary-depth, multi-level hash by Anonymous Monk

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 perusing the Monastery: (6)
As of 2024-04-19 05:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found