[9064] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2682 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 22 08:13:50 1998

Date: Fri, 22 May 98 05:01:14 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 22 May 1998     Volume: 8 Number: 2682

Today's topics:
        Announce: Emacs Lisp code to answer FAQ questions (Jari Aalto+mail.perl)
    Re: Clearly define "free software" (Stefaan A Eeckels)
    Re: constants in perl? (M.J.T. Guy)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 22 May 1998 13:51:04 +0300
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Announce: Emacs Lisp code to answer FAQ questions
Message-Id: <tbvhqypoiv.fsf@blue.sea.net>

--Multipart_Fri_May_22_13:51:01_1998-1
Content-Type: text/plain; charset=US-ASCII


    Seeing several anwers "Did you look into FAQ", I though that 
    I'd try some Emacs lisp to do the lookup from pod files.

    Ilya, you can add and modify this to your needs in your 
    cperl-mode.el if you see it of any help.

    Comments welcomed. I spent 5 minutes in doing this.

    jari


--Multipart_Fri_May_22_13:51:01_1998-1
Content-Type: text/plain; charset=US-ASCII


    >>>> Code's output when given search string "hostname" <<<<

perltoc.pod
         Sys::Hostname - Try every conceivable way to get hostname
perlfaq9.pod
         How do I find out my hostname/domainname/IP address?




=head2 How do I find out my hostname/domainname/IP address?

A lot of code has historically cavalierly called the C<`hostname`>
program.  While sometimes expedient, this isn't very portable.  It's
one of those tradeoffs of convenience versus portability.

The Sys::Hostname module (part of the standard perl distribution) will
give you the hostname after which you can find out the IP address
(assuming you have working DNS) with a gethostbyname() call.

    use Socket;
    use Sys::Hostname;
    my $host = hostname();
    my $addr = inet_ntoa(scalar(gethostbyname($name)) || 'localhost');

Probably the simplest way to learn your DNS domain name is to grok
it out of /etc/resolv.conf, at least under Unix.  Of course, this
assumes several things about your resolv.conf configuration, including
that it exists.

(We still need a good DNS domain name-learning method for non-Unix
systems.)

=head2 Sys::Hostname - Try every conceivable way to get hostname

=item SYNOPSIS

=item DESCRIPTION

=item AUTHOR




--Multipart_Fri_May_22_13:51:01_1998-1
Content-Type: text/plain; charset=US-ASCII


;;; ----------------------------------------------------------------------
;;;
(defun my-perl-pod-grep (regexp)
  "Grep perl pod files for string."
  (interactive "sRegexp: ")
  (let* ((path
          (or (get 'my-perl-faq-grep 'pod)

              ;;  Find out the Perl library path. The POD files are
              ;;  under subdir "pod"

              (let ((path
                     (exec-to-string
                      "perl5 -MConfig -e 'print $Config{privlib}'")))
                (put 'my-perl-faq-grep 'pod (concat path "/pod/"))
                path
                )))

         buffer
         faq head process
         beg end
         )

    ;;  Grep all strings in pod files

    (grep (format "%s '%s' %s/*pod" "egrep" regexp path))

    ;;  Grep is asyncronousd, lset is start(need sleep), and then
    ;;  wait until process finishes. Only after that we gather hits.

    (sleep-for 1)
    (while (and (setq process (get-buffer-process "*grep*"))
                (memq (process-status process) '(run))
                (prog1 t (sit-for 0.5))
                ))

    ;;  See if we got any faq Subject hits?
    ;;  --> put them into list faq: '((faq-name  . head-text) ..)

    (with-current-buffer "*grep*"
      (goto-char (point-min))
      (while (re-search-forward "/\\([^/]+\\):=head[0-9]?\\(.*\\)" nil t)
        (push (cons (match-string 1) (match-string 2)) faq)))


    ;; Excerpt every faq hit

    (when faq
      (pop-to-buffer (setq buffer (get-buffer-create "*tmp*")))
      (erase-buffer)

      ;;  First, print all found headings from eachg faq. Kinda TOC

      (dolist (elt faq)
        (insert (format "%s\n\t%s\n" (car elt) (cdr elt))))

      ;;  Then go and search the Headings and print them

      (dolist (elt faq)
        (setq file (concat path (car elt))
              head (cdr elt))

        (with-current-buffer (find-file-noselect file)
          (goto-char (point-min))

          ;;  The heading is delimited by
          ;;  =head HEADING
          ;;   ...
          ;;  =head ANOTHER-HEADING

          (when (re-search-forward (regexp-quote head) nil t)
            (beginning-of-line)
            (setq beg (point))

            (forward-line 1)
            (if (re-search-forward "=head" nil t)
                (beginning-of-line)
              (goto-char (point-max)))
            (setq end (point))

            (append-to-buffer buffer beg end)
            ))
        (insert "\n\n")
        )
      (goto-char (point-min))
      )
    ))


--Multipart_Fri_May_22_13:51:01_1998-1--


------------------------------

Date: 22 May 1998 08:34:33 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A Eeckels)
Subject: Re: Clearly define "free software"
Message-Id: <6k3dap$6k3$1@justus.ecc.lu>

