[19541] in Perl-Users-Digest
Perl-Users Digest, Issue: 1736 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 12 09:05:33 2001
Date: Wed, 12 Sep 2001 06:05:09 -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: <1000299909-v10-i1736@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 12 Sep 2001 Volume: 10 Number: 1736
Today's topics:
Re: CPAN problems on OSX (Martien Verbruggen)
DBI prepare ... with bind_param or execute ? <barghest@wanadoo.fr>
Re: Efficiency <horst.fickenscher@sealsystems.de>
Re: Help: TiedHash.pm module in @INC not being recogniz <mel2000@hotmaildot.com>
Re: Is there any perl script formater? (Martien Verbruggen)
Re: Is there any perl script formater? <dtweed@acm.org>
Re: Laugh: BT webspace CGI conditions <bart.lateur@skynet.be>
Re: Parsing problem (Please HELP ) (Laird)
Re: PERL modules and GPL license (Mark Jason Dominus)
Re: PERL modules and GPL license (Mark Jason Dominus)
Re: PERL modules and GPL license (Martien Verbruggen)
Re: PERL modules and GPL license <weiss@kung.foo.at>
Re: perl regex to GNU C regex <sgt19@tid.es>
Perl script to count pages in a pdf file <ofuuzo@ub.uit.no>
Re: Perl script to count pages in a pdf file <kalinabears@hdc.com.au>
Re: Perl script to count pages in a pdf file <ofuuzo@ub.uit.no>
Re: Sharing memory (Martien Verbruggen)
STANLEY BLACK :: I hope you're lurking <lmoran@wtsg.com>
Re: Using the Term::ANSIColor <jimbo@soundimages.co.uk>
Re: Warning on adding hash element (so)
What about Pod::Html? <horst.fickenscher@sealsystems.de>
What is package? (Dav Lam)
Re: What is package? <davidhilseenews@yahoo.com>
Re: What is package? <davidhilseenews@yahoo.com>
Re: What is package? <davidhilseenews@yahoo.com>
Re: What is package? <simon.oliver@umist.ac.uk>
Re: What is package? (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Sep 2001 20:15:49 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: CPAN problems on OSX
Message-Id: <slrn9pudel.1ek.mgjv@martien.heliotrope.home>
On 11 Sep 2001 07:43:12 -0700,
kerin <kerin@airside.co.uk> wrote:
> cpan> install Bundle::Mysql
> zsh: no such file or directory:
> y/sources/authors/id/J/JW/JWIED/Msql-Mysql-modules-1.1835.tar.gz
^^^^^^^^^
To me this looks like you may have pressed the 'y' key once too many
when you were configuring CPAN.
Reconfigure it.
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing
Interactive Media Division | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd. | later I can ask him what he meant -
NSW, Australia | Steven Wright
------------------------------
Date: Wed, 12 Sep 2001 12:08:36 +0100
From: "Barghest" <barghest@wanadoo.fr>
Subject: DBI prepare ... with bind_param or execute ?
Message-Id: <9nnbth$a8l$1@reader1.imaginet.fr>
Hi,
What's the best, or what's the real difference between:
$sth = $dbh->prepare( "insert into stuff.table ( foo, fii ) value ( ?,
? )" );
...
while < reading a file > {
this one # that's what i'm doing actually
$sth->bind_param( 1, "aaa" );
$sth->bind_param( 2, "bbb" );
$sth->execute();
and this one
$sth->execute( "aaa", "bbb" );
} # reading file
PS: i've more than 15 000 requests to do on a mysql database...
------------------------------
Date: Wed, 12 Sep 2001 13:35:05 +0200
From: Horst Fickenscher <horst.fickenscher@sealsystems.de>
Subject: Re: Efficiency
Message-Id: <3B9F4868.7C553629@sealsystems.de>
TM wrote:
> Hi,
>
> Can Perl instructions either from the core or from specific modules be
> more efficient than system commands such as copy, xcopy, del, move etc
> with their many switches and wildcards. Or maybe that's a nonsense. In
> my case, I'm working on WIn2K with procedures that handle thousands of
> files with such commands that's why I'm looking for improvement in
> execution time of such actions.
Yes, in some sense.
Ideally, a perl script looping over thousands of files and directories
and doing things as copy, unlink, rename, chmod etc., can run as
one and only one process.
So you save the overhead of starting many processes in a batch
file or shell script.
Cheers
--
Horst
------------------------------
Date: Wed, 12 Sep 2001 00:30:40 -0700
From: "M.L." <mel2000@hotmaildot.com>
Subject: Re: Help: TiedHash.pm module in @INC not being recognized
Message-Id: <9nn32l$8rq0d$1@ID-19545.news.dfncis.de>
Benjamin Goldberg <goldbb2@earthlink.net> wrote in message
news:3B9ED795.AA548FDA@earthlink.net...
> >
> > use FindBin;
> > use lib "$FindBin::Bin/lib";
> >
> > use CGI qw(:standard);
> > use CGI::Carp qw(fatalsToBrowser);
> > use Fcntl qw(:flock);
> > use Text::CSV;
> > # use AnyData;
> >
> > where AnyData.pm is located in the
> > /u/s/sample/public_html/cgi-bin/lib/AnyData directory and CSV.pm is
> > located in the /u/s/sample/public_html/cgi-bin/lib/Text directory.
>
> The way to solve the problem is to think of :: in a module name as a /
> So Text::CSV is in /u/s/sample/public_html/cgi-bin/lib/, since
> "Text::CSV" becomes "Text/CSV.pm", so ..../lib/Text/CSV.pm is found.
>
> But AnyData becomes AnyData.pm [no ::, so no /], and to find *that*, it
> needs to look in the directory that AnyData.pm is in.
>
> This means that AnyData.pm should be in ....lib/ not in ....lib/AnyData/
>
> cd /u/s/sample/public_html/cgi-bin/lib/
> mv ./AnyData/* ./
> rmdir ./AnyData/
>
It worked!!! Thank you thank you thank you thank you thank you
thank you thank you thank you, and thanks again!! And thanks too
to all the others who offered their assistance.
------------------------------
Date: Wed, 12 Sep 2001 19:57:10 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is there any perl script formater?
Message-Id: <slrn9pucbm.1ek.mgjv@martien.heliotrope.home>
On Wed, 12 Sep 2001 08:19:23 +0200,
Philip Newton <pne-news-20010912@newton.digitalspace.net> wrote:
> On Wed, 12 Sep 2001 04:19:10 GMT, jonadab@bright.net (Jonadab the
> Unsightly One) wrote:
>
>> Not that I'm looking to switch personally since I already
>> know lisp anyway, but... I'd still like to know if there's
>> an equivalent to Emacs with Perl instead of lisp.
>
> I don't think there's an equivalent to Emacs, period. It's in a category
> of its own, IMO.
Yes. Somewhat more than an editor, and only slightly less than an
operating system. Much more resource hungry than vim, but a bit less
than Windows 2000.
Martien
--
Martien Verbruggen |
Interactive Media Division | Freudian slip: when you say one thing
Commercial Dynamics Pty. Ltd. | but mean your mother.
NSW, Australia |
------------------------------
Date: Wed, 12 Sep 2001 12:31:52 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: Is there any perl script formater?
Message-Id: <3B9F5464.C1D20B98@acm.org>
Jonadab the Unsightly One wrote:
> Incidentally, can someone fill in the blank spot at the
> end of the table below for me?
>
> Language | text-editor-with-that-language-for-scripting
> ---------+---------------------------------------------
> lisp | Emacs
> Python | Wily
> Java | jedit
> Tcl | Alpha
> Perl |
> ^^^^^
Well, there "e", an editor entirely written in Perl/Tk, so I suppose
you could say that it uses Perl for scripting.
See http://turnerville.virtualave.net/
-- Dave Tweed
------------------------------
Date: Wed, 12 Sep 2001 08:24:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Laugh: BT webspace CGI conditions
Message-Id: <1q6uptc1cmfrf8jjr9vfeq4offs2hu4d1d@4ax.com>
Stuart Moore wrote:
> - these would imply that I can use perl to open files. Which is nice of them.
>But then:
>
>
>* Do not use "exec", "fork", "open", "pipe", "system", "backticks" or "eval".
> /\ !!!
>
>Any suggestions?
I think that they're actually referring to forms like
open FH, "| prog";
and
open FH, "prog |";
which actually call external programs. And, apart from the the fork(),
these all do call external programs. The fork() they might dislike
because of the possible generation of zombies.
--
Bart.
------------------------------
Date: 12 Sep 2001 02:42:26 -0700
From: kenlaird@yahoo.com (Laird)
Subject: Re: Parsing problem (Please HELP )
Message-Id: <94a02505.0109120142.51d56208@posting.google.com>
Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3B9EDC69.FB44BBCC@earthlink.net>...
> Laird wrote:
> >
> > Hi everybody,
> >
> > I changed the file in order to be more explicit.
> > This is what it looks like.
> >
> > ---
> > # name-1
> > service numberone COMMENTS
> >
> > # name-2
> > service numbertwo COMMENTS
> >
> > # name-3
> > service numberthree
> >
> > # name-4 name-5 COMMENTS
> > service numberfour
> > service numberfive
> >
> > # name-other COMMENTS
> > service numberother
> >
> > ---
> >
> > I'm trying to put numberone after name-1
> > numbertwo after name-2
> > numberthree after name-3
> > numberfour after name-4
> > numberfive after name-5
> > numberother after name-other
>
> my @names;
> while( <DATA> ) {
> if( /^#/ ) {
> @names = /\b(name-\S+)/g;
> } else if( my ($service) = /^\S+\s+(\S+)/ ) {
> foreach my $name ( @names ) {
> print "name = $name\n";
> print "service = $service\n";
> }
> }
> }
Hello
This seems to work half way. The outcome is this:
name = name-1
service = numberone
name = name-2
service = numbertwo
name = name-3
service = numberthree
name = name-4
service = numberfour
name = name-5
service = numberfour
name = name-4
service = numberfive
name = name-5
service = numberfive
name = name-other
service = numberother
Cordially
Ken
------------------------------
Date: Wed, 12 Sep 2001 08:01:40 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: PERL modules and GPL license
Message-Id: <3b9f1663.44b2$2e5@news.op.net>
In article <30586a1d.0109110612.7df30619@posting.google.com>,
Samppa <sami@xenetic.fi> wrote:
>The GPL philosofy says :
>'Free software is about freedom, and enforcing the GPL is defending freedom.'
>
>I wonder that. If you decide to use modules under GPL you
>do not have the freedom to choose if you want or not
>release the source code.
You have the freedom to not include the module at all.
Then you can release your program any way you want.
The author of the module has decided that he does not want to help you
(by giving you the source) unless you are willing to help the free
software community (by giving back the source of your own project.)
If you don't want to be part of the free software community, that is
your free choice. But then you shouldn't whine about how the
community won't help you.
>This is very sad :(
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 12 Sep 2001 08:34:25 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: PERL modules and GPL license
Message-Id: <3b9f1e10.4595$184@news.op.net>
In article <3b9e5021@news.victoria.tc.ca>,
Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
>"Link" is a technical term, which has quite specific meanings.
I find it difficult to respond to this article, because you seem make
several logically inconsistent arguments at several different places.
For example, you spend a lot of time nitpicking about the meaning of
the word 'link', but you later say that the exact meaning of the word
'link' is irrelevant, because it doesn't appear in the license.
You also seem to say that the license has no meaning at all unless
there is a body of case law showing how it has held up in court. If
you really believe that, there's not much point in continuing this
discussion until there is some case law. But I'll just point out that
people write contracts all the time and have a pretty good idea of
what they mean *before* they go to court; most documents *do* have
agreed-upon meanings.
Finally, in a probably vain attempt to bring this discussion back from
the mystery universe where nothing means what it appears to: You spend
a lot of time arguing that maybe the 'separate works' clause applies
to a Perl module. But it's the opinion of the FSF's lawyer that it
doesn't apply, and this argument will *not* hold up in court.
Says Stallman, in a similar context:
It seemed to me at the time that it was [lawful], following
reasoning like what you are using; but since the result was
very undesirable for free software, I said I would have to ask
the lawyer.
What the lawyer said surprised me; he said that judges would
consider such schemes to be "subterfuges" and would be very
harsh toward them. He said a judge would ask whether it is
"really" one program, rather than how it is labeled.
I'm sure that you can make a wonderful argument about the slipperyness
of the concept of "one program", and whether it's "really one program"
or not, and how you can't be sure what that really means, wah wah wah,
just like a sophomore philosophy major, but if Sammi's program doesn't
work without the GPL module, the judge is not going to swallow your
sophistry. Or so is my belief, and, apparently, the belief of the FSF
lawyer.
You may not agree, and of course the lawyer might be wrong. But
whether you agree or not, there is not much point in continuing the
discussion.
I must say though, that if I were in Sammi's position, I would not
want to take the risk that I would be exposed to liability because I
had taken the advice of some random guy name Malcolm who said that
nobody knew what the license meant, when there was an available legal
opinion that said otherwise.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 12 Sep 2001 20:03:07 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: PERL modules and GPL license
Message-Id: <slrn9pucmr.1ek.mgjv@martien.heliotrope.home>
On 11 Sep 2001 07:12:02 -0700,
Samppa <sami@xenetic.fi> wrote:
> mjd@plover.com (Mark Jason Dominus) wrote in message news:<3b97a8bf.7290$218@news.op.net>...
>> In article <30586a1d.0109060149.2fa2141a@posting.google.com>,
>> Samppa <sami@xenetic.fi> wrote:
>> >We are planning to distribute the code as binary
>> >version only, but without license payments.
>>
>> http://www.fsf.org/philosophy/selling.html
> The GPL philosofy says :
> 'Free software is about freedom, and enforcing the GPL is defending freedom.'
>
> I wonder that. If you decide to use modules under GPL you
> do not have the freedom to choose if you want or not
> release the source code.
As mentioned elsewhere in this thread, you are free to contact the
author. It is not unheard of that special licenses have been drawn up
for particular projects, which are different from the license that the
project normally comes under.
> I think that there is alot of programmers who must
> do the whole work again, because they do not want or
> can not release their source code some reason or other.
> This is very sad :(
If someone writes code, and decides that she wants to make this code
available, for free, then she also has the right to refuse to let you
use it in any other way than the one she intended it to be used.
Some people/companies elect to not provide source code, and most of the
people with this attitude also slap all kinds of other prohibitions on
the distribution and use of the binary code.
Others elect to provide source for free, and to enforce the provision of
this source code.
I, personally, find the first attitude much sadder than the second. For
obvious reasons. This is not a fsf advocacy group, there are other
groups for that, but you'll most likely find many people here who feel a
strong sympathy for the open source movements.
Martien
--
Martien Verbruggen |
Interactive Media Division | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
NSW, Australia |
------------------------------
Date: Wed, 12 Sep 2001 12:57:58 +0200
From: "Stefan Weiss" <weiss@kung.foo.at>
Subject: Re: PERL modules and GPL license
Message-Id: <3b9f3e75$1@e-post.inode.at>
[ Sorry, I could not get the correct message to reply to from my
provider's news server; I found this on groups.google.com. This
is in reply to Randal's posting m1k7zc30o4.fsf@halfdome.holdit.com ]
From: "Randal L. Schwartz" <merlyn@stonehenge.com>
> Almost everything in the CPAN says "distributed under the same
> licensing terms as Perl itself". If that's the case, it's under both
> the GPL and the AL. The GPL would (likely) not permit you to do what
> you ask, but the AL certainly would, as long as you don't call the
> result "Perl".
>
> This is one of the coolest things about the Perl CPAN... we can indeed
> do nearly everything we want to do. :)
I've been wondering about this for some time: how can the GPL coexist
with any other license in a statement like "may be distributed under
the same terms as Perl itself"?
| Perl may be copied only under the terms of either the Artistic
| License or the GNU General Public License, which may be found in
| the Perl 5 source kit.
I thought that once a program has been distributed under the GPL once,
you would have to stick to the GPL. So who can choose which licence
such a module is distributed with? The author? The distributor? The user?
A hypothetical case:
Somebody ports perl to a new OS and decides to distribute this perl
version under the GPL (and no mention about the AL). Perl's licence
would allow him to do that, I think. If I was going to use a module
with this perl version that had a note about being "distributed under
the same terms as Perl itself", would I *have* to use it under the GPL,
or could I still take the AL?
In other words, could anybody get me in trouble because *they* chose
the GPL when they distributed such a module (or perl itself) to me,
but *I* was using it under the AL?
cheers,
stefan
------------------------------
Date: Mon, 10 Sep 2001 15:11:55 +0200
From: Stephane Titard <sgt19@tid.es>
Subject: Re: perl regex to GNU C regex
Message-Id: <3B9CBC1A.FC82EDE5@tid.es>
This is a multi-part message in MIME format.
--------------33CF1716271A436DE286185B
Content-Type: multipart/alternative;
boundary="------------80C86EFC485ADF1D8F645F3A"
--------------80C86EFC485ADF1D8F645F3A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
GNU regex is more limited than perl regex. You need a library which is
perl compatible
one package I know of is pcre (perl compatible regular expressions)
good luck
README file for PCRE (Perl-compatible regular expression library)
-----------------------------------------------------------------
The latest release of PCRE is always available from
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz
stephan
--------------80C86EFC485ADF1D8F645F3A
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<pre>Hi,</pre>
GNU regex is more limited than perl regex. You need a library which is
perl compatible
<br>one package I know of is pcre (perl compatible regular expressions)
<p>good luck
<br><br>
<BR>
<br>README file for PCRE (Perl-compatible regular expression library)
<br>-----------------------------------------------------------------
<br>The latest release of PCRE is always available from
<br> <A HREF="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-xxx.tar.gz</A>
<p>stephan<br>
<BR>
<br> </html>
--------------80C86EFC485ADF1D8F645F3A--
--------------33CF1716271A436DE286185B
Content-Type: text/x-vcard; charset=us-ascii;
name="sgt19.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Stephane Titard
Content-Disposition: attachment;
filename="sgt19.vcf"
begin:vcard
n:Titard;Stephane G.
tel;cell:+34 630545970
tel;fax:+34 913374222
tel;work:+34 913379083, +34 913374786
x-mozilla-html:FALSE
org:Telefonica I+D
adr:;;Emilio Vargas 6;Madrid;;28043;Spain
version:2.1
email;internet:sgt19@tid.es
note:Despacho S 324 (sotano oeste)
x-mozilla-cpt:;2048
fn:Stephane G. Titard
end:vcard
--------------33CF1716271A436DE286185B--
------------------------------
Date: Wed, 12 Sep 2001 11:51:50 +0200
From: Ofuuzo <ofuuzo@ub.uit.no>
Subject: Perl script to count pages in a pdf file
Message-Id: <3B9F3036.1207FDAB@ub.uit.no>
Hi,
Is there any perl script to find out the total number of pages in a PDF
file?
Thanks in advance.
- OO
------------------------------
Date: Wed, 12 Sep 2001 20:58:04 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Perl script to count pages in a pdf file
Message-Id: <1000328699.475075@news>
"Ofuuzo" <ofuuzo@ub.uit.no> wrote in message
news:3B9F3036.1207FDAB@ub.uit.no...
> Hi,
>
> Is there any perl script to find out the total number of pages in a PDF
> file?
>
> Thanks in advance.
>
> - OO
>
See the 'pdf_pages' script in the examples that ship with the 'PDF' module
from cpan.
Cheers,
Rob
------------------------------
Date: Wed, 12 Sep 2001 13:01:41 +0200
From: Ofuuzo <ofuuzo@ub.uit.no>
Subject: Re: Perl script to count pages in a pdf file
Message-Id: <3B9F4095.DB9B46C2@ub.uit.no>
Ofuuzo wrote:
> Hi,
>
> Is there any perl script to find out the total number of pages in a PDF
> file?
>
> Thanks in advance.
>
> - OO
I found it out myself (solaris):
strings file.pdf | grep -i page | grep -v Pages | wc -l
- OO
------------------------------
Date: Wed, 12 Sep 2001 20:27:36 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Sharing memory
Message-Id: <slrn9pue4o.1ek.mgjv@martien.heliotrope.home>
On Tue, 11 Sep 2001 09:06:00 +0100,
Andrew Paul Gorton <gortona@cs.man.ac.uk> wrote:
I'm assuming you're on Unix, since you don't mention otherwise.
> I have tried using pipes to communicate bi-directional but it is getting
> to complicated with the synchronization etc. Is there a simple way to
Yes, synchronisation between parents and children can get quite messy.
If you have, or can borrow, Stevens' book "Advanced Programming in the
Unix environment", you could pick up one or two good techniques from
there.
> share information with the parent and the children and if so how, I am
> getting desperate. I need the parent to be able to send configuration
> data and the child to process information and reply.
Maybe IPC::ShareLite or IPC::SharedCache are sufficient for your needs
(really easy to use), or otherwise you could maybe do something with
SysV message queues (IPC::Msg, harder, but has some advantages).
Maybe you need both (SharedLite for data, Msg for signalling).
Maybe a one-way pipe together with IPC::Msg. Maybe a FIFO with a lock
that the child that is writing holds, and a FIFO for each child to read
from.
It's very hard to tell what you need to do. If you need to send large
amounts of data from the child to the parent, then a bidirectional pipe
is probably better or unix domain sockets.
> Can a parent share
> its global varaibles with a child?
No. It can share a special memory segment with it (sort of), which is
what the IPC::Share* modules make easy to do for you.
> The solution needs to be simple as I
> am new to perl, but effective.
New to Perl, but not to Unix programming? Or to both?
Have a look at perlipc, and the various things I mention above. If none
of them seem appropriate, maybe the pipes are the thing to use.
Martien
--
Martien Verbruggen |
Interactive Media Division | Think of the average person. Half of
Commercial Dynamics Pty. Ltd. | the people out there are dumber.
NSW, Australia |
------------------------------
Date: Wed, 12 Sep 2001 09:03:37 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: STANLEY BLACK :: I hope you're lurking
Message-Id: <83nuptodc9dg7qtml79k78vteeorprnsh8@4ax.com>
--We are all looking for you... guy this is why you need a land line
at home. We can't get back into the city so find a phone and call us
we're really worried. Cell phones are done. call me at home.
Lou
------------------------------
Date: Wed, 12 Sep 2001 10:10:38 +0100
From: "btopenworld" <jimbo@soundimages.co.uk>
Subject: Re: Using the Term::ANSIColor
Message-Id: <bEFn7.14495$4j4.75771@NewsReader>
> can someone give me a hint how I can realize colored text output in
> a WIN2000 DOSBOX.
Win32::Console - Win32 Console and Character Mode Functions
jimbo
;-)
------------------------------
Date: 12 Sep 2001 04:59:09 -0700
From: soosterh@my-deja.com (so)
Subject: Re: Warning on adding hash element
Message-Id: <db6cb1f3.0109120359.5e20e020@posting.google.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<9nl1g9$74b$1@mamenchi.zrz.TU-Berlin.DE>...
[first part snipped]
> According to so <soosterh@my-deja.com>:
> > Sorry to reply to my own post, but I found the solution myself.
> > Tad McClellan was correct that line of code is actually correct.
> > What I was actually doing was this...
> > $sInfo->{ '-script' } = {-language=>'javascript',-src=>'/macros_so.js' };
> > print start_html( $sInfo ), "\n";
> >
> > I found I could easily fix the warning by changing '-script' to
> > something else (ie. '-foo' ). So my guess is that inside of the
> > CGI module's start_html() there is some dependency that an other
> > element is defined for the '-script' subHash, and the function
> > actually then blindly dereferences that element.
>
> ...a fact that is documented in CGI, though "-script" is missing
> from the parameter description of start_html.
>
> "You been a-messin' where ya shouldna been a-messin' ..."
Actually all I did was modify an example from the CGI page:
print $q->start_html(-title=>'The Riddle of the Sphinx',
-script=>{-language=>'JavaScript',
-src=>'/javascript/sphinx.js'}
);
My hash already contained the title...
Please tell me what I missed. (ie. What fact is documented in
the CGI page ?)
> > Now why exactly the warning showed up in my script and not in the module
> > I have no clue -- perhaps they have an error handler that passes errors
> > up the stack ?
>
> It is standard procedure for modules to use the Carp module which
> does exactly that.
>
> Anno
I tried the following example...
in file pt
#!/usr/bin/perl -w
use strict;
use foo qw(bar);
bar( { a=>'b' } );
in file foo.pm
package foo;
use strict;
use CGI;
use CGI:Carp;
require Exporter;
use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION );
@ISA = qw(Exporter);
@EXPORT_OK = ( qw/bar/ );
return 1;
sub bar {
my( $pHash ) = ( shift );
print $pHash->{ 'a' }, "\n";
print $pHash->{ 'not_here' }, "\n";
}
...and the out put is as follows...
b
[Wed Sep 12 07:49:18 2001] pt3.pl:
Use of uninitialized value in print at foo.pm line 14.
The error is in my module not in the "program".
BTW, I grepped the CGI modules, and they do not generate any 'uninitialized'
error messages themselves.
Thanks for the responses,
SammyO
------------------------------
Date: Wed, 12 Sep 2001 12:52:02 +0200
From: Horst Fickenscher <horst.fickenscher@sealsystems.de>
Subject: What about Pod::Html?
Message-Id: <3B9F3E52.D6B203AE@sealsystems.de>
The latest Pod::Html I've got with Perl 5.6 is version 1.03.
It seem's outdated for me; e.g it does not use Pod::Parser.
CPAN-search didn't help.
Does anyone have any hints or suggestions?
I considere to document a medium Perl project,
but it seems to me that Pod is not supported very
well.
Are there alternatives, e.g. Doxygen?
I am primarily interested in HTML-output.
Thanks
--
Horst
------------------------------
Date: 12 Sep 2001 03:53:19 -0700
From: crud@hongkong.com (Dav Lam)
Subject: What is package?
Message-Id: <fc25f4f2.0109120253.29dffdaa@posting.google.com>
I keep getting "global symbol ... requires explicit package name"
error with the code below, and i am used to code perl script with no
-w warning and strict pragme before, and i have no idea what things
should be watch for, and, what is package?
And by the way, I'm a novice stepped in the door of perl a short time,
can anyone give me what can i improve for writing code such, the
structure, the variable names, anything, please, give me some advice..
Thanks in advanced...
so #!perl -w
use strict;
use Net::FTP;
##################################################
my $host = ""; #hostname for the site
my $username = ""; #username on the site
my $password = ""; #password on the site
##################################################
my $resume = 0; #resume or not
my $hostdir = ""; #the destination dir to go
my $hostfile = ""; #the destination file to get
my $localdir = ""; #where to store the retrieved file
my $localfile = ""; #filename of the stored local file
##################################################
#make up the connection with the host
my $ftp = new Net::FTP($host);
die "Error connection : $!" unless $ftp;
$ftp->login($username, password);
$ftp->cwd($hostdir);
$ftp->type(I);
##################################################
#if the file really exist
my $hostsize = $ftp->size($hostfile);
die "file to request does not exist on the server : $!" unless
$hostsize;
#initialize the variables and the environment;
if ($resume){
my $localsize = (stat("$localdir$localfile"))[7]; #file size of the
original file
my $readed = $localsize; #bytes totaly received
my $helper = $localsize % 10;
floor ($helper); #for print out rate of progress
$ftp->quot("REST", $localsize);
open (LCLFILE, ">>$localdir$localfile") ||
die "Unable to append to $localfile : $!";
binmode(LCLFILE);
}else{
my $localsize = 0;
my $readed = 0;
my $helper = 0; #for print out rate of progress
open (LCLFILE, "+>$localdir$localfile") ||
die "Unable open file $localfile : $!";
binmode(LCLFILE);
}
my $helper = 0; #for print out rate of progress
my $percent = 0; #percent of file retrieved (1-10)
my $hostsize = $ftp->size($hostfile); #Size of the remote file
my $datachunk; #the container of the newly retrieved data fragment
my $loaded = 0; #the size in bytes of the datachunk
##################################################
#start to retrieve file..., finally...
my $dataconn = $ftp->retr($hostfile);
die "can't make connection to rer $hostfile" unless $dataconn;
print "\nDownloading $file ($size bytes): ";
if ($resume && ($localsize > $hostsize / 10)){
$percent = floor(($localsize / $hostsize) * 10);
print "##-" x $percent;
}
while($loaded = $dataconn->read($datachunk, 1024)){
$readed += $loaded;
$helper += $loaded;
print LCLFILE $datachunk;
if( $helper >= ($hostsize/10) && $percent < 10 ){
print '##-';
$percent++;
$helper = 0;
}
break if $readed > ($hostsize - 1048576);
}
exit 0
------------------------------
Date: Wed, 12 Sep 2001 11:37:06 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: What is package?
Message-Id: <CNHn7.5487$gU.1520505@news1.rdc1.md.home.com>
"Dav Lam" <crud@hongkong.com> wrote in message
news:fc25f4f2.0109120253.29dffdaa@posting.google.com...
> I keep getting "global symbol ... requires explicit package name"
> error with the code below, and i am used to code perl script with no
> -w warning and strict pragme before, and i have no idea what things
> should be watch for, and, what is package?
>
> And by the way, I'm a novice stepped in the door of perl a short time,
> can anyone give me what can i improve for writing code such, the
> structure, the variable names, anything, please, give me some advice..
>
> Thanks in advanced...
>
> so #!perl -w
>
> use strict;
> use Net::FTP;
>
> ##################################################
> my $host = ""; #hostname for the site
> my $username = ""; #username on the site
> my $password = ""; #password on the site
> ##################################################
> my $resume = 0; #resume or not
> my $hostdir = ""; #the destination dir to go
> my $hostfile = ""; #the destination file to get
> my $localdir = ""; #where to store the retrieved file
> my $localfile = ""; #filename of the stored local file
> ##################################################
>
> #make up the connection with the host
> my $ftp = new Net::FTP($host);
> die "Error connection : $!" unless $ftp;
>
> $ftp->login($username, password);
Think you mean $password.
> $ftp->cwd($hostdir);
> $ftp->type(I);
I don't use the FTP module, and its documentation isn't specific on what the
types passed to type should be (strings 'binary', 'ascii', etc?). However,
this bareword isn't cutting it.
>
> ##################################################
>
> #if the file really exist
> my $hostsize = $ftp->size($hostfile);
> die "file to request does not exist on the server : $!" unless
> $hostsize;
>
> #initialize the variables and the environment;
>
> if ($resume){
> my $localsize = (stat("$localdir$localfile"))[7]; #file size of the
> original file
> my $readed = $localsize; #bytes totaly received
> my $helper = $localsize % 10;
> floor ($helper); #for print out rate of progress
> $ftp->quot("REST", $localsize);
> open (LCLFILE, ">>$localdir$localfile") ||
> die "Unable to append to $localfile : $!";
> binmode(LCLFILE);
> }else{
> my $localsize = 0;
> my $readed = 0;
> my $helper = 0; #for print out rate of progress
> open (LCLFILE, "+>$localdir$localfile") ||
> die "Unable open file $localfile : $!";
> binmode(LCLFILE);
> }
>
And all of these variables are no longer in scope with the close of a curly
brace, except for helper, which you my'd twice. I think you need to examine
this variable and think about what you're trying to do with it.
$ perl -e 'use strict; if (1){my $var;} $var = 0;'
Global symbol "$var" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
use strict doesn't just do what it does for subroutines.
> my $helper = 0; #for print out rate of progress
> my $percent = 0; #percent of file retrieved (1-10)
> my $hostsize = $ftp->size($hostfile); #Size of the remote file
> my $datachunk; #the container of the newly retrieved data fragment
> my $loaded = 0; #the size in bytes of the datachunk
>
> ##################################################
>
> #start to retrieve file..., finally...
> my $dataconn = $ftp->retr($hostfile);
> die "can't make connection to rer $hostfile" unless $dataconn;
> print "\nDownloading $file ($size bytes): ";
Global symbol "$file" requires explicit package name at ./test.pl line 64.
Global symbol "$size" requires explicit package name at ./test.pl line 64.
This is just a blatant mistake, as no variable named file or size has been
used up until this point.
>
> if ($resume && ($localsize > $hostsize / 10)){
> $percent = floor(($localsize / $hostsize) * 10);
> print "##-" x $percent;
> }
>
> while($loaded = $dataconn->read($datachunk, 1024)){
>
> $readed += $loaded;
> $helper += $loaded;
>
> print LCLFILE $datachunk;
> if( $helper >= ($hostsize/10) && $percent < 10 ){
> print '##-';
> $percent++;
> $helper = 0;
> }
> break if $readed > ($hostsize - 1048576);
Whoops, looks like you slipped into C mode. That's last, not break.
And localsize/readed are not in scope, as I mentioned would happen earlier.
> }
>
> exit 0
--
David Hilsee
------------------------------
Date: Wed, 12 Sep 2001 11:48:02 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: What is package?
Message-Id: <SXHn7.5492$gU.1525225@news1.rdc1.md.home.com>
>
> And all of these variables are no longer in scope with the close of a
curly
> brace, except for helper, which you my'd twice. I think you need to
examine
> this variable and think about what you're trying to do with it.
>
> $ perl -e 'use strict; if (1){my $var;} $var = 0;'
> Global symbol "$var" requires explicit package name at -e line 1.
> Execution of -e aborted due to compilation errors.
>
> use strict doesn't just do what it does for subroutines.
Correction: at this point there is no helper in scope, as both were
lexically scoped to a block (the if and else blocks). You actually my'd it
_three_ times, as shown on the very next line.
My apologies.
>
> > my $helper = 0; #for print out rate of progress
> > my $percent = 0; #percent of file retrieved (1-10)
> > my $hostsize = $ftp->size($hostfile); #Size of the remote file
> > my $datachunk; #the container of the newly retrieved data fragment
> > my $loaded = 0; #the size in bytes of the datachunk
David Hilsee
------------------------------
Date: Wed, 12 Sep 2001 12:23:52 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: What is package?
Message-Id: <stIn7.5503$gU.1551255@news1.rdc1.md.home.com>
"David Hilsee" <davidhilseenews@yahoo.com> wrote in message
news:CNHn7.5487$gU.1520505@news1.rdc1.md.home.com...
>
> "Dav Lam" <crud@hongkong.com> wrote in message
> news:fc25f4f2.0109120253.29dffdaa@posting.google.com...
> > I keep getting "global symbol ... requires explicit package name"
> > error with the code below, and i am used to code perl script with no
> > -w warning and strict pragme before, and i have no idea what things
> > should be watch for, and, what is package?
> >
> > And by the way, I'm a novice stepped in the door of perl a short time,
> > can anyone give me what can i improve for writing code such, the
> > structure, the variable names, anything, please, give me some advice..
> >
After reviewing what I said, I think my comments might not have been that
helpful. I missed both "no"s in the first paragraph, and took it to mean
the exact opposite of what you meant (hadn't had my coffee yet). I thought
you were experienced with use strict and just couldn't understand what you
did wrong in the script.
I would like to refer you to perldoc perlsub (specifically, the section on
my). Perldoc is a great utility for looking up documentation on perl, and
comes with many distributions of perl. Also, books are good, such as
Learning Perl or Programming Perl, for example. In my opinion, trying to
learn about a general subject from a newsgroup isn't such a great idea.
You can type perldoc perldoc on the command line to learn more about it,
assuming you have it.
Sorry about my original post (and its correction). It probably confused you
more than helped you.
David Hilsee
------------------------------
Date: Wed, 12 Sep 2001 13:41:49 +0100
From: "Simon Oliver" <simon.oliver@umist.ac.uk>
Subject: Re: What is package?
Message-Id: <3b9f5b3a@news.umist.ac.uk>
You have 'use strict;' - amongst other things, this means that you must
fully qualify (e.g. $main::file) or declare all variables before using them
with my, our, use vars;.
I suggest you read the error messages as they will tell you which variables
you haven't declared yet.
Also, you have re-declared a variable ($hostsize) - that doesn't make any
sense either.
Also, you have some barewords (not in quotation marks) - this usually
indicates that you forgot to put a $, @, % or & symbol in front of the
identifier.
I suggest you read perldoc perlsyn and perldoc strict before proceeding.
--
Simon Oliver
"Dav Lam" <crud@hongkong.com> wrote in message
news:fc25f4f2.0109120253.29dffdaa@posting.google.com...
> I keep getting "global symbol ... requires explicit package name"
> error with the code below, and i am used to code perl script with no
> -w warning and strict pragme before, and i have no idea what things
> should be watch for, and, what is package?
>
...
------------------------------
Date: Wed, 12 Sep 2001 12:41:05 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: What is package?
Message-Id: <slrn9puj6d.9cd.tadmc@tadmc26.august.net>
Dav Lam <crud@hongkong.com> wrote:
>what is package?
Packages are documented right at the top of:
perldoc perlmod
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 1736
***************************************