[25576] in Perl-Users-Digest
Perl-Users Digest, Issue: 7820 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 23 14:05:42 2005
Date: Wed, 23 Feb 2005 11:05:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 23 Feb 2005 Volume: 10 Number: 7820
Today's topics:
Re: [perl-python] exercise: partition a list by equival <iketo2@netscape.net>
Re: [perl-python] exercise: partition a list by equival <ptmcg@austin.rr.com>
Re: Annoying Problem with a Basic Perl app and XP Pro <jns@gellyfish.com>
Re: Annoying Problem with a Basic Perl app and XP Pro <jpmythic@ntlworld.com>
Re: Annoying Problem with a Basic Perl app and XP Pro <jpmythic@ntlworld.com>
Re: Annoying Problem with a Basic Perl app and XP Pro <jpmythic@ntlworld.com>
Re: compacting '..' path segments using File::Spec (David Combs)
Re: Comparing huge XML Files <jurgenex@hotmail.com>
Re: Comparing huge XML Files xhoster@gmail.com
Re: Comparing huge XML Files <junnuthula@yahoo.com>
Re: Comparing huge XML Files <postmaster@castleamber.com>
Credit cards storage saidev@gmail.com
Re: Credit cards storage <richard@zync.co.uk>
Re: Form manipulation through mechcanize (perl) <bonjo90@yahoo.co.in>
Re: FTP from macro <dha@panix.com>
Installation of Perl/Tk under Solaris 5.8 <james.ritter@boeing.com>
Re: Legitimate use of calling a sub as &sub <nobull@mail.com>
Re: OOP Tutorial <nobull@mail.com>
OT: Re: standard mode for arrow down <Red.Grittybrick@SpamWeary.Foo>
Read from keyboard <sun_tong@users.sourceforge.net>
Re: Read from keyboard <jl_post@hotmail.com>
Re: Read from keyboard <matternc@comcast.net>
Re: standard mode for arrow down <daneNO@SPAM.mk.telcordia.com>
Re: standard mode for arrow down <spam@mouse-potato.com>
Re: standard mode for arrow down <mru@inprovide.com>
Re: Time::Format with two $time strings <1usa@llenroc.ude.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Feb 2005 09:44:00 +0800
From: Isaac To <iketo2@netscape.net>
Subject: Re: [perl-python] exercise: partition a list by equivalence
Message-Id: <87brag6m5b.fsf@sinken.local.csis.hku.hk>
>>>>> "Isaac" == Isaac To <iketo2@netscape.net> writes:
Isaac> Conversion to Python is left as an exercise. :)
In case you don't want exercise, here is how I do it myself.
def merge(list):
elt_set = dict([[e[0], -1] for e in list] + [[e[1], -1] for e in list])
adj_set = dict([[e, {}] for e in elt_set.keys()])
for e in list:
adj_set[e[0]][e[1]] = adj_set[e[1]][e[0]] = -1
id = 0
def fill(elt):
if elt_set[elt] != -1:
return
elt_set[elt] = id
for e in adj_set[elt].keys():
fill(e)
for e in elt_set.keys():
id += 1
fill(e)
result_set = dict([[e, []] for e in xrange(1, id+1)])
for [key, val] in elt_set.iteritems():
result_set[val].append(key)
return filter(None, result_set.values())
It's recursive, meaning that if data size is too large the Python
runtime bail-out. So you get another exercise: convert it to use a
stack or queue instead of recursion.
Regards,
Isaac.
------------------------------
Date: 23 Feb 2005 08:47:17 -0800
From: "Paul McGuire" <ptmcg@austin.rr.com>
Subject: Re: [perl-python] exercise: partition a list by equivalence
Message-Id: <1109177237.722882.5880@g14g2000cwa.googlegroups.com>
Please consider my submission also (Python 2.3-compatible).
-- Paul McGuire
. import sets
.
. input = [[1, 2], [3, 4], [2, 3], [4, 5]]
. input = [[1, 2], [3, 4], [4, 5]]
. input = [[1, 2],[2,1], [3, 4], [4, 5],[2,2],[2,3],[6,6]]
.
. def merge(pairings):
. ret = []
. for a,b in pairings:
. s1 = None
. s2 = None
. for s in ret:
. if a in s or b in s:
. if s1 is None:
. s1 = s
. else:
. s2 = s
. break
. else:
. for s in ret:
. if a in s:
. s.add(b)
. break
. elif b in s:
. s.add(a)
. break
. else:
. ret.append(sets.Set([a,b]))
. continue
. ret.remove(s1)
. ret.remove(s2)
. ret.append(s1.union(s2))
.
. return [list(s) for s in ret]
.
. print merge(input)
------------------------------
Date: Wed, 23 Feb 2005 16:32:58 +0000
From: Jonathan Stowe <jns@gellyfish.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <1109176378.27647.0@echo.uk.clara.net>
arek <jpmythic@ntlworld.com> wrote:
> If your [Exhausted] from reading less then 2 pages of code,
> How the heck can you debug 10K lines worth of Code?
> I work with programs that contain more then 500 seperate documents
> (each a C++ .h or .cc file)
My heart bleeds for you.
> and your complaing about less then TWO pages Heavily Commented??
>
Yes but there is a difference between doing this for a job and doing it
as a favour to someone on a newsgroup.
/J\
------------------------------
Date: 23 Feb 2005 08:51:35 -0800
From: "arek" <jpmythic@ntlworld.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <1109177495.555715.99430@g14g2000cwa.googlegroups.com>
Umm... in what way did I NOT post what I was using?
I did my BEST to make sure I provided sufficient information to ask for
help
with what appeared to be an issue between to versions of Windows with
the same code.
What I got was a bunch of arguments about the Code posted being full of
errors.
What the posting contained was the Exact same code with 3 glitches that
occured
during the initial Posting.
With further browsing of the Thread, you will find several had actually
gotten it to compile,
which means the Code was functional. SO where did I NOT post the code?
Your response falls among the many others that would rather Argue and
NitPick then Help!
Any decent programmer would merely have chuckled at the MINOR glitches
in the Posted
code, fixed them and looked at where I might be having problems. Few
did. No problems
with pointing out Style concerns, but as that was ALL some posted,
those in my Opinion
were wasted bandwidth.
Further posts as yours above merely turn away possible usefull
participants in what should
be a good natured and civil attempt to help each other.
------------------------------
Date: 23 Feb 2005 08:59:27 -0800
From: "arek" <jpmythic@ntlworld.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <1109177967.766757.283870@g14g2000cwa.googlegroups.com>
A favor is exactly all I asked for, not groaning that the Code is
Crap.
If your not interested in helping someone with a problem, you shouldn't
even post.
I help loads of people in different forums. I also refrain from
posting Garbage.
I don't refrain from defending myself tho.
The above posts were directed at someone groaning about something they
didn't really seem to care to Help with, just point out that my Coding
of it was crap.
IF it was so Crappy, it wouldn't have worked in the first place. As
with ANY application
you start with it HEAVILY commented to help you remember WHAT you were
doing
Documentation of Code is a must, and if my documenting is Garbage as
Some have
said, I really would DREAD having to work on any Code they wrote.
Most people that post here for help are NOT going to be extreme coding
Guru's in the
section they are asking for help. Expecting 100% clean and perfect
code is Ridiculous!
Thus if you do nothing but point out those errors and do no actual help
with the code,
your actually defeating the purpose of such groups.
------------------------------
Date: 23 Feb 2005 09:01:42 -0800
From: "arek" <jpmythic@ntlworld.com>
Subject: Re: Annoying Problem with a Basic Perl app and XP Pro
Message-Id: <1109178102.090652.7230@g14g2000cwa.googlegroups.com>
Hmm... So the Perl Code I posted,
Which I had modified from another Authors Code that
has been heavily involved in Perl for years WAS NOT PERL CODE?
YOU make me Laugh!
------------------------------
Date: Wed, 23 Feb 2005 18:39:56 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: compacting '..' path segments using File::Spec
Message-Id: <cviilr$ed$1@reader2.panix.com>
In article <1108795536.702248.313500@o13g2000cwo.googlegroups.com>,
<ofer@netapt.com> wrote:
>Since I asked the question, it's only fair that I share the answer when
>I find it. Ken Williams, author of the wonderful Path::Class, had this
>to say on the topic:
>
>---
>The reason File::Spec and Path::Class don't handle this case is that,
>for instance, /data/current could be a symlink to somewhere else. If
>/data/current points to /foo/bar, then
>/data/current/../backup/thefile-20050211.tgz really points to
>/foo/backup/thefile-20050211.tgz , not
>/data/backup/thefile-20050211.tgz .
>
>The "correct" way to do this is to use the Cwd.pm module, which has a
>realpath() function that will resolve any '.' and '..' components in
>the path.
I'm surely doing something wrong, or maybe you have a newer emacs
than mine, but I can't find a "sub.*realpath' anywhere:
egrep -in 'sub.*realpath' `gauf Cwd.pm`
(gauf is alias that greps for its arg, in batch-created
via-find huge list of all files on my (standalone) computer)
David
------------------------------
Date: Wed, 23 Feb 2005 16:10:23 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Comparing huge XML Files
Message-Id: <PV1Td.10101$EL5.5698@trnddc05>
xhoster@gmail.com wrote:
> "junnuthala" <junnuthula@yahoo.com> wrote:
>> Can someone please suggest me a Perl module for comparing huge XML
>> Files.
>
> How about just an ordinary text-based file diff on them?
Bin there, done that, not a good idea.
XML is a format-free language while text-based diff tools mark every swapped
parameter, every additional line break or space as a difference. Totally
useless to compare XML files.
jue
------------------------------
Date: 23 Feb 2005 16:20:18 GMT
From: xhoster@gmail.com
Subject: Re: Comparing huge XML Files
Message-Id: <20050223112018.226$nd@newsreader.com>
"Jürgen Exner" <jurgenex@hotmail.com> wrote:
> xhoster@gmail.com wrote:
> > "junnuthala" <junnuthula@yahoo.com> wrote:
> >> Can someone please suggest me a Perl module for comparing huge XML
> >> Files.
> >
> > How about just an ordinary text-based file diff on them?
>
> Bin there, done that, not a good idea.
> XML is a format-free language while text-based diff tools mark every
> swapped parameter, every additional line break or space as a difference.
> Totally useless to compare XML files.
While this is true of XML files in general, it is not obvious that the OP
wants to compare XML files in general. He probably wants to compare very
specific XML files, and it may be reasonable to expect that two XML files
generated by the same software will not have arbitrarily swapped parameters
or arbitrarily changes in the white space layout. Only the OP can tell us
if this is true or not. In that absense of feedback to the contrary, I
think that it is at least worth a try.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 23 Feb 2005 10:10:58 -0800
From: "junnuthala" <junnuthula@yahoo.com>
Subject: Re: Comparing huge XML Files
Message-Id: <1109182258.209656.26060@z14g2000cwz.googlegroups.com>
xhoster@gmail.com wrote:
> "J=FCrgen Exner" <jurgenex@hotmail.com> wrote:
> > xhoster@gmail.com wrote:
> > > "junnuthala" <junnuthula@yahoo.com> wrote:
> > >> Can someone please suggest me a Perl module for comparing huge
XML
> > >> Files.
> > >
> > > How about just an ordinary text-based file diff on them?
> >
> > Bin there, done that, not a good idea.
> > XML is a format-free language while text-based diff tools mark
every
> > swapped parameter, every additional line break or space as a
difference.
> > Totally useless to compare XML files.
>
> While this is true of XML files in general, it is not obvious that
the OP
> wants to compare XML files in general. He probably wants to compare
very
> specific XML files, and it may be reasonable to expect that two XML
files
> generated by the same software will not have arbitrarily swapped
parameters
> or arbitrarily changes in the white space layout. Only the OP can
tell us
> if this is true or not. In that absense of feedback to the contrary,
I
> think that it is at least worth a try.
I want to compare XML files generated by two different softwares, but
should be in same format. So I cannot take it for granted that all the
white spaces will be the same, so I cannot use text diff tools.
>
> Xho
>
> --
> -------------------- http://NewsReader.Com/ --------------------
> Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 23 Feb 2005 18:40:03 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Comparing huge XML Files
Message-Id: <Xns960680D93C12Acastleamber@130.133.1.4>
junnuthala wrote:
> I want to compare XML files generated by two different softwares, but
> should be in same format. So I cannot take it for granted that all the
> white spaces will be the same, so I cannot use text diff tools.
diff --help
-i --ignore-case Consider upper- and lower-case to be the same.
-w --ignore-all-space Ignore all white space.
-b --ignore-space-change Ignore changes in the amount of white space.
-B --ignore-blank-lines Ignore changes whose lines are all blank.
-I RE --ignore-matching-lines=RE Ignore changes whose lines all match
RE.
etc.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 23 Feb 2005 08:34:18 -0800
From: saidev@gmail.com
Subject: Credit cards storage
Message-Id: <1109176458.577902.57420@o13g2000cwo.googlegroups.com>
Just want to get some ideas on how everyone store Credit Card
information into MySQL. I know I can't use the one way encryption, if
the customer come back, I won't be able to provide the correct
information to the bank. What is the safest way to store user CC
information? I'll be modifying an existance Perl program to do this,
any modules can help me do this? Thanks.
------------------------------
Date: Wed, 23 Feb 2005 17:11:54 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: Credit cards storage
Message-Id: <pan.2005.02.23.17.11.54.790924@zync.co.uk>
On Wed, 23 Feb 2005 08:34:18 -0800, saidev wrote:
> Just want to get some ideas on how everyone store Credit Card information
> into MySQL. I know I can't use the one way encryption, if the customer
> come back, I won't be able to provide the correct information to the bank.
> What is the safest way to store user CC information? I'll be modifying
> an existance Perl program to do this, any modules can help me do this?
> Thanks.
I'm not really answering your question but I would say this:
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
DON'T DO IT!!! IF EVER YOU ARE TEMPTED TO STORE CREDIT CARD INFORMATION,
PLEASE TAKE THE FOLLOWING STEPS IMMEDIATELY:
1. CUT YOUR HEAD OWN OFF
There are a plenty of other options for processing credit / debit card
payments, leave the storage (and therefore risk and high insurance bills)
of potentially dangerous information to the experts.
HTH
Rich
------------------------------
Date: Wed, 23 Feb 2005 12:07:39 -0500
From: "Antwerp" <bonjo90@yahoo.co.in>
Subject: Re: Form manipulation through mechcanize (perl)
Message-Id: <uS2Td.33774$Am3.941746@news20.bellglobal.com>
Hi,
: It appears you have all of the other variables covered, except for the
: "value" of the submit button. You provided the correct name, loginSubmit;
: but you didn't provide a value. From the response to a submittal of the
: previously mentioned Col43 script,
:
: "loginSubmit" => "\xa0\xa0Login\xa0\xa0", # submit
:
: If the back-end processing is checking for the correct value, it would
: behove you to provide it. ;-)
You are absolutely correct - I had mistakenly thought that I would not have
to submit hidden fields, and thus, although I did see them (as per the previous
posts / suggestions made), I did not think it necessary to include them. When,
out of desperation, I tried them, everything worked.
I thank you very much for your time and assistance,
AntWerp
"Bill Segraves" <segraves_f13@mindspring.com> wrote in message
news:gOKSd.3910$Ba3.468@newsread2.news.atl.earthlink.net...
: "Bill Segraves" <segraves_f13@mindspring.com> wrote in message
: news:PeKSd.8706$x53.8046@newsread3.news.atl.earthlink.net...
: <snip>
: > In addition, it appears you have missed at least one hidden variable that
: > should be included in your submittal
: >
: > "userRequested" => "", # hidden
:
: Another hidden variable:
:
: "uri" => "/pe/index.jsp", # hidden
:
: It appears you have all of the other variables covered, except for the
: "value" of the submit button. You provided the correct name, loginSubmit;
: but you didn't provide a value. From the response to a submittal of the
: previously mentioned Col43 script,
:
: "loginSubmit" => "\xa0\xa0Login\xa0\xa0", # submit
:
: If the back-end processing is checking for the correct value, it would
: behove you to provide it. ;-)
:
: Cheers.
: --
: Bill Segraves
:
:
------------------------------
Date: Wed, 23 Feb 2005 18:59:42 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: FTP from macro
Message-Id: <slrnd1pkku.kgj.dha@panix2.panix.com>
On 2005-02-23, arek <jpmythic@ntlworld.com> wrote:
> do a search for AutoFtp.pl
>
> This was put out ages ago by one author and the basics work well
> I did some modifications to it for my own purposes, altho I did
> run into a few problems...
I would suggest the OP use the previously suggested Net::FTP module,
which is not "ages old", but currently maintained, and is probably a
heck of a lot more adaptable than the solution you suggest.
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"We are the Borg. You will be assimilated! Nah, only kidding. We're
just the Sontarans. Care to take part in some 'medical research'?"
------------------------------
Date: 23 Feb 2005 08:16:54 -0800
From: "Jamie" <james.ritter@boeing.com>
Subject: Installation of Perl/Tk under Solaris 5.8
Message-Id: <1109175414.887069.106340@o13g2000cwo.googlegroups.com>
I tried installing the latest version, but the installation does not
seem to be correct. We have perl 5.8.5 (recently installed) on the
system.
I installed Perl/Tk in my directory /home/jritter/mypm/Tk-804.027.
Then I did
a cd to that directory and performed the following steps:
===================================================================
perl Makefile.PL PREFIX=/home/jritter/mypm/myTk <=== Succeeded
make <=== Succeeded
make test
o
o
o
t/Require....................ok 84/94
Tk/JPEG.pm: Can't load
'/home/jritter/mypm/Tk-804.027/blib/arch/auto/Tk/JPEG/JPEG.so' for
module Tk::JPEG: ld.so.1: /usr/local/bin/perl: fatal: relocation error:
file /home/jritter/mypm/Tk-804.027/blib/arch/auto/Tk/JPEG/JPEG.so:
symbol jpeg_write_raw_data: referenced symbol not found at
/usr/local/lib/perl5/5.8.5/sun4-solaris/DynaLoader.pm line 230.
at t/Require.t line 20
at /usr/local/lib/perl5/5.8.5/sun4-solaris/DynaLoader.pm line 118
DynaLoader::croak('Can\'t load
\'/home/jritter/mypm/Tk-804.027/blib/arch/auto/Tk...') called at
/usr/local/lib/perl5/5.8.5/sun4-solaris/DynaLoader.pm line 230
DynaLoader::bootstrap('Tk::JPEG') called at
/home/jritter/mypm/Tk-804.027/blib/lib/Tk/JPEG.pm line 16
require Tk/JPEG.pm called at t/Require.t line 20
eval {...} called at t/Require.t line 20
Compilation failed in require at t/Require.t line 20.
at t/Require.t line 20
eval {...} called at t/Require.t line 20
t/Require....................FAILED test 85
Failed 1/94 tests, 98.94% okay
o
o
o
(3 subtests UNEXPECTEDLY SUCCEEDED), 2 tests and 23 subtests skipped.
Failed 1/47 test scripts, 97.87% okay. 1/2040 subtests failed, 99.95%
okay.
*** Error code 29
make: Fatal error: Command failed for target `test_dynamic'
===================================================================
When I tried to run my own Perl/Tk script, runMemMap (which ran fine
with the older version of Perl/Tk), I got the following results:
osumi:/home/jritter/ssp/build/build4/test [ 88 ] ~/scripts2/runMemMap &
[1] 16009
osumi:/home/jritter/ssp/build/build4/test [ 89 ] Can't locate loadable
object for module Tk::Event in @INC
(@INC contains: /home/jritter/scripts2
/home/jritter/mypm/Tk-804.027
/usr/local/lib/perl5/5.8.5/sun4-solaris
/usr/local/lib/perl5/5.8.5
/usr/local/lib/perl5/site_perl/5.8.5/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.5
/usr/local/lib/perl5/site_perl .)
at /home/jritter/scripts2/Tk.pm line 13
Compilation failed in require at /home/jritter/scripts2/Tk.pm line 13.
BEGIN failed--compilation aborted at /home/jritter/scripts2/Tk.pm line
13.
Compilation failed in require at /home/jritter/scripts2/runMemMap line
53.
BEGIN failed--compilation aborted at /home/jritter/scripts2/runMemMap
line 53.
Undefined subroutine &Tk::Event::CleanupGlue called at
/home/jritter/scripts2/Tk/Event.pm line 3.
END failed--call queue aborted at /home/jritter/scripts2/runMemMap line
53.
I then tried to run the basic_demo against the Sas installation as
follows:
basic_demo
Can't locate Tk/Event.pm in @INC
(@INC contains: /usr/local/lib/perl5/5.8.5/sun4-solaris
/usr/local/lib/perl5/5.8.5
/usr/local/lib/perl5/site_perl/5.8.5/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.5
/usr/local/lib/perl5/site_perl .)
at Tk.pm line 13.
BEGIN failed--compilation aborted at Tk.pm line 13.
Compilation failed in require at basic_demo line 12.
BEGIN failed--compilation aborted at basic_demo line 12.
Can you help???
Thanx,
Jamie
James W Ritter
------------------------------
Date: Wed, 23 Feb 2005 17:43:36 +0000
From: Brian McCauley <nobull@mail.com>
To: Richard Gration <richard@zync.co.uk>
Subject: Re: Legitimate use of calling a sub as &sub
Message-Id: <421CC0C8.6070509@mail.com>
Richard Gration wrote:
> Below is a program to calculate the cubic root of a number by
> Newton-Raphson which I knocked up to post to the "cubic root subroutine"
> thread below. I noticed that the nr function passed 2 of its 3 arguments
> unchanged when it recursed. It occured to me that this might be a
> legitimate use of using &nr to recurse, having altered the one argument in
> @_ which did change. I was just wondering if this is bad style, because I
> changed @_, or if it is acceptable ... any comments anyone?
It is certainly questionable style. I've been known to do it but I
definitely feel dirty when I do so.
If you are going to modify @_ in this way you should get into the habit
of using shift/unshift or splice. Modifying $_[0] directly modifies
the variable in the calling code. You probably don't want that.
Of course the particular example you give is pure tail recursion so is
better implemented as a loop (or even a goto).
------------------------------
Date: Wed, 23 Feb 2005 18:15:49 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: OOP Tutorial
Message-Id: <cviguh$kq1$1@sun3.bham.ac.uk>
Leslie Viljoen wrote:
> Please forgive the cross-post
What cross-post? This thread is not cross-posted.
> I hear comp.lang.perl is defunct.
Er yes, rather a long time ago.
> Anyway, I have written yet another Perl OOP tutorial. If you are
> interested, I'd appreciate your comments on it:
While not all OO systems have the concept of class I think it is worthy
of mention in the abstract part because so many do. Actually you do not
introduce the concept of class at all before you use it.
You could then mention that in most OO systems inheritance is between
classes not objects.
I'm glad to see you 'use strict' in your examples, in a contemporary
tutiorial you should 'use warnings' rather then utilize the -w switch.
You describe the scope of the package directive incorrectly.
The -> calls methods not subroutines. Actually they are the same thing
but to call a subroutine in a package (non-OO style) you just use a
namespace qualified call.
You mention the ability to manipuate package variables from outside way
too soon. Package variables as part of the package API should only be
use for things like DEBUG flags.
Your examples use package names with lower case names contrary to the
normal conventions.
Your example .pm files have #! lines - meaningless and confusing.
In your narrative you talk of using an implicit return in modules but in
your examples you use an explicit one (contrary to normal conventions).
(I stopped reading after 4/23 pages as I have to go now but I may take
another look later)
------------------------------
Date: Wed, 23 Feb 2005 19:02:54 +0000 (UTC)
From: RedGrittyBrick <Red.Grittybrick@SpamWeary.Foo>
Subject: OT: Re: standard mode for arrow down
Message-Id: <cvik0t$77n$1@titan.btinternet.com>
Xah Lee wrote:
> Computing Folks of the industry:
>
> please spread the debunking of the truncating line business of the
> fucking unix-loving fuckheads, as outlines here:
> http://xahlee.org/UnixResource_dir/writ/truncate_line.html
>
<rant deleted>
What do I find Xah Lee has prepared at the above URL? text presented in
one HTML PRE tag with containing the very newline characters that cause
Xah Lee to foam at the mouth!
If Xah Lee understood <p> rant here </p> I'd be able to use the full
width of my browser to marvel at his idiocy.
(Apologies for feeding the troll).
------------------------------
Date: Wed, 23 Feb 2005 11:57:19 -0500
From: * Tong * <sun_tong@users.sourceforge.net>
Subject: Read from keyboard
Message-Id: <pan.2005.02.23.16.57.19.91041@users.sourceforge.net>
Hi,
Is there any way to read from keyboard/tty instead of STDIN?
My script process STDIN, while some time it need user interaction through
the keyboard, leaving the STDIN intact.
I've tried the getc(), and Term::ReadKey. However, they all seems to read
from STDIN. Please help.
Thanks
--
Tong (remove underscore(s) to reply)
*niX Power Tools Project: http://xpt.sourceforge.net/
- All free contribution & collection
------------------------------
Date: 23 Feb 2005 09:47:09 -0800
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: Read from keyboard
Message-Id: <1109180829.774052.247480@g14g2000cwa.googlegroups.com>
* Tong * wrote:
>
> Is there any way to read from keyboard/tty instead of STDIN?
>
> My script process STDIN, while some time it need user interaction
through
> the keyboard, leaving the STDIN intact.
>
> I've tried the getc(), and Term::ReadKey. However, they all seems to
read
> from STDIN. Please help.
Dear Tong,
This may not be the answer you're looking for, but did you try
reading all of STDIN first BEFORE requiring user interaction?
For example, if you wanted to ask a user his/her name, you might try
something like this:
my @allLinesFromSTDIN = <>;
print "What is your name? ";
my $name = <STDIN>; # don't forget to chomp() !
The first line reads all immediate lines from STDIN into an array,
leaving all subsequent reads from STDIN free to read from user input.
You are then free to process all the immediate STDIN lines later with
code like:
foreach (@allLinesFromSTDIN) # instead of "foreach(<>)"
{
# The $_ holds a line of input.
# Process $_ here...
}
I hope this helps, Tong.
-- Jean-Luc
------------------------------
Date: Wed, 23 Feb 2005 13:31:07 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Read from keyboard
Message-Id: <bLydnY8Y-Kp2VoHfRVn-hQ@comcast.com>
* Tong * wrote:
> Hi,
>
> Is there any way to read from keyboard/tty instead of STDIN?
Open /dev/tty and read from it.
>
> My script process STDIN, while some time it need user interaction through
> the keyboard, leaving the STDIN intact.
>
> I've tried the getc(), and Term::ReadKey. However, they all seems to read
> from STDIN. Please help.
>
> Thanks
>
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Wed, 23 Feb 2005 11:12:21 -0500
From: Dan Espen <daneNO@SPAM.mk.telcordia.com>
Subject: Re: standard mode for arrow down
Message-Id: <ic1xb78dcq.fsf@home-1.localdomain>
"Xah Lee" <xah@xahlee.org> writes:
> Computing Folks of the industry:
>
> please spread the debunking of the truncating line business of the
> fucking unix-loving fuckheads, as outlines here:
Do you eat with that mouth?
------------------------------
Date: 23 Feb 2005 17:59:24 +0100
From: Pascal Bourguignon <spam@mouse-potato.com>
Subject: Re: standard mode for arrow down
Message-Id: <87acpv5i1f.fsf@thalassa.informatimago.com>
"Xah Lee" <xah@xahlee.org> writes:
> However, as of today, emacs don't really have reason to have arrow-down
> behavior to be dependent on the hard-coded line wraps. I want the next
> emacs version's down-arrow behavior to be fixed. (and optionally as
> another mode to move by EOL.)
Dear Xah,
Did you notice that emacs is highly customizable, and that you can
easily program a command to have the arrow-down behave exactly like
you want? I'd even bet that there's already flowing somewhere on the
net some emacs lisp code to do that.
In anycase, try to program it: it'll prove more pleasurable than
writting these pamphlets...
--
__Pascal Bourguignon__ http://www.informatimago.com/
Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we. -- Georges W. Bush
------------------------------
Date: Wed, 23 Feb 2005 18:27:33 +0100
From: =?iso-8859-1?q?M=E5ns_Rullg=E5rd?= <mru@inprovide.com>
Subject: Re: standard mode for arrow down
Message-Id: <yw1xu0o389ve.fsf@inprovide.com>
Pascal Bourguignon <spam@mouse-potato.com> writes:
> "Xah Lee" <xah@xahlee.org> writes:
>> However, as of today, emacs don't really have reason to have arrow-down
>> behavior to be dependent on the hard-coded line wraps. I want the next
>> emacs version's down-arrow behavior to be fixed. (and optionally as
>> another mode to move by EOL.)
>
> Dear Xah,
>
> Did you notice that emacs is highly customizable, and that you can
> easily program a command to have the arrow-down behave exactly like
> you want? I'd even bet that there's already flowing somewhere on the
> net some emacs lisp code to do that.
picture-mode perhaps
> In anycase, try to program it: it'll prove more pleasurable than
> writting these pamphlets...
... or trolling.
___________________
/| /| | |
||__|| | Please do |
/ O O\__ NOT |
/ \ feed the |
/ \ \ trolls |
/ _ \ \ ______________|
/ |\____\ \ ||
/ | | | |\____/ ||
/ \|_|_|/ \ __||
/ / \ |____| ||
/ | | /| | --|
| | |// |____ --|
* _ | |_|_|_| | \-/
*-- _--\ _ \ // |
/ _ \\ _ // | /
* / \_ /- | - | |
* ___ c_c_c_C/ \C_c_c_c____________
--
Måns Rullgård
mru@inprovide.com
------------------------------
Date: 23 Feb 2005 16:05:48 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Time::Format with two $time strings
Message-Id: <Xns960670E0A7F4Basu1cornelledu@132.236.56.8>
ruud <geen@mail.invalid> wrote in
news:cvi8ps$lk0$1@box.nl-netwerken.com:
> A. Sinan Unur wrote:
>
>> Surely, you are not asking if the following is possible:
>> print "$time{'ddmmyyyy'}\n";
>> print "$time{'ddmmyyyy'}\n";
>
> No, this is one string.
>
> I have two dates, today and a timestamp from a file.
> So i need two different strings in the ddmmyyyy format.
>
> $today{ddmmyyyy};
> $timestamp{ddmmyyyy};
>
> Like that.
$time is a tied hash, so that is not going to work. However, the first
two examples in the documentation of Time::Format show how to do this.
use strict;
use warnings;
use Time::Format;
my $today = time;
my $stamp = $today - 1000000;
print "Stamp: $time{'ddmmyyyy', $stamp}\n";
print "Today: $time{'ddmmyyyy', $today}\n";
__END__
> English is not my native language,
Neither is it mine.
> so it's sometimes hard to explain what i exactly want.
>>> I only see one $ in the doc's...
That was only due to laziness, because it looks like you can express
yourself fine in English.
> Sorry for that.
Apology accepted. Didn't mean to get on your case.
Sinan.
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7820
***************************************