[18627] in Perl-Users-Digest
Perl-Users Digest, Issue: 795 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 29 14:10:39 2001
Date: Sun, 29 Apr 2001 11:10:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <988567811-v10-i795@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 29 Apr 2001 Volume: 10 Number: 795
Today's topics:
Point of using perlcc <bop@mypad.com>
Re: Point of using perlcc <newspost@coppit.org>
Re: Point of using perlcc <bop@mypad.com>
Re: PPM on unix? <lamecow78@hotmail.com>
pretty-printing perl? <nospam@yale.edu>
Re: pretty-printing perl? (Jay Tilton)
Re: Redirecting STDERR more than once in a program. nobull@mail.com
Re: Separate syslog file? (Pat Traynor)
Re: Separate syslog file? <js@saltmine.radix.net>
Re: Should Perl be first? <gellyfish@gellyfish.com>
Re: Should Perl be first? (Eric Bohlman)
Re: Should Perl be first? <bchambless@nrlssc.navy.mil>
Re: Should Perl be first? <bchambless@nrlssc.navy.mil>
Re: Should Perl be first? (Tad McClellan)
Re: Should Perl be first? <newspost@coppit.org>
Re: Simple newbie performance question (Charles M. Kozierok)
Re: Strange string -> num conversion <todd@designsouth.net>
Re: use strict.. bugger! <gellyfish@gellyfish.com>
Re: XML::RSS and mod_perl <matt@sergeant.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 29 Apr 2001 17:22:03 GMT
From: "flash" <bop@mypad.com>
Subject: Point of using perlcc
Message-Id: <%4YG6.663537$f36.18847453@news20.bellglobal.com>
I was just wondering the point of using perlcc?
I know it compiles the program (no one can steal the source)
But it makes the file like 680 times larger!
Does anyone use perlcc here?
For what purpose?
------------------------------
Date: Sun, 29 Apr 2001 13:38:33 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: Point of using perlcc
Message-Id: <Pine.SUN.4.33.0104291336320.26627-100000@mamba.cs.Virginia.EDU>
On Sun, 29 Apr 2001, flash wrote:
> But it makes the file like 680 times larger!
You do realize that the Perl Interpreter is fairly large, right? You
need to count it's size in your computation. If you compile your code,
you don't need the interpreter. Also, you can compile-in any modules
you use, which makes the entire package easily distributable.
--
David
------------------------------
Date: Sun, 29 Apr 2001 18:04:33 GMT
From: "flash" <bop@mypad.com>
Subject: Re: Point of using perlcc
Message-Id: <RIYG6.663629$f36.18850654@news20.bellglobal.com>
But doesn't the compiled program only work on the os it was compiled on?
So therefor if perl was standard couldn't you assume that it would be there.
I agree that it is good for usin when you have 5+ modules
(i use 6 seperat ones in a script(using require statment))
"David Coppit" <newspost@coppit.org> wrote in message
news:Pine.SUN.4.33.0104291336320.26627-100000@mamba.cs.Virginia.EDU...
> On Sun, 29 Apr 2001, flash wrote:
>
> > But it makes the file like 680 times larger!
>
> You do realize that the Perl Interpreter is fairly large, right? You
> need to count it's size in your computation. If you compile your code,
> you don't need the interpreter. Also, you can compile-in any modules
> you use, which makes the entire package easily distributable.
>
> --
> David
>
------------------------------
Date: Sun, 29 Apr 2001 16:48:36 GMT
From: "Brian Richardson" <lamecow78@hotmail.com>
Subject: Re: PPM on unix?
Message-Id: <EBXG6.66625$Zn4.718008@news1.rdc1.ab.home.com>
<u518615722@spawnkill.ip-mobilphone.net> wrote in message
news:l.988313637.1283294677@[198.138.198.252]...
> On windows NT, we have a PPM to
> manager the module, do you have
> similar utility on unix?
slightly more verbose than previous followup:
"perl -MCPAN -e shell" will give you a command-line interface not entirely
unlike the PPM package manager shell.
Brian
------------------------------
Date: Sun, 29 Apr 2001 17:10:10 GMT
From: "ivo welch" <nospam@yale.edu>
Subject: pretty-printing perl?
Message-Id: <9chhti$nu3$1@news.ycc.yale.edu>
Is there a pretty-printer for perl? (Preferably, one that also takes pod
into account.)
/iaw
------------------------------
Date: Sun, 29 Apr 2001 17:39:11 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: pretty-printing perl?
Message-Id: <3aec50fe.76110285@news.erols.com>
On Sun, 29 Apr 2001 17:10:10 GMT, "ivo welch" <nospam@yale.edu> wrote:
>Is there a pretty-printer for perl? (Preferably, one that also takes pod
>into account.)
That's a FAQ.
perldoc -q pretty
Short answer: no.
------------------------------
Date: 29 Apr 2001 14:09:26 +0100
From: nobull@mail.com
Subject: Re: Redirecting STDERR more than once in a program.
Message-Id: <u9snirua2h.fsf@wcl-l.bham.ac.uk>
t_wart@hotmail.com (Ted Wart) writes:
> I've a program that uses system to execute other programs. I can
> grab the output from my system calls by redirecting standard error. The
> first time redirection works as planned. Subsequent redirects fail.
open ( STDERR, '>foo.out');
system ' echo foo >&2';
open ( STDERR, '>bar.out');
system ' echo bar >&2';
Works fine for me.
> Since my script is pretty much a large...
... the problem is probably somthing else.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Sun, 29 Apr 2001 17:07:23 GMT
From: pat@ssih.com (Pat Traynor)
Subject: Re: Separate syslog file?
Message-Id: <3aed46d9.17906370@news.giganews.com>
On 28 Apr 2001 17:45:01 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:
>According to Pat Traynor <pat@ssih.com>:
>> On 28 Apr 2001 10:46:01 GMT, Jonathan Stowe <gellyfish@gellyfish.com>
>> wrote:
>>
>> >Pat Traynor <pat@ssih.com> wrote:
>> >> I'm successfully logging output to my syslog file like this:
>> >>
>> >> use Sys::Syslog qw(:DEFAULT setlogsock);
>> >> setlogsock('unix');
>> >> syslog('info', "Test message to syslog filel\n");
>> >>
>> >> I understand how to send different levels of priority messages to
>> >> different log files via syslog.conf, but is there a way to have a
>> >> program log output to a custom log level? e.g.:
>> >>
>> >> syslog('mytest', "Test message to syslog filel\n");
>> >
>> >Surely that is an issue of the capability of your syslog daemon ?
>>
>> Yes, I'm sure my syslog daemon will be a part of the process, but I
>> need to know how to do the programming in perl.
>
>Form the Sys::Syslog documentation:
>
> Sys::Syslog is an interface to the UNIX `syslog(3)'
> program. Call `syslog()' with a string priority and a
> list of `printf()' args just like `syslog(3)'.
>
>Where is the Perl specific problem? Everything is in the syslog
>man pages.
Yes, I've read the man pages, and yes, I'm sure that everything is in
the syslog man pages, but I'm still having problems. That's why I'm
here asking for help.
I'll try to make my problem more clear.
I have a Perl script (let's call it 'mytest.pl'), and I want to use
syslogd to log messages into its own log file (let's call it
'mytest.log').
The Syslog man page says:
setlogsock $sock_type;
openlog $ident, $logopt, $facility;
syslog $priority, $format, @args;
Without using "openlog", I'm able to log messages into my existing
syslog file using whatever priority level ("warning", "info", etc.)
that I'd like. This leads me to believe that it's the "openlog"
function that I need to use to specify its own log file. (Please
correct me as soon as I'm making mistakes...)
Here is what the Syslog man page says about "openlog":
openlog $ident, $logopt, $facility
$ident is prepended to every message. $logopt
contains zero or more of the words pid, ndelay, cons,
nowait. $facility specifies the part of the system
Ok, I assume that $ident is any string that I want to use to identify
the individual log messages, and anything will do, e.g. "mytest".
"$logopt contains zero or more of the words pid, ndelay, cons, nowait"
Nowhere in the man page does it talk about what effect these values
will have, and I've tried various combinations with no luck.
"$facility specifies the part of the system"
I have absolutely no idea what they mean by this. I took a wild guess
and thought that this is another custom string that I come up with
that should be used in the syslog.conf file. So I added this to my
syslog.conf file:
mytest.* /usr/adm/mytest.log
I restarted syslogd and ran my script. The output kept going to
/usr/adm/syslog.
------------------------------
Date: Sun, 29 Apr 2001 13:49:55 -0400
From: John Schmidt <js@saltmine.radix.net>
Subject: Re: Separate syslog file?
Message-Id: <Pine.SV4.3.96.1010429133759.28247F-100000@saltmine.radix.net>
On Sun, 29 Apr 2001, Pat Traynor wrote:
> "$facility specifies the part of the system"
> I have absolutely no idea what they mean by this. I took a wild guess
> and thought that this is another custom string that I come up with
> that should be used in the syslog.conf file. So I added this to my
> syslog.conf file:
>
> mytest.* /usr/adm/mytest.log
>
> I restarted syslogd and ran my script. The output kept going to
> /usr/adm/syslog.
You have a UN*X problem, not a Perl problem. There are predefined
syslog facilities which *really* *should* be listed in the syslog
man pages. The OSes I have immediate access to (2 Solaris versions,
3 Linux verisons, 2 SCO versions, and 1 FreeBSD) all list them.
For a non-standard syslog facility, you'll want to use localX
where X is a number between 0 and 7 - at least on the above OSes.
In addition to checking the man page for syslog, also check the page
for syslog.conf - some UN*Xes are quite picky about the whitespace
characters between the facility and the filename. You may also
need to create the logfile manually before it can be accessed.
JS
------------------------------
Date: 29 Apr 2001 13:44:52 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Should Perl be first?
Message-Id: <9ch5sk$4ge$3@plutonium.btinternet.com>
Milton Road <miltonroad@btinternet.com> wrote:
>
> Perl wasn't my first language.
>
I'd have been pushed to have Perl as my first language as it was yet to
be created for ten years when I started programming ...
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: 29 Apr 2001 16:12:15 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Should Perl be first?
Message-Id: <9chegv$a7i$1@bob.news.rcn.net>
Milton Road <miltonroad@btinternet.com> wrote:
> Perl isn't all a bed of roses. There is a lot of reading to do, and the
> TMTOWTDI philosophy means that picking up someone elses code can be quite
> hellish. Personally, I find myself having to exercise quite a bit of
> self-discipline within the language when writing stuff, because it is so
> easy to write quick and dirty stuff if you want.
Yes, this is an important point. Perl is, by Larry Wall's specific
intent, *not* a "bondage and discipline" language. Some people
misunderstand this and assume that Perl was therefore intended for
undisciplined programming. That's incorrect. Larry intended Perl to be a
"bring your own discipline" (BYOD) language because he understood that
the important thing isn't practicing *one* particular form of programming
discipline that happens to be the language designer's personal preference,
but rather practicing *some* form of programming discipline, and a good
programmer is the person in the best position to decide what that
discipline should be. Most good programmers will have similar programming
disciplines that differ only in matters of style (those differences being
sources of religious warfare when someone tries to impose one or the
other) but that are more-or-less identical in substance (the important
part).
IOW, Perl treats the programmer as an adult and expects the programmer to
behave like one.
------------------------------
Date: 29 Apr 2001 16:47:00 GMT
From: Billy Chambless <bchambless@nrlssc.navy.mil>
Subject: Re: Should Perl be first?
Message-Id: <9chgi4$lb7$1@news.datasync.com>
In article <11863-3AEB2495-139@storefull-248.iap.bryant.webtv.net>,
BUCK NAKED1 <dennis100@webtv.net> wrote:
>I started learning Perl a few months ago, but still have much to learn.
That's okay -- I started learning Perl a few years ago, but still
ave much to learn. :)
>Friends tell me that VB is THE language to learn.
Get new friends. Preferably smarter ones.
>language. I'm confused. Should Perl be the first programming language
>that I should learn? or would you recommend another programming
>language? C++? Java? what?
Perl is a fairly beginner-friendly language[1]. Get "Learning Perl"
and "Programming Perl", and read carefully.
[1] Computer-science professors will disagree, but you're not trying
to do computer science; yo're trying to get some work done. Learn Perl.
------------------------------
Date: 29 Apr 2001 16:52:42 GMT
From: Billy Chambless <bchambless@nrlssc.navy.mil>
Subject: Re: Should Perl be first?
Message-Id: <9chgsq$lee$1@news.datasync.com>
In article <comdog-1C86FB.17224028042001@news.panix.com>,
brian d foy <comdog@panix.com> wrote:
> if Perl is a good langauge for the task at hand - learn Perl.
s/if //;
print "HTH\n\t:)\n\n"
------------------------------
Date: Sun, 29 Apr 2001 11:47:54 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Should Perl be first?
Message-Id: <slrn9eodt9.d32.tadmc@tadmc26.august.net>
Note that just about every character I typed below is simply
one guy's opinion. (which is the whole problem with this type
of thread, a good answer cannot really be given...)
BUCK NAKED1 <dennis100@webtv.net> wrote:
>I'm wanting to learn a programming language to use mainly for web
>applications, but that could also be used for business applications
>off-line, and hopefully make me some money.
How you hope to make the money makes a difference in what _I_
would recommend.
If you hope to make money from the applications themselves, then
you can still make that money regardless of which language you
write it in. For getting the applications written with a minimum
of "language learning" overhead, Perl, VB and Python should all
be given consideration as a first language (because in this case,
it is likely _not_ a "first language". It is more likely the
"only language").
If you hope to make money as a Professional Perl Programmer, then
you should probably learn some other language before learning Perl.
Perl, as a "power programmer's" tool, is chock full of shortcuts
and it hides lower-level details. Having at least some understanding
of what the drudge is that Perl is handling for you goes a long way
toward being able to design and troubleshoot systems effectively.
>I started learning Perl a few months ago, but still have much to learn.
>Friends tell me that VB is THE language to learn. I know a little
>VBScript, but no VB... and of course VBScript is not a programming
>language.
I think if the only choice is Perl vs. VB, then Perl wins hands down,
simply because it will run in more places (most especially if the
"places of interest" happen to be web servers).
Any comparison of Perl and VB should also include Python though.
>I'm confused. Should Perl be the first programming language
>that I should learn? or would you recommend another programming
>language? C++? Java? what?
If you only need to be a "casual programmer" then go with Perl
(or Python) straight off.
If you want to become a professional programmer, then start with a
language other than Perl. I recommend learning C first.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 29 Apr 2001 13:35:06 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: Should Perl be first?
Message-Id: <Pine.SUN.4.33.0104291330170.26627-100000@mamba.cs.Virginia.EDU>
[snip Milton Road's excellent post]
Just to add another point: VB/VBA is a Microsoft gig, but that also
means you get easy access to Microsoft "features". For example, if you
want to do any automation of applications, VBA makes things really
easy. More painful is C++ (of M$'s version of it anyway). I suspect
that Perl's support is only partial, although I admit I haven't
investigated it thoroughly.
My impression of VB is that it's a much simpler language than Perl or
certainly C++, but probably not as simple as C. There are still a lot
of annoying aspects, such as scoping issues and declarations. Perl's
syntax will cause you more grief, but you'll probably find the
language much more powerful than VB.
--
my $.02
David
------------------------------
Date: Sun, 29 Apr 2001 15:04:35 GMT
From: ixlu@PCGuide.com (Charles M. Kozierok)
Subject: Re: Simple newbie performance question
Message-Id: <74WG6.793$Be3.81706@news.shore.net>
In article <3AEB7BB7.9A915030@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
} "Charles M. Kozierok" wrote:
} > The application in question will need to handle loading and searching
} > through some fairly large arrays--possibly 50,000 items. For example,
} > I might need to load a 50,000 line file into a 2D array of say 50,000x10,
} > with each set of 10 elements corresponding to 10 pieces of data in one line
} > in the file. Then I would need to do some pattern matching...
}
}
} Your approach is less than efficient. You would do better
} to spend your time creating your database specifically
} for this task, to be read one line at a time via an
} efficient while loop. Effective database management
} is critical to almost all types of programming.
Well, I should have specified that the file would be sorted, or
if I had to I would sort it first. Given that, a quick binary
search would seem to make sense. Even without that information,
however, I find the suggestion of a while loop puzzling; it seems
to me that reading the data into an associative array would be
far more efficient than an O(n) while loop... maybe I am missing
something.
} If you have read introductions to Perl, you already
} know Perl is written specifically for tasks of
} this nature. You should not need to ask if you
} have performed your homework.
...
} Consider not engaging in activities which compel
} you to apologize, in advance. This is illogical.
I was trying to be polite; I'll let the rest of this go
without comment since I appreciate your taking the time
to reply to my note.
cheers,
-*-
Charles M. Kozierok (mailto:ixl@PCGuide.com)
Webslave, The PC Guide - <http://www.PCGuide.com>
Comprehensive PC Reference, Troubleshooting, Optimization and Buyer's Guides...
------------------------------
Date: Sun, 29 Apr 2001 15:15:18 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Strange string -> num conversion
Message-Id: <aeWG6.38669$U4.9148166@news1.rdc1.tn.home.com>
Here's my research contribution (Cobalt Linux 5, Raq3):
[tbsmith@raq300 tbsmith]$ perl -le "print '0x12' + 1"
2.125
[tbsmith@raq300 tbsmith]$ perl -le 'print "0x12" + 1'
2.125
[tbsmith@raq300 tbsmith]$ perl -le "print 0x12 + 1"
19
[tbsmith@raq300 tbsmith]$ perl -v
This is perl, version 5.005_03 built for i386-linux
------------------------------
Date: 29 Apr 2001 15:04:12 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: use strict.. bugger!
Message-Id: <9chahc$4ge$5@plutonium.btinternet.com>
Rob <"relaxedrob@optushome.com.au"> wrote:
> Howdy all!
>
> Why can I do this?
>
> use strict;
> if ($a || bugger off)
> {
> print "true || bugger off = true\n";
> }
>
> OUTPUT:
> true || bugger off = true
>
> But not this?
> use strict;
> if ($a || buggeroff)
> {
> print "true || buggeroff = true\n";
> }
>
> OUTPUT:
> Bareword "buggeroff" not allowed while "strict subs" in use at or_test.pl
> line 30.
> Execution of or_test.pl aborted due to compilation errors.
>
> I am using ActivePerl for Windows..
> C:\WINDOWS>perl -v
>
> This is perl, v5.6.0 built for MSWin32-x86-multi-thread
> (with 1 registered patch, see perl -V for more detail)
>
> Copyright 1987-2000, Larry Wall
>
>
Er.
I would have expected you to get :
Can't locate object method "bugger" via package "off"
(perhaps you forgot to load "off"?)
In your first example - with or without 'use strict'.
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Sun, 29 Apr 2001 14:25:42 +0100
From: Matt Sergeant <matt@sergeant.org>
Subject: Re: XML::RSS and mod_perl
Message-Id: <3AEC1656.455BCBF2@sergeant.org>
Matt Morton-Allen wrote:
>
> Hi All,
> I am trying to use XML::RSS under mod_perl but keep getting a segfault. The
> error occurs only on the call to the parse method. Anyone experienced this?
It's caused by conflicts with the version of expat compiled into Apache.
You'll have to recompile Apache with --disable-rule=expat (or
RULE_EXPAT=no for older Apache's).
See the mod_perl guide or the AxKit FAQ for more details on this.
--
<Matt/>
/|| ** Founder and CTO ** ** http://axkit.com/ **
//|| ** AxKit.com Ltd ** ** XML Application Serving **
// || ** http://axkit.org ** ** XSLT, XPathScript, XSP **
// \\| // ** mod_perl news and resources: http://take23.org **
\\//
//\\
// \\
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.
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 V10 Issue 795
**************************************