In article <w6791.294$C06.1409075@news.san.rr.com>,
	cls@seawood.org (Christopher Seawood) writes:
> GPL prohibits distribution of joint GPL and non GPL-compatible work.
> And since this joint work is derived from the GPL'd work, it is covered
> by the GPL.  An example of this is xmcd+motif under linux.  I am free
> to use, copy, modify and redistribute modifications of xmcd source
> according to the GPL.  However, the moment I link it with motif under
> linux, I am violating the GPL. Same thing goes for KDE & Qt (unless
> you're running SuSE).
Nothing you do for your own use violates the GPL. Only when
you want to distribute the result you might be violating the
GPL.

I write a program that uses Motif, and place it under the GPL.
You can use my code, modify it, and redistribute the result
provided you also place your mods under the GPL. This is what
I intended (after all, I wrote it and licensed it). You cannot
change the license for my code because you don't own the copyright.
If you feel that the combined program has commercial value, and
you want to benefit from that without giving your customer a copy
of my source code *and* your source code, you've two options:
1. You contact me and license my program under a commercial
   license
2. You re-write my program so you are the copyright holder.
   If you're honest you don't copy my source verbatim.
That's the scope of the GPL. The fact that my program uses
Motif is besides the question. The FSF doesn't own my
program, and cannot dictate that in order to use the GPL
I cannot use Motif as my widget set. *I* release *my*
program using the license *I* choose. The GPL doesn't
restrict *my* freedom, it makes it impossible for you to
obtain my code and use it in a way I didn't intend it to
be used. Surely that's not difficult to understand, is it? 

The fact that Motif is not available on all machines, or is
itself a commercial toolkit has *no* impact on the
GPL'd nature of my program. If that were the case, the only
systems on which GPL'd code could be run would be the
non-commercial OS such as *BSD and Linux. 

What you do to make my program run on your machine has got
*nothing* to do with the GPL, because I have no rights to
anything on your machine bar my lousy program. 

The GPL says:
"Activities other than copying, distribution and modification
 are not covered by this license; they are outside its scope. 
 The act of running the Program is not restricted, and the 
 output from the Program is covered only if it contents constitute
 a work based on the Program (independent of having been made
 by running the Program). Whether that is true depends on what
 de Program does."

Your suggesting that linking the program in order to make it
run infringes the GPL is thus plain wrong. 

IANAL, but my uncle is ;-)

-- 
Stefaan
-- 

PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
   Williams and Holland's Law:  If enough data is collected,
          anything may be proven by statistical methods.


------------------------------

Date: 22 May 1998 11:46:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: constants in perl?
Message-Id: <6k3oil$k54$1@lyra.csx.cam.ac.uk>

Mike Stok <mike@stok.co.uk> wrote:
>In recent versions of perl there's a pragmatic module called constant
>
>A quck way to tell if it's installed is:
>
>  perl -mbanana -e 1
>
>which shouldn't complain if it can find the constant module.  

Eh?    I presume you mean

   perl -mconstant -e 1


Mike Guy


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 2682
**************************************

home help back first fref pref prev next nref lref last post