RE: obfuscating code

2013-02-13 Thread Bob McConnell
People have been selling both Open Source and Free Software for years. Both IBM 
and RedHat are doing very well at it. But they don't always require cash or 
monetary profit as their selling price. You might also want to consider this 
article about the open source economic model.

<http://lxer.com/module/newswire/ext_link.php?rid=180777>

bm

> -Original Message-
> From: Octavian Rasnita [mailto:orasn...@gmail.com]
> Sent: Wednesday, February 13, 2013 12:53 PM
> To: Bob McConnell; Perl Beginners
> Subject: Re: obfuscating code
> 
> From: "Bob McConnell" 
> 
> > You cannot obfuscate the input to an interpreter. It has to be in a format
> > that the interpreter will recognize, which necessarily means that people
> > can
> > also read it. If you really need to hide your source code, you have to
> > switch to a compiled language with an actively optimizing compiler.
> 
> 
> I don't think that a Perl programmer can't hide his source code well enough,
> and if he wants to do that, he needs to switch to another language.
> 
> If he created a Windows executable nice packaged in a setup.exe installer
> and wants to sell it for $10 - $20, then hiding the source code might help.
> If he just says that the users should pay $10 for using that program
> provided as source code, somebody who knows a little Perl could pay for it,
> then change the name of the program, eventually do some cosmetic changes
> in
> the source code, package it using ActiveState PDK and sell it as a new
> program that competes with the original one.
> Some may even like to do this to show that they are great programmers and
> that they created an application.
> 
> If getting the source code is complicated enough, than those who may want
> to
> duplicate the program may get bored and abandon the idea.
> 
> Apple, Microsoft, Oracle, IBM, SAP use to sell proprietary applications and
> their financial situation is not too bad. :-)
> I think that if providing everything as open source would have been such a
> good idea from the financial point of view, they would have provided all
> their applications as open source for a long time.
> 
> Octavian


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: obfuscating code

2013-02-12 Thread Bob McConnell
You cannot obfuscate the input to an interpreter. It has to be in a format that 
the interpreter will recognize, which necessarily means that people can also 
read it. If you really need to hide your source code, you have to switch to a 
compiled language with an actively optimizing compiler. Then only distribute 
the output from the compiler. Even then there may be de-compilers or 
disassemblers that can reconstruct much of your source in readable form.

Bob McConnell

> -Original Message-
> From: jbiskofski [mailto:jbiskof...@gmail.com]
> Sent: Tuesday, February 12, 2013 1:30 PM
> To: timothy adigun
> Cc: John SJ Anderson; Perl Beginners
> Subject: Re: obfuscating code
> 
> I see everyone is eager to judge this as a terrible idea, its the exact
> same response Ive gotten to this question on mailing lists on IRC.
> 
> HOWEVER, I think this can be a valid concern. We are always talking about
> how the best way to shine good light on Perl is writing cool stuff in it.
> 
> Well Ive actually gone out a built a company that does a HUGE LMS in Perl,
> its used by over 300K students in Mexico ( www.algebraix.com ), and
> employs
> 18 people. I dont think its stupid of me to worry about someone getting
> into my servers somehow and stealing the code. I have to think of the
> people who work here and their job security, I also have to worry about my
> competitors, I dont know how ethical they are or are not.
> 
> So yeah I think this questions should be given more thought and not just
> discarded as immediate stupidity.
> 
> my $two_cents.
> 
> - Jose Biskofski
> 
> 
> On Tue, Feb 12, 2013 at 12:01 PM, timothy adigun
> <2teezp...@gmail.com>wrote:
> 
> > On 12 Feb 2013 18:56, "John SJ Anderson" 
> wrote:
> > >
> > > >>  On Feb 12, 2013 7:05 PM, "Rajeev Prasad" 
> wrote:
> > > >>> what is the advice just for obfuscating code? platform is solaris.
> > >
> > > I think you're getting the idea, at this point, that this is
> > > considered a bad idea, regardless of what platform you're targeting.
> > >
> > > You may have an actual issue, but unless you explain to us what you
> > > thought you were going to achieve via obfuscating your code, we're not
> > > going to be able to help with that.
> > >
> > > Also, I'm a little disappointed in the "it's Perl, it's already
> > > obfuscated" answers. If you think the Perl you're writing is
> > > pre-obfuscated, you're doing it wrong. My Perl code is idiomatic, easy
> > > to read and understand, and as clear, if not more so, than code
> > > written in any other language. One of the common criticisms of Perl is
> > > that it's a "write-only language". This is, frankly, bullshit -- but
> > > having people on a list aimed at helping Perl beginners promote that
> > > bullshit only makes it more odorous. Please stop.
> >
> > +1 John. I can't agree more.
> > >
> > > thanks,
> > > john.
> > >
> > > --
> > > To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> > > For additional commands, e-mail: beginners-h...@perl.org
> > > http://learn.perl.org/
> > >
> > >
> >

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Line-oriented socket I/O using select()

2013-01-14 Thread Bob McConnell
> From: Vic Sage
> 
> I'm writing a multiplexed TCP-based server that reads "\n"-terminated
> strings from clients and does something with them.  Since this is one process
> with multiple client connections, it uses select() (or, actually, can_read 
> from
> IO::Select) to block until data has arrived from any client.
> 
> It's my understanding that TCP does not preserve "message boundaries."
> That is, if a client writes:
> 
> $sock->autoflush(1);
> print $sock "abel\n";
> print $sock "baker\n";
> print $sock "charlie\n";
> 
> ... there are no guarantees about what will be returned from the server's
> system buffer by sysread() when select() pops.  It could be "a", or "abel\n",
> or "abel\nbak", etc.
> 
> What I *want* is to block until an entire "\n"-terminated string [can that be
> referred to as a "line"?]  can be retrieved from one of my clients.  I'm sure 
> I
> could work out the logic to maintain application-level buffers, but I suspect 
> I
> would merely be reinventing the wheel, one bug at a time :-).   What does
> the experienced Perl programmer - or socket-level programmer in general -
> do in this situation?

TCP is a stream oriented protocol. As you noted it does not make any guarantee 
about fragmenting or appending data because it just doesn't care what it 
transports. It simply guarantees the octets will arrive in the same order they 
were sent. There are no assumptions nor restrictions on what those octets 
represent.

Therefore, Perl cannot do what you asked for either. It is necessary for your 
application to keep track of the message boundaries and manage multiple and/or 
incomplete messages from a single read.

Having dealt with this issue many times over the past 20 years or so, I have 
developed a couple of approaches. The first is a two layer version that reads 
the incoming data from the socket and queues it into a circular buffer. The 
next layer extracts individual messages from the buffer and hands them off to a 
parser, or whatever is needed next. The size of the buffer is dependent on a 
lot of variables which vary by application and protocol. The possibility of 
overflow is too much of a risk in some cases. Another approach is message 
queues where the incoming octets are moved into a buffer until the boundary 
marker arrives. That buffer is sent to a message queue and the next buffer is 
opened. I often use XINU style message queues for this approach. The risk here 
is the possibility of running out of buffers.

There may be other options to simplify this. One popular variation is to 
precede each message with a two byte length value. Normally this will be a 16 
bit integer in network byte order. You read the two bytes, then do another read 
for the number of bytes indicated by them. You still have to manage fragments, 
but no longer need to deal directly with multiples.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




XML::Twig installation fails

2012-10-25 Thread Bob McConnell
Can anyone tell me how to get this module installed on Win7? It is a 
requirement for ODF::lpOD.

I get the following error message:

--
Checking if your kit is complete...
Looks good
Writing Makefile for XML::Twig
malformed JSON string, neither array, object, number, string or atom, at charact
er offset 0 (before "(end of string)") at Makefile.PL line 147.
Warning: No success on command[C:\strawberry\perl\bin\perl.exe Makefile.PL]
  MIROD/XML-Twig-3.41.tar.gz
  C:\strawberry\perl\bin\perl.exe Makefile.PL -- NOT OK
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install
--

This is Strawberry Perl, version information:

--
>perl --version

This is perl, v5.10.1 (*) built for MSWin32-x86-multi-thread

Copyright 1987-2009, Larry Wall

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.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

>ver
Microsoft Windows [Version 6.1.7601]
--

I found descriptions of this problem by searching on Google, but nothing to 
help me resolve it.

Bob McConnell

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of this message is not the intended recipient or an authorized representative 
of the intended recipient, any dissemination of this communication is strictly 
prohibited. If you have received this communication in error, please notify the 
sender immediately by replying to this e-mail message, then delete this message 
and any attachments from your system.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Is comp.lang.perl dead?

2012-10-23 Thread Bob McConnell
From: shawn wilson [mailto:ag4ve...@gmail.com]
> 
> On Tue, Oct 23, 2012 at 1:10 AM, John W. Krahn  wrote:
> > Danny Gratzer wrote:
> >>
> >> I'm looking at comp.lang.perl and it doesn't seem like it's had new posts
> >> in well, years. Is it dead?
> >
> >
> > It died in 1995.
> 
> i thought usenet died in '96? i got a news reader up the other day,
> went through some feeds and haven't opened it sense.

Usenet is alive and very well, even if you chose to ignore the alt.binaries.* 
groups. While the comp.sources.* groups have been superseded by live SCM 
servers and sites like Sourceforge, many of the discussion groups are still 
very active. I am using Astraweb <http://astraweb.com/> which has more than 
four years of retention on most groups. Plans are priced by your choice of 
bandwidth or volume.

Bob McConnell



RE: Learning CPAN

2012-10-05 Thread Bob McConnell
> From: Jim Gibson
> 
> On Oct 4, 2012, at 8:14 PM, Hal Wigoda wrote:
> 
> > Who uses newsgroups anymore?
> 
> I do. There are lots of people still using Usenet.
> 
> > What reader application is the best for reading news groups?
> 
> It depends upon your platform. I use Thoth on a Mac. There are lots of
> choices.
> 

I use Pan on my Slackware Linux workstations. But I believe Thunderbird will 
also manage a news feed.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Using different libraries dynamically

2012-09-13 Thread Bob McConnell
From: Bill Stephenson
> 
> On Sep 12, 2012, at 9:18 AM, Mark Haney wrote:
> > My question is, what IS standard practice for this?
> 
> 
> I use a few different methods. One is to make the changes on the dev box,
> then use BBEdit to "Compare" that to the file used on the live server. BBEdit
> allows me to copy just the lines of code I want to the live file and save it.
> 
> If I have reason to worry that using FTP to save a file might corrupt a users
> experience with the app then I make a copy of the changed file with a new
> name and upload it to the live server and "rename" it the same as the live
> file. I I'm doing this often I make a script and run it on the server:
> 
>   rename("../myCode.pl-new","../myCode.pi") or die("Error 2: $!");
> 
> Now, from what I understand, and I am sure others here will correct me if I
> am wrong, this makes the change on the "Atomic level" and it will not
> interrupt your app.

Just for fun, let me describe our process, which is at the other end of the 
spectrum. Some of our web servers handle credit card transactions, so must 
conform to PCI requirements and pass a monthly audit. As a result, many of 
these procedures are dictated by those requirements. Also, these procedures are 
basically the same for all languages and applications.

All of our code, including test scripts for Selenium and SQL for database 
schemas, is managed by Perforce. When I need to make changes, I first get a 
copy of the code from Perforce, and manually set up the new build directories 
on a server VM in our ESX farm. As I make changes, I only check out the files I 
actually need to edit. Once I have finished my changes, passed all of my 
Selenium test suite and any other tests I believe are necessary, I check the 
changed files and any new test scripts into Perforce.

When the Hudson server notices those updates in Perforce, it does a master 
build, creating an RPM for a new install and one to update an existing site. It 
then installs those files on its test server VM and runs through a number of 
automated tests using Selenium. I am notified of the results via email with 
details available on the Hudson web server.

After the build passes the automated tests, QA uses the build server to 
generate similar RPM modules for their server VM and installs them. They then 
go through a number of functional, integration and fuzz tests on that server. 
When those are completed, they release the build to Production. (Since many of 
our sites are PCI certified, neither Development nor QA have access to the 
production servers.)

Production then generates their own RPM modules and schedules the updates to be 
deployed, both to a client preview server and to the production servers. Each 
client may then review the former and decide if or when to switch their virtual 
domain over to the new build on the production site, which we host for them. 
Every released build is available on each server, and each client has control 
over which build they prefer.

As somebody else mentioned, we go to great lengths to insure that each server 
VM is identical to every other in the chain. Each test server is as near a 
clone of the production server as we can make it. This not only makes the 
automation possible, but it simplifies the build process as well.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Received ezmlm warning

2012-08-28 Thread Bob McConnell
> From: Paul.G
> 
> Sending this as a test message, I received a warning saying that messages to
> me have been bouncing.
> 
> Hopefully, I am still on the mailing list and this is just a glitch.

Paul,

Yes, it is just a glitch. It has been happening to me occasionally for over two 
years now. If you look at the message, it should contain an example of the 
bounce messages the list server has been receiving from your mail server. In my 
case, it appears the list server does not always clean up the routing lines in 
the header, so my server complains that it has been forwarded too many times 
and may be the result of a mail loop. A couple of people have looked at it, but 
have not been able to identify the cause.

Bob McConnell



RE: system command not working in different versions

2012-08-09 Thread Bob McConnell
> From: Shawn H Corey
> 
> On Thu, 9 Aug 2012 15:17:57 +0800 (SGT)
> venki neeli  wrote:
> 
> > What may be the problem? is it with version of perl? or perl module
> > problem?
> 
> It may be a difference in the shell. When there are metacharacters
> present, system uses sh(1) to interpret them. Try this on your
> machines to see if they're the same:
> 
> ls -l `which sh`
> 
> See `perldoc -f system` for details.

My first step would be to log into the problem machine as the same user the 
command runs under, then try to run it manually. The error messages there 
should point you toward the problem. If it runs, then there has to be a 
difference in the environments between your login and the user that actually 
executes the script.

The alternative is to wrap it in a script that sends STDERR output to syslog.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Multiprocessing script

2012-07-26 Thread Bob McConnell
>> From: Rob Coops [mailto:rco...@gmail.com]
>> Sent: Thursday, July 26, 2012 5:26 AM
>> To: beginners@perl.org
>> Subject: Re: Multiprocessing script
>> 
>> On Thu, Jul 26, 2012 at 11:01 AM, Shlomi Fish
>> wrote:
>> 
>> > Hi Punit,
>> >
>> > a few comments on your code.
>> >
>> > On Thu, 26 Jul 2012 10:17:13 +0530
>> > punit jain  wrote:
>> >
> > >
> > > This is what I get output : -
> > >
> > > perl mprocess.pl /tmp/list1
> > > value of Stop Flag in parent mprocess.pl is 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21777 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21778 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > ** te...@test.com just got out of the pool ** with PID 21777 and parent
> > pid
> > > as 21776 exit code: 0
> > > ** te...@test.com just got out of the pool ** with PID 21778 and parent
> > pid
> > > as 21776 exit code: 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21811 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21812 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > ** te...@test.com just got out of the pool ** with PID 21811 and parent
> > pid
> > > as 21776 exit code: 0
> > > ** te...@test.com just got out of the pool ** with PID 21812 and parent
> > pid
> > > as 21776 exit code: 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21832 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21833 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > ** te...@test.com just got out of the pool ** with PID 21832 and parent
> > pid
> > > as 21776 exit code: 0
> > > ** te...@test.com just got out of the pool ** with PID 21833 and parent
> > pid
> > > as 21776 exit code: 0
> > > value of Stop Flag in child 0 is 1
> > > ** te...@test.com started, pid: 22030 **
> > > value of Stop Flag in parent mprocess.pl is 1
> > > stop flag has been set
> > > Waiting for all children to exit
> > > ** te...@test.com just got out of the pool ** with PID 22030 and parent
> > pid
> > > as 21776 exit code: 0
> > > All children completed
> > >
> > > The concern here is I see value of stopflag as 1 for child before the
> > > parent which is a bit wierd:-
> > >
> > > value of Stop Flag in child 0 is 1
> > > ** te...@test.com started, pid: 22030 **
> > > value of Stop Flag in parent mprocess.pl is 1
> > >
> > > Thanks and Regards.
> >
> >
> Though I cannot fault Shlomi on his style advice I don't think this is what
> you where looking for :-)
> Shlomi is quite right to point out the fact that your code looks like it
> was done in a hurry and is certainly not production quality and could do
> with some improvements. The good thing is that Shlomi is besides being a
> stickler for style and good code also a quite good perl coder and I know
> that if he did find fault in your code he would have pointed it out.
> 
> As for me I tend to vary in style and code cleanliness myself depending on
> the goal and the iteration. :-) Your main question is if the code you wrote
> is done well or if it could be done better. Personally I can't see anything
> terribly wrong with it except for the style and total lack of comments
> (these are pointless for you but the next guy that comes along and looks at
> your code will be thankful for the few moments you spend on that).
> Your other question about the order in which the variables change this is
> not to strange, it might actually not be the order in which the variables
> change. The only thing you see is the order in which the output is pushed
> to the buffer it might very well be that process A simply didn't yield yet
> and managed to push its string to the buffer before the other process got
> the chance to do so.
> As long as the code works correctly and the variables change as expected
> (maybe not in the right order in the logs) you should not worry to much
> about the order in which this shows up in the logs.
> 

When you set up multiple processes or threads, Perl no longer has full control 
of their execution. The OS manages the scheduling and size of the time slices. 
It is very common to see race conditions like this where one process 
occasionally jumps ahead of another. Another symptom is split messages where 
one thread inserts its output in the middle of another's. If you need to manage 
the sequence of events between processes, you will need to look at IPC 
(Inter-Process Communications) capabilities of your platform. Semaphores are 
one mechanism that can be used to control the output sequence.

Bob McConnell



RE: Multiprocessing script

2012-07-26 Thread Bob McConnell
>> From: Rob Coops [mailto:rco...@gmail.com]
>> Sent: Thursday, July 26, 2012 5:26 AM
>> To: beginners@perl.org
>> Subject: Re: Multiprocessing script
>> 
>> On Thu, Jul 26, 2012 at 11:01 AM, Shlomi Fish
>> wrote:
>> 
>> > Hi Punit,
>> >
>> > a few comments on your code.
>> >
>> > On Thu, 26 Jul 2012 10:17:13 +0530
>> > punit jain  wrote:
>> >
> > >
> > > This is what I get output : -
> > >
> > > perl mprocess.pl /tmp/list1
> > > value of Stop Flag in parent mprocess.pl is 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21777 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21778 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > ** te...@test.com just got out of the pool ** with PID 21777 and parent
> > pid
> > > as 21776 exit code: 0
> > > ** te...@test.com just got out of the pool ** with PID 21778 and parent
> > pid
> > > as 21776 exit code: 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21811 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21812 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > ** te...@test.com just got out of the pool ** with PID 21811 and parent
> > pid
> > > as 21776 exit code: 0
> > > ** te...@test.com just got out of the pool ** with PID 21812 and parent
> > pid
> > > as 21776 exit code: 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21832 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > value of Stop Flag in child 0 is 0
> > > ** te...@test.com started, pid: 21833 **
> > > value of Stop Flag in parent mprocess.pl is 0
> > > ** te...@test.com just got out of the pool ** with PID 21832 and parent
> > pid
> > > as 21776 exit code: 0
> > > ** te...@test.com just got out of the pool ** with PID 21833 and parent
> > pid
> > > as 21776 exit code: 0
> > > value of Stop Flag in child 0 is 1
> > > ** te...@test.com started, pid: 22030 **
> > > value of Stop Flag in parent mprocess.pl is 1
> > > stop flag has been set
> > > Waiting for all children to exit
> > > ** te...@test.com just got out of the pool ** with PID 22030 and parent
> > pid
> > > as 21776 exit code: 0
> > > All children completed
> > >
> > > The concern here is I see value of stopflag as 1 for child before the
> > > parent which is a bit wierd:-
> > >
> > > value of Stop Flag in child 0 is 1
> > > ** te...@test.com started, pid: 22030 **
> > > value of Stop Flag in parent mprocess.pl is 1
> > >
> > > Thanks and Regards.
> >
> >
> Though I cannot fault Shlomi on his style advice I don't think this is what
> you where looking for :-)
> Shlomi is quite right to point out the fact that your code looks like it
> was done in a hurry and is certainly not production quality and could do
> with some improvements. The good thing is that Shlomi is besides being a
> stickler for style and good code also a quite good perl coder and I know
> that if he did find fault in your code he would have pointed it out.
> 
> As for me I tend to vary in style and code cleanliness myself depending on
> the goal and the iteration. :-) Your main question is if the code you wrote
> is done well or if it could be done better. Personally I can't see anything
> terribly wrong with it except for the style and total lack of comments
> (these are pointless for you but the next guy that comes along and looks at
> your code will be thankful for the few moments you spend on that).
> Your other question about the order in which the variables change this is
> not to strange, it might actually not be the order in which the variables
> change. The only thing you see is the order in which the output is pushed
> to the buffer it might very well be that process A simply didn't yield yet
> and managed to push its string to the buffer before the other process got
> the chance to do so.
> As long as the code works correctly and the variables change as expected
> (maybe not in the right order in the logs) you should not worry to much
> about the order in which this shows up in the logs.
> 

When you set up multiple processes or threads, Perl no longer has full control 
of their execution. The OS manages the scheduling and size of the time slices. 
It is very common to see race conditions like this where one process 
occasionally jumps ahead of another. Another symptom is split messages where 
one thread inserts its output in the middle of another's. If you need to manage 
the sequence of events between processes, you will need to look at IPC 
(Inter-Process Communications) capabilities of your platform. Semaphores are 
one mechanism that can be used to control the output sequence.

Bob McConnell



RE: How to create a user manual window

2012-06-12 Thread Bob McConnell
> From: Paul Johnson
> 
> On Tue, Jun 12, 2012 at 07:11:57PM +0300, Shlomi Fish wrote:
> 
> > OK. For Windows there is now http://dwimperl.com/ which is open-source
> and is
> > considered better than Activestate Perl.
> 
> [citation needed]

I don't know about DWIMPerl itself, but it claims to be based on Strawberry, 
which I do use. The biggest advantage Strawberry has over ActiveState is the 
direct use of CPAN and all available modules there. It is not limited to the 
adulterated and incomplete collection provided by ActiveState.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Raspberry Pi for Beginners (and developers ;)

2012-06-04 Thread Bob McConnell
> From: Bill Stephenson
> 
> :)
> 
> No, there's no sales pitch... The Raspberry Pi is a legit project, nonprofit 
> and
> meant for educational purposes.
> 
> But that doesn't mean we can't buy and sell them for commercial purposes.
> That helps them too. They need volume to keep cost down, and they need
> community involvement to add value to the project, for which the goal is to
> get kids involved in programming again, like they were in the early days of
> computing.
> 
> On Jun 2, 2012, at 12:10 PM, Omega -1911 wrote:
> 
> > Sales pitch? :)

Just don't hold your breath waiting for one. Other estimates suggest there are 
350,000 people already waiting on orders, pre-orders and other waiting lists. 
It will take a while to clear up that backlog. It is a remarkable device for 
the price. The closest product I have actually worked with was the Digi 
ConnectME. That was very useful as a network appliance, but at US$47 in small 
quantities, it only had one each Ethernet and serial ports.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: how to display commands while perl script executing

2012-05-15 Thread Bob McConnell
> From: Sunita.Pradhan
> 
> I want to print the command during script execution .
> Example :
> 
> 
> ===
> $ls = `ls`;
> 
> Print "$ls\n";
> ==
> 
> In the above script I want to print "ls" command before 'ls' command gets
> executed . Like  "set -x" does  in  shell scripts .
> 
> Could you please help me on this ?

Are you looking for a Perl script, or just a shell script? Using Perl for this 
appears to be like using a baseball bat to swat a fly. But here in a Perl 
mailing list, you are going to get Perl scripts. If that is not what you are 
looking for, you need to find a mailing list for your particular shell, which 
you didn't name.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: PERL CGI, HTML and PHP

2012-04-26 Thread Bob McConnell
> From: Mark Haney
> 
> I understand the desire to 'keep with one scripting language', but what
> I don't understand is why take a stand like that, yet continue to use
> javascript with PHP and ASP pages.  Seems to me, that in the right
> instance combining the two can be very powerful.  Personally, I've found
> the flexibility in report manipulation of perl to be better than
> anything else I've used, so I plan on keeping it for reports and using
> PHP for the front end/UI stuff.

This exposes the source of your confusion. Javascript is executed in the 
browser, while Perl, PHP, ASP and JSP are all executed on the server. So JS 
simply complements all of the others. The biggest issue is that you cannot 
depend on JS being allowed on the client. It is seen by many as a security 
problem, a very reasonable view, so it will be disabled either globally or by 
using NoScript or similar add-ons. As a result, it should never be used to 
enable critical elements of a web page, but only to enhance the presentation.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: MIME::Lite Return-Path not being set

2012-04-25 Thread Bob McConnell
> From: sono-io
> 
> > According to the RFC's, "Return-path" is reserved for use by the transport
> servers. It is likely your server is stripping out the suggestion you have 
> put in
> there.
> 
>   But I can set it using SMTP, so does sendmail handle things
> differently?  Unfortunately, my ISP is useless on this issue. =:\  I'm hoping
> someone here knows enough about these things to point me in the right
> direction.
> 
> > It is also very likely that the bounce messages you expect are not being
> sent, due to the long term SPAM epidemic we have been experiencing. Most
> mail servers have that feature turned off now.
> 
>   Well, I may not get all bounces sent back, but if I could change the
> Return-Path, then at least I'd get some of them which is better than nothing.

I would be surprised if you get any bounce messages at all. At this point in 
time, any server that is sending them may be considered to be misconfigured and 
might even get shunned by other administrators.

But you are in the wrong mailing list to be asking about how mail servers work. 
The RFCs are not very clear on what "Return-path" is supposed to contain, so it 
is likely dependent on the software used in each server. I am not very familiar 
with them, but I suspect even sendmail and postfix will differ in how they 
handle that header. From my own reading it appears it should parallel the 
"Received" chain with a path for each relay point, but I'm not a server admin, 
so I can't be sure of that.

Good luck,

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: MIME::Lite Return-Path not being set

2012-04-24 Thread Bob McConnell
> From: sono-io
> 
>   Unfortunately, I can't switch to SMTP right now (long story) and so I
> need to find a way to get Mime::Lite to send the Return-Path.  Does anyone
> know how to do this?
> 
>   If Mime::Lite can't do it, does anyone have another module they can
> recommend?
> 
>   The reason I need to do this is that either sendmail or our server is
> setting the Return-Path to some generic address and so we're not receiving
> any e-mails that get bounced back to us.

According to the RFC's, "Return-path" is reserved for use by the transport 
servers. It is likely your server is stripping out the suggestion you have put 
in there. 

It is also very likely that the bounce messages you expect are not being sent, 
due to the long term SPAM epidemic we have been experiencing. Most mail servers 
have that feature turned off now.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: WWW::Selenium click not working - CPAN install problem

2012-04-05 Thread Bob McConnell
> From: Gary Stainburn

It has been a while since I last worked with Selenium, but when I installed Se1 
I found the PM file on CPAN was not being kept up to date. I had to replace it 
with a newer version from the Selenium download site. In the time I spent 
working with it, I got the distinct impression that all of the Perl developers 
had left that project, and nobody still working on it was interested in keeping 
the Perl drivers up to date. I never saw any indication there would be Perl 
drivers bundled with Se2.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Solved(?) Re: IO:Socket - receiving data

2011-10-26 Thread Bob McConnell
> From: Gary
> 
> Bob McConnell wrote:
> >> From: Gary
> 
> >> For the record, this is what I did to get around the problem:
> >>
> >> ,[ code ]
> >> | my $s = IO::Select->new($self->{_sock}); while (my @ready =
> >> | $s->can_read(1)) {
> >> | my $recd = RECV_BUF_SIZE;
> >> |
> >> | while ($recd == RECV_BUF_SIZE) {
> >> | my $buf = '';
> >> |
> >> | $self->{_sock}->recv($buf, RECV_BUF_SIZE, MSG_WAITALL);
> >> |
> >> | $recd = length($buf);
> >> | $ret .= $buf;
> >> | }
> >> | }
> >> `
> >> Note the added 'while' loop around the recv loop.
> 
> > Ok, this will append all of the full buffers and the first partial
> > buffer into a single string ($ret). If you are going to handle
> > multiple passes, make sure $ret is empty each time you enter the
loop.
> > It probably should be declared and initialized to an empty string
anyway.
> >
> >my $ret = "";
> 
> It is. I left this out of the update (and changed the variable names
between
> the two versions, besides), so it's not so surprising you didn't see
that.
> 
> > Is there anything constant about your incoming messages? Are they
all
> > the same length, or is there a delimiter at the end you can test
for?
> 
> No, and yes. I could check for "" at the end I guess, but...
> ewww...  That layer should know SFA about what's coming through.

At some level you will need to look for that closing tag and be prepared
to handle both exception cases, a truncated message or parts of one or
more additional messages appended after that closing tag. This is the
streams nature of TCP, there is no way to avoid it.

In the case of the truncated or empty message being returned, you should
also find out if it was caused by the remote end closing the connection
or a network failure. Both require you to close the socket and try
again. But after the retry fails, the recovery procedures are very
different.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Solved(?) Re: IO:Socket - receiving data

2011-10-25 Thread Bob McConnell
> From: Gary
> 
> I wrote:
> 
> > After sending a request to a server [...] I get some part of the
data
> > back that I requested, and then only some time later, after my code
> > thinks it's got everything, has continued and is trying to receive
> > returned data from a subsequent request, does it get the missing
part
> > of the first set of data.
> 
> For the record, this is what I did to get around the problem:
> 
> ,[ code ]
> | my $s = IO::Select->new($self->{_sock}); while (my @ready =
> | $s->can_read(1)) {
> | my $recd = RECV_BUF_SIZE;
> |
> | while ($recd == RECV_BUF_SIZE) {
> | my $buf = '';
> |
> | $self->{_sock}->recv($buf, RECV_BUF_SIZE, MSG_WAITALL);
> |
> | $recd = length($buf);
> | $ret .= $buf;
> | }
> | }
> `
> Note the added 'while' loop around the recv loop.
> 
> I can only say "it seems to work". I'm not really au fait enough with
this to say
> that it's a solution.

Ok, this will append all of the full buffers and the first partial
buffer into a single string ($ret). If you are going to handle multiple
passes, make sure $ret is empty each time you enter the loop. It
probably should be declared and initialized to an empty string anyway.

   my $ret = "";

Is there anything constant about your incoming messages? Are they all
the same length, or is there a delimiter at the end you can test for? If
the length is constant, I would change the loop test to (length($ret) <
SIZE) instead of just waiting for a partial buffer.

If you do get to handle multiple messages without a significant delay
between them, this code also might produce two messages in $ret, or part
of a second appended to the first.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: IO:Socket - receiving data

2011-10-24 Thread Bob McConnell
> From: Rob Dixon [mailto:rob.di...@gmx.com]
> 
> On 24/10/2011 13:14, Gary wrote:
> >
> > Effectively what happens is that I get a decent chunk of data the
> > first few times around the loop, all of RECV_BUF_SIZE (512) length,
> > then a final 44 bytes, and the code thinks it's done. Then when the
> > code executes again with another command, the recv loop gets the
final
> > few
> > 512 byte chunks it should have got before.
> >
> > Is there a decent set of documentation for how to use IO:Socket
> > anywhere? Can anyone see what I'm doing wrong? (Probably I shouldn't
> > be using send/recv, but without any hints from the documentation...)
> 
> It sounds to me like your sender isn't flushing its output at the end
of each
> chunk? Because you're getting a short final buffer it seems pretty
certain that
> taht is all that's been sent.

There are a couple of things you need to keep in mind about TCP/IP. It
is a stream based protocol. It guarantees that all of the bytes you send
will reach the other end in the same order or you will get an error. But
it makes no guarantees about delivery time or how those bytes will be
grouped together. If there is any structure to the data, it is up to
your application to parse the data so that it fits your structure. You
need to make sure you have received just enough data to fill that
structure once. If you don't have enough you have to wait for more. If
you have too many, you need to hold on to the extra to start the next
element.

If you want a read() to return exactly as many bytes as the matching
write() sent, you need UDP. But then you give up the delivery guarantee.

Bob McConnell


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: John SJ Anderson is Perl Beginners list moderator

2011-10-06 Thread Bob McConnell
Lookout is another. I have to manually edit each line to turn this into
a bottom post. They totally dropped the Usenet style reply option in the
Office 2003 release.

Bob McConnell

-Original Message-
From: Zachary Zebrowski [mailto:zak.zebrow...@gmail.com] 
Sent: Thursday, October 06, 2011 11:38 AM
To: John SJ Anderson
Cc: Perl Beginners
Subject: Re: John SJ Anderson is Perl Beginners list moderator

++  some mail clients (eg. Gmail) make it very hard to bottom post.
Thanks
for not excluding me. :)
On Oct 6, 2011 11:28 AM, "John SJ Anderson" 
wrote:
> On Fri, Sep 30, 2011 at 18:51, Octavian Rasnita 
wrote:
>
>> I would like to put a question. Is top-posting accepted on the list?
>
> I've thought about this for a while, and I think I've finally got
> something that should make everybody about equally annoyed. (There is
> no solution to this problem that will please everybody, or even please
> a sizable majority. It is the "toilet paper over or under?" of the
> mailing list world.)
>
> Let me preface this by saying that my personal preference is for
> bottom-posting. I cut my teeth on Usenet and large mailing lists and
> bottom-posting *with editting* seems like a sensible way to
> communicate to me. That said, I've also made my peace with shifting
> into "top-posting mode" when I'm dealing with people who don't have my
> preferences or experiences.
>
> So (and I will include a version of this in a "list culture" section
> that I will be adding to the FAQ):
>
> * We prefer bottom-posting but we will tolerate top posters.
> * We may *politely* _ask_ people to bottom-post.
> * We will not demand or order people to bottom-post.
> * We are free to not reply to people who top-post, or to otherwise
ignore
them.
>
> (Aside from the "don't demand/order top-posting", I think this is a
> fair synopsis of current list behavior, which was a large factor in
> this decision.)
>
> Thanks for raising the issue, Octavian.
>
> chrs,
> john.
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Validating input

2011-10-04 Thread Bob McConnell
From: shawn wilson

> On Oct 3, 2011 8:48 AM, "Bob McConnell"  wrote:
>>
>> From: shawn wilson
>>
>> > On Sun, Oct 2, 2011 at 02:32, Shlomi Fish 
wrote:
>> >> On Sun, 2 Oct 2011 00:07:34 +0300
>> >> "Octavian Rasnita"  wrote:
>> >>
>> >>> Hi,
>> >>>
>> >>> Does anyone have some suggestions for what restrictions should be
used
on a site to be secure?
>> >>> Do you know some sites where I can get information about this
subject?
>> >>> Most of the text I read said that the variables should be
filtered
before inserting them in DB, but never gave details for what should be
filtered.
>> >>>
>> >>
>> >> Well, the SQL injections that you mention are one vector of attack
against
>> >> web-sites, but are not the only one. See:
>> >>
>> >> * http://shlomif-tech.livejournal.com/35301.html - my post about
Code/Markup
>> >>  injection and its prevention.
>> >>
>> >> * http://en.wikipedia.org/wiki/Cross-site_scripting
>> >>
>> >> * http://en.wikipedia.org/wiki/Cross-site_request_forgery
>> >>
>> >
>> > since we're on web security, my favorite general purpose reading
is:
>> > http://code.google.com/p/browsersec/wiki/Main
>> >
>> > also this (which iirc, some browsers don't or google say are
dangerous
>> > - there doesn't seem to be any script running on this page -
cursory
>> > look):
>> > http://ha.ckers.org/xss.html
>> >
>>
>> For general guidelines and tools, take a look at the OWASP Projects
at
> <http://www.owasp.org/>.
>>
> 
> Good point. I always assume that everyone has heard of the top 10 and
the
> like so forget to put it out there.
> 
> But, I'll just say, if you think about what you're doing and know a
little
> about security you'll be in the upper 50%. If you run scans, you'll be
in
> the upper 25%. After that it gets hard. However the point is that its
not
> hard to rise above the lowest hanging fruit (which isn't saying much
for the
> state of ecommerse in general but is good for keeping inexperienced
> programmers with a little knowledge out of the ruffage).

This is exactly why I never assume anyone has read the OWASP top ten.
But even if they have, a reminder to review them once in a while isn't
going to hurt. We go a few steps further. Some of our sites process
credit cards and some of our applications need to be certified for PCI
PA-DSS. So all development and QA teams had to attend training courses
in security and get a refresher class at least once a year.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Validating input

2011-10-03 Thread Bob McConnell
From: shawn wilson

> On Sun, Oct 2, 2011 at 02:32, Shlomi Fish  wrote:
>> On Sun, 2 Oct 2011 00:07:34 +0300
>> "Octavian Rasnita"  wrote:
>>
>>> Hi,
>>>
>>> Does anyone have some suggestions for what restrictions should be used on a 
>>> site to be secure?
>>> Do you know some sites where I can get information about this subject?
>>> Most of the text I read said that the variables should be filtered before 
>>> inserting them in DB, but never gave details for what should be filtered.
>>>
>>
>> Well, the SQL injections that you mention are one vector of attack against
>> web-sites, but are not the only one. See:
>>
>> * http://shlomif-tech.livejournal.com/35301.html - my post about Code/Markup
>>  injection and its prevention.
>>
>> * http://en.wikipedia.org/wiki/Cross-site_scripting
>>
>> * http://en.wikipedia.org/wiki/Cross-site_request_forgery
>>
> 
> since we're on web security, my favorite general purpose reading is:
> http://code.google.com/p/browsersec/wiki/Main
> 
> also this (which iirc, some browsers don't or google say are dangerous
> - there doesn't seem to be any script running on this page - cursory
> look):
> http://ha.ckers.org/xss.html
> 

For general guidelines and tools, take a look at the OWASP Projects at 
<http://www.owasp.org/>.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Socket6 won't install

2011-08-24 Thread Bob McConnell
From: Sisyphus
> From: "Bob McConnell"
> 
>>I am using Strawberry on WinXP. I need to test some IPv6 connectivity
>> but can't get Socket6 to install. It all boils down to two errors
during
>> the compile stage.
>> 
>> Socket6.o:Socket6.c:(.text+0xa47): undefined reference to `inet_pton'
>> Socket6.o:Socket6.c:(.text+0xd11): undefined reference to `inet_ntop'
>> collect2: ld returned 1 exit status
>> 
>> How do I resolve this problem?
> 
> Applying this patch to Socket6.xs should fix the problem:
> 
> ###
> --- Socket6.xs_orig Mon Dec 13 21:33:48 2010
> +++ Socket6.xs Mon Dec 13 21:40:56 2010
> @@ -101,6 +101,11 @@
>  #define HAVE_INET_PTON  1
>  #endif
> 
> +#ifdef __MINGW32__
> +#include "inet_ntop.c"
> +#include "inet_pton.c"
> +#endif
> +
>  #ifndef HAVE_PL_SV_UNDEF
>  #define PL_sv_undef  sv_undef
>  #endif
> 
> ######
> 
> (Worked for me.)
> 

How do I insert that in the middle of an install? CPAN is downloading a
fresh copy of the source each time it runs.

Thanks,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Socket6 won't install

2011-08-23 Thread Bob McConnell
I am using Strawberry on WinXP. I need to test some IPv6 connectivity
but can't get Socket6 to install. It all boils down to two errors during
the compile stage.

Socket6.o:Socket6.c:(.text+0xa47): undefined reference to `inet_pton'
Socket6.o:Socket6.c:(.text+0xd11): undefined reference to `inet_ntop'
collect2: ld returned 1 exit status

How do I resolve this problem?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: XAMPP

2011-08-04 Thread Bob McConnell
From: Chris Stinemetz

> I'm thinking about testdriveing XAMPP. Does anyone have any opinions
> on the product? Good or bad?

My first reaction is to suggest you replace that toy database with
something that is actually enterprise ready. But you may not need to do
that depending on your application.

We gave up on MySQL several years ago when they instituted their per
server license fee structure. It played havoc with pricing for a couple
of distributed systems we were writing proposals on. Now that we are
handling half a million transactions per month through Postgres, we have
no reason to look back.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: substring first 100 words from a string in perl

2011-07-29 Thread Bob McConnell
My first impression was that he wanted the first hundred characters
rounded off to the previous or next full word. It sounded like he wanted
smart line breads at the word boundaries.

Bob McConnell

From: timothy adigun

>  I get the point you are making here, if you check the subroutine "sub
> checkStr{}" you see dat it confirm what you are pointing out. However,
I
> think the point there is the number of words the programmers wants!
[Khabza,
> correct me if am wrong].
> Since, split function as indicated will remove the space and just
count
> words then, the string indicated in the original mail will be 21 not
100!
> Maybe like you said it all depends on what Khabza means as "word" - a
single
> alphabeth or a collection of alphabeth to make words!
> For me, in context of the original mail I think Khabza wants words but
> counted in alphabeths!
> lol!
> 
> On Thu, Jul 28, 2011 at 8:05 PM, Rob Dixon  wrote:
> 
>> On 28/07/2011 14:23, Khabza Mkhize wrote:
>>
>>>
>>> I want to substring words, I might be using wrong terminology. But I
tried
>>> the following example the only problem I have it cut word any where
it
>>> likes. eg  "breathtaking" on my string is only bre.
>>>
>>>   $string = "This is an awe-inspiring tour to the towering
headland
>>> known as Cape Point. Magnificent beaches, breathtaking views,
historic and
>>> picturesque coastal ";
>>>
>>>  $rtioverview = substr ( $string ,  0 , 100 );
>>>
>>>  Reults = "This is an awe-inspiring tour to the towering
headland
>>> known
>>> as Cape Point. Magnificent beaches, bre";
>>>
>>>  any one can help to solve this problem please?
>>
>> It depends what you mean by a 'word'. The 'split' operator will split
a
>> string on whitespace, but on that basis there are only twenty words
in
>> your sample string. Take a look at the program below. If it doesn't
help
>> you then please could you give an example showing what result you
would
>> expect from this data?
>>
>>
>> use strict;
>> use warnings;
>>
>> my $string = "This is an awe-inspiring tour to the towering headland
>>
>> known as Cape Point. Magnificent beaches, breathtaking views,
historic and
>> picturesque coastal ";
>>
>> my @words = split ' ', $string;
>>
>> print scalar @words, " words:\n";
>>
>> for my $i (0 .. $#words) {
>>  printf "%3d: %s\n", $i, $words[$i];
>> }
>>
>> **OUTPUT**
>>
>> 21 words:
>>  0: This
>>  1: is
>>  2: an
>>  3: awe-inspiring
>>  4: tour
>>  5: to
>>  6: the
>>  7: towering
>>  8: headland
>>  9: known
>>  10: as
>>  11: Cape
>>  12: Point.
>>  13: Magnificent
>>  14: beaches,
>>  15: breathtaking
>>  16: views,
>>  17: historic
>>  18: and
>>  19: picturesque
>>  20: coastal

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: url checker load average opensource s/w

2011-07-21 Thread Bob McConnell
From: Agnello George

> i have a few web portals  as my job profile to take care of  and i
> have a request from my testing team for a s/w where i can 1) check
> all links within the website  and the time taken for each link to load
> , 2) and if 500 to 1000 concurrent connections are spawned the average
> time for each link to load .
> 
> Is there a opensource or paid  s/w currently available to do this
.
> 
> I had tried ab testing , but it doesnt actually load the page it jsut
> gives a 200 ok .
> 
> Or is there some thing i can write in perl ( if perl could you suggest
> a possible module(s) )

There are some tools that work with Selenium <http://seleniumhq.org/>
that will measure the load time. I have not used that feature
specifically, but have used Selenium along with Test::Harness to do
functional tests on web sites. There is also an older Perl driver for
Selenium 1.0 in CPAN. But I replaced that with the newer module from
their own package. Unfortunately, it appears there are no Perl
programmers still working on the Selenium project. There is a separate
group working on a Selenium 2.0 driver.

Some reference material:
<http://www.santaclarahightech.org/teacher/selenium-rc/>
<http://quicksilver1183.com/2010/09/07/setting-up-selenium-with-perl/>
<http://testingwithperl.blogspot.com/2008/03/using-selenium-for-testing.
html#driver>
<http://wiki.openqa.org/display/SRC/Selenium+RC+and+Perl>
<https://github.com/aivaturi/Selenium-Remote-Driver>

Bob McConnell

Disclaimer: The OpenQA wiki page is a subset of one I wrote for my
employer's internal wiki.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Verifying an e-mail address

2011-06-27 Thread Bob McConnell
From: sono...@fannullone.us

> On Jun 27, 2011, at 12:20 PM, Wagner, David wrote:
> 
> > Unless you make it a two step process: 1)   Send email and
individual has to reply or click an url, I don't believe you can know if
the account is active, etc WITOUT the sending. 
> 
>   I can see how that would work fine for a forum, but this will be
for a shopping cart.  I know that there isn't a perfect solution - all I
want would be to try to prevent someone from entering a blatantly wrong
address.  The other day, I had someone enter an address like
sally...@yahoo.com.  This morning, when I e-mailed her directly, it
bounced back immediately as user unknown which means she didn't get her
e-mail from the cart and I wasn't aware of that until now.
> 
>   It seems that all I'd need would be to check 1) if the domain is
good and 2) whether or not the user has an account on that domain.
> 
>   I'll be checking out Email::Valid and Email::Verify::SMTP to see
if either of these might prevent that type of scenario from happening
again.

The problem with this is that, due to the spam plague, most servers will
no longer tell you if an address is valid. Many do not even return a
bounce message, but silently discard any and all mail for unknown
addresses. Spam traps can also produce false positives, dumping your
mail into a quarantine folder, or the bit bucket. The only time you know
an address is valid is if you receive an actual response from the user.
Even then I would be worried that it could be a 'bot responding to you.

Email should no longer be considered a reliable basis to make financial
decisions.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Re : Re: Re : Re: Re : Re: Check if words are in uppercase?

2011-06-21 Thread Bob McConnell
From: Paul Johnson

> On Tue, Jun 21, 2011 at 05:57:22AM -0700, Beware wrote:
> 
> > Hi to all,
>> 
>> First of all, sorry for the late of my answer.
>> Thank for all your sentence.
>> 
>> Here's my solution (for now) :
>> 
>> for my $w (@keywords)
>>   {
>>  if ( /\b$w\b/ and !/\buc($w)\b/ )
>>  {
>> print "Keyword '$w' not uppercase line $.\n";
>> ajoute_erreur( 7, $. );
>> last;
>>  }
>>   }
>> 
>> It's probably less fast than other ones, but it seems to work.
> 
> I'm afraid you may need to improve your testing skills.
> 
> I assume your keywords are in lower case.  What happens with mixed case?  You
> would need /i on your first //

You need to be a little more careful about those assumptions. He is looking for 
all keywords that are not in UPPERCASE.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: regexp validation (arbitrary code execution) (regexp injection)

2011-06-02 Thread Bob McConnell
From: Stanislaw Findeisen

> Suppose you have a collection of books, and want to provide your users
> with the ability to search the book title, author or content using
> regular expressions.
> 
> But you don't want to let them execute any code.
> 
> How would you validate/compile/evaluate the user provided regex so as
to
> provide maximum flexibility and prevent code execution?

You want them to run an application without having to run an
application? That doesn't make any sense.

You have several options available to give your users access to a
database.

1. Write a client application or applet they can copy or install on
their workstation to access the database directly.

2. Write a simpler application or applet that accesses a non-DB server
which in turn access the database.

3. Create a site on a web server they can access with a browser, which
then accesses the database.

There are any number of variations on these themes, but in each case,
they have to run some application code somewhere in order to access the
data.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Alternative to goto

2011-04-15 Thread Bob McConnell
From: Uri Guttman

>>>>>> "SF" == Shlomi Fish  writes:
> 
>  SF> I should note that in C "continue", "break", and a pre-mature
>  SF> "return" may also be considered as pseudo-gotos.
> 
> huh? same as perl then.
> 

I was going to stay out of this, but here I think I want to challenge
this assertion. Those three statements are controlled, and will
implicitly maintain the block that contains them. Moreover, the "return"
will manage exiting the block and subroutine and marshals the context
changes that implies. But "goto" is uncontrolled and ignores that
context, leaving the stack and related structures in an unknown state.
This is what makes it so dangerous. It can also be used to jump into a
code block without correctly initializing its structures, creating a
even bigger mess.

This is from my perspective as a long time Assembler and C programmer.
Is it any different in Perl?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: how do make certain that no input (keyboard + mouse paste) is outside of 7-bit ASCII in a perl script?

2011-02-02 Thread Bob McConnell
From: John Delacour

> At 17:08 -0800 01/02/2011, Kenneth Wolcott wrote:
> 
>>how do make certain that no input (keyboard + mouse paste) is outside
>>of 7-bit ASCII in a perl script?
> 
> The regular expression means that from the beginning to the end of 
> the (chomped) input is either nothing or a string containing only 
> characters 32 to 126.
> 
> 
> #!/usr/local/bin/perl
> use strict;
> print "Type something (type 'q' to exit) -> ";
> while (){
>chomp;
>print "Bye!" and last if /^q$/i;
>if ( /^[\040-\176]*$/  ){ # all from space to tilde
>  print "OK. '$_' is all us-ascii\n-> "
>} else {
>  print "Can't accept '$_' ; " .
>  "contains non us-ascii characters\n-> "
>}
> }

Your limited range is going to choke on the tab key.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: How to avoid Out of Memory Errors when dealing with a large XML file?

2011-01-11 Thread Bob McConnell
From: Saqib Ali

> I'm reading a large (57 MB) XML file Using XML::XPath::XMLParser()
> 
> I keep getting this error:
> 
> "Callback called exit at XML/XPath/Node/Element.pm at line 144 during
> global destruction."
> 
> I'm using Windows XP. So I watched the task-management memory meter
> during the execution of this process. The PERL process chewed up a lot
> of the "available memory". But when the process died, it still showed
> about 216MB available memory.
> 
> Is there anything I can do to work-around this problem? From reading
> responses to other similar questions, the only option may be to use a
> XML stream parser instead of one that builds the entire DOM tree
> internally.

This sounds like you are running on a 32-bit OS. There is a fixed limit
to how much memory each process can use, no matter how much RAM and swap
space you have available. So the other option is to switch to a 64-bit
system.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: 1st line of perl script

2011-01-10 Thread Bob McConnell
And I repeat, it doesn't. Windows looks up the association you defined
and then goes through the %PATH% in your environment looking for the
first perl.exe it can find. It doesn't even read the file, but passes it
as a parameter to perl.exe. At that point, it is up to the Perl
interpreter to decide what to do with that first line.

Bob McConnell

-Original Message-
From: Shawn H Corey [mailto:shawnhco...@gmail.com] 
Sent: Monday, January 10, 2011 11:08 AM
To: beginners@perl.org
Subject: Re: 1st line of perl script

On 11-01-10 10:57 AM, Sunita Rani Pradhan wrote:
> Yes I agree . Then I am coming back to my 1st question . This path
does not exist on windows "/usr/bin/perl " , how it works ?

It doesn't.  At least, it doesn't if you start the script from Windows. 
  What Windows does is look up the extension, *.pl, in the Registry and 
launch the program associated with it.  When it starts, perl will check 
the first line for any switches (options in UNIX talk) and sets them.

However, some web servers read the the shebang line and executes what it

says.  So, you should change any Perl CGIs to point to the perl program.


-- 
Just my 0.0002 million dollars worth,
   Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: 1st line of perl script

2011-01-10 Thread Bob McConnell
It doesn't, the line starts with a '#' so it is ignored. You have to tell 
MS-Windows to associate .pl files with perl.exe. Then the OS does what #! was 
supposed to. But it will always use the same copy of perl.exe, so you don't get 
the ability to use different releases for different scripts.

Bob McConnell

-Original Message-
From: Sunita Rani Pradhan [mailto:sunita.prad...@altair.com] 
Sent: Monday, January 10, 2011 10:58 AM
To: Brandon McCaig; Shawn H Corey
Cc: beginners@perl.org
Subject: RE: 1st line of perl script

Yes I agree . Then I am coming back to my 1st question . This path does not 
exist on windows "/usr/bin/perl " , how it works ?


Thanks
Sunita

-Original Message-
From: Brandon McCaig [mailto:bamcc...@gmail.com] 
Sent: Monday, January 10, 2011 9:14 PM
To: Shawn H Corey
Cc: beginners@perl.org
Subject: Re: 1st line of perl script

On Mon, Jan 10, 2011 at 10:32 AM, Shawn H Corey  wrote:
> I do believe so but if you `use warnings;` you can turn it off.  You can't
> do that with -w.

I just tested with Strawberry Perl v5.12.1 in Windows XP with the
following code:

#!/usr/bin/perl -w

my @a;
my $b = @a[0];

__END__

When run, I get:

Scalar value @a[0] better written as $a[0] at test.pl line 4.

So yes, it does seem to work, but I think that 'use warnings;' is best
practice anyway, as Shawn pointed out.

-- 
Brandon McCaig <http://www.bamccaig.com> 
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> 

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Real life usage

2010-12-20 Thread Bob McConnell
From: Francesco Di Lorenzo

> This message is particularly referred to serious programmer
> (with serious I mean the ones who do programming for work).
> The question is this:
> What role do Perl have in your work? In which particular
> projects you use it? Do you use it for particular piece of
> your softwares' source code or you use it as your main
> programming language?

I use Perl as a utility language. There are three basic groups of
applications where I find it very useful.

1. Emulating clusters of cash registers. We support various registers
with both serial and TCP/IP interfaces. Most of them use simple
structured messages for transactions and responses, so it is easy enough
to write a Perl script that will open a connection, then send and
receive messages over it. I can create an emulation that looks like
dozens of registers are in use, when we only have one or two available.

2. Generating test data. I can easily create any number of randomized
transaction records for the emulation scripts, and for other uses. CSV
files, or other structured data can be created in any quantity. These
files are then passed to import functions for various applications. The
files can be saved to be rerun as regression tests, or discarded and
regenerated on demand. Last year we grabbed a copy of the first and last
name files from the US Census Bureau. We often take random names from
each to insert into a database for testing reports.

3. Selenium tests for web sites. I have been building a suite of
functional tests using Perl with the Test Harness to run Selenium RC to
test some of our web sites. Each script is initially written as a
functional test, then added into the full suite which is evolving into a
thorough regression test. Some of these scripts are also part of the
Hudson build for one product. If those tests fail, the build fails.

I have also been looking into using Perl with DBI/DBD to initialize and
validate test databases for several products. The idea is to set up the
necessary tables and insert the initial data. After the test sequence is
run, verify the final state of the data.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No Output in Terminal

2010-10-04 Thread Bob McConnell
From: Brandon McCaig

> On Fri, Oct 1, 2010 at 8:26 AM, Bob McConnell  wrote:
>> AKA carriage return, it suggests you have DOS/Windows line endings
>> instead of Unix. You can clean them up in the source files with the
>> dos2unix or tr filters. The latter looks something like this:
>>
>> $> tr "\r\n" "\n" < bad.pl > good.pl
> 
> It suggests to me that he has Mac (<=9) carriage returns (\r or 0x0D)
> only. As far as I can tell, that Perl one-liner he was asked to run
> should have printed all characters < decimal 31 and greater than
> decimal 126, of which the 10 or CF in the DOS/Windows newline should
> have been printed as well. It shouldn't be too difficult to write an
> equivalent tr for mac2unix though to compensate.

$> tr "\r" "\n" < bad.pl > good.pl

You can also combine them to do either/or. The first pair takes
priority, but the second pair will pick up any left over carriage
returns and turn them into extra line feeds.

$> tr "\r\n" "\n" "\r" "\n" < bad.pl > good.pl

> 
> (I reserve the right to be completely wrong)

Sorry, you can't have that. It already belongs to me. B^)

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No Output in Terminal

2010-10-04 Thread Bob McConnell
From: Shlomi Fish

> On Monday 04 October 2010 14:45:57 Bob McConnell wrote:
>> From: Brandon McCaig
>> 
>> > On Fri, Oct 1, 2010 at 8:26 AM, Bob McConnell 
wrote:
>> >> AKA carriage return, it suggests you have DOS/Windows line endings
>> >> instead of Unix. You can clean them up in the source files with
the
>> >> dos2unix or tr filters. The latter looks something like this:
>> >> 
>> >> $> tr "\r\n" "\n" < bad.pl > good.pl
>> > 
>> > It suggests to me that he has Mac (<=9) carriage returns (\r or
0x0D)
>> > only. As far as I can tell, that Perl one-liner he was asked to run
>> > should have printed all characters < decimal 31 and greater than
>> > decimal 126, of which the 10 or CF in the DOS/Windows newline
should
>> > have been printed as well. It shouldn't be too difficult to write
an
>> > equivalent tr for mac2unix though to compensate.
>> 
>> $> tr "\r" "\n" < bad.pl > good.pl
>> 
>> You can also combine them to do either/or. The first pair takes
>> priority, but the second pair will pick up any left over carriage
>> returns and turn them into extra line feeds.
>> 
>> $> tr "\r\n" "\n" "\r" "\n" < bad.pl > good.pl
>> 
> 
> tr processes one character at a time, so this code won't work.

That's strange. I have been using the first version of this to get rid
of ^M for about 26 years now with no problems whatsoever. I used it on
Eunice (NCR Unix) long before I even knew Perl existed. I didn't think
my memory was that far off.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No Output in Terminal

2010-10-01 Thread Bob McConnell
AKA carriage return, it suggests you have DOS/Windows line endings
instead of Unix. You can clean them up in the source files with the
dos2unix or tr filters. The latter looks something like this:

$> tr "\r\n" "\n" < bad.pl > good.pl

Bob McConnell

-Original Message-
From: Parag Kalra [mailto:paragka...@gmail.com] 
Sent: Thursday, September 30, 2010 11:38 PM
To: Mark
Cc: beginners@perl.org
Subject: Re: No Output in Terminal

Thats ^M character.

You can get rid of them using vi: :%s/^M//g

Cheers,
Parag



On Thu, Sep 30, 2010 at 8:26 PM, Mark  wrote:

>  On 9/30/10 10:59 PM, Chas. Owens wrote:
>
>> The only thing I can do to reproduce what you are seeing is to place
a
>> control-d (aka ASCII character 4) in the file.  Try saying this
>>
>> echo 'print "hello\n"' | perl -
>>
>> If that works, then try this:
>>
>> perl -nle 'print for grep { $_<  31 or $_>  126 } map ord, split //'
t.pl
>>
>> It will tell use what control characters may be lurking in that file
of
>> yours.
>>
>
> AH HA! When you mentioned control characters, I wondered if my text
editor
> -- BBEdit -- was causing the problem. It must have been, because when
I copy
> & pasted the code from BBEdit into Emacs, suddenly the script ran
perfectly
> in iTerm. Problem apparently solved. Thanks, everyone!
>
> - Mark
>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Web UI Automation

2010-09-23 Thread Bob McConnell
From: Shawn H Corey

> On 10-09-23 11:40 AM, Jatin wrote:
>>
>> I wanted to know if the UI automation for websites is possible using
>> perl. I did some search on the net about the possible automation that
>> can be done using perl but i mostly found information about the LWP
>> bundle. My basic reading about it so far revealed that it cannot be
used
>> in automating user actions in the UI. So here i am with a few
questions:
>>
>> -- Do we have any modules in perl that can help in automating the UI
>> actions ?
>>
>> -- Does the LWP bundle help in automating all web protocols ?
> 
> See WWW::Mechanize 
>
http://search.cpan.org/~petdance/WWW-Mechanize-1.66/lib/WWW/Mechanize.pm
> 

Another option is Selenium[1]. It works within a browser using a
JavaScript proxy to mimic the actions of the user. The remote control
server has a Perl client[2] as one of the drivers.

Bob McConnell

[1] <http://seleniumhq.org/>
[2] <http://wiki.openqa.org/display/SRC/Selenium+RC+and+Perl>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: print string in file

2010-08-17 Thread Bob McConnell
From: Irfan Sayed

> I need to print some string into the file. 
> the string is like this : ""
 > 
> i have written code like this :
> print MYFILE "\n" where MYFILE
is a file 
> handler.
> 
> if i run this code , it is giving so many syntax errors. 
> any advice please

You can't have unescaped quotes in a quoted string. Try this:

print MYFILE "\n";

or this:

print MYFILE '' . "\n";

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Data migration

2010-07-27 Thread Bob McConnell
From: M.Lewis

> On 07/27/2010 01:11 AM, Shlomi Fish wrote:
>> On Tuesday 27 Jul 2010 03:58:06 M.Lewis wrote:
>>> I'm migrating an old RedHat server to a new Debian server. In
migrating
>>> the data there's a problem in that on the RH server the UID starts
at
>>> 500, on the Debian server the UID starts at 1000. Resulting in
something
>>> like this:
>>>
>>> Old UserNew
>>> UID NameUID
>>>
>>> 500 Moe 1000
>>> 501 Larry   1001
>>> 502 Curley  1002
>>> 503 Shemp   1003
>>>
>>> I've tossed this around in my head and haven't really arrived at a
good
>>> method to correct the UID's on the new server. I presume there will
be a
>>> similar problem with GID's as well, although I've not yet confirmed
that.
>>>
>>
>> My suggestion is to simply copy the appropriate lines from the
/etc/passwd to
>> the new /etc/passwd.
>> 
>>> I'm hopeful that someone will give me an idea that will give me a
>>> kick-start so to speak.
>>
> 
> Thanks Shlomi. But in order for that to work, I would have to retain
the 
> 'old' UID numbering system, rather than use the 'new' (Debian)
numbering 
> system. If I wanted to do that, your solution would work fine.
> 
> Maybe I've missed something.

Maybe it would help if you explained what you mean by "correct the UID's
on the new server." Shlomi explained one method of correcting them, but
apparently that's not what you had in mind.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Remove duplicate files

2010-07-13 Thread Bob McConnell
From: Shawn H Corey

> On 10-07-13 01:58 AM, John W. Krahn wrote:
>> Harinatha Reddy M wrote:
>>> And what if the file is being accessed by some process. Can we
delete it?
>>
>> Probably not on Windows, probably yes on Unix/Linux.
> 
> On Linux, the contents of the file will be kept until all processes
that 
> have it open, closes it.  This means that if you delete files hoping
to 
> free up some disk space, you may not get it right away.

There is one other possibility where the space may not be free yet.
Linux, like Unix, allows multiple directory entries to point to the same
file (hard links). You may delete (unlink) the entry you know about, but
if there are others, the file will not be removed until they are all
gone. Then it will still be kept as long as any processes have it open.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-22 Thread Bob McConnell
From: Uri Guttman

>>>>>> "BM" == Bob McConnell  writes:
> 
>  BM> From: Uri Guttman
> 
>  >> that implicates the tar.exe in your box as the guilty party. put
>  >> the blame on camelbox for not handling some variation in tar
>  >> headers that all other tar utils and modules can handle. report
>  >> this as a big bug
>  BM> to
>  >> them.
> 
>  BM> Sorry Uri, but I don't agree with any of that. The way I see it:
there
>  BM> is a bug in the program building those tar files that is
erroneously
>  BM> splitting the path between the prefix and name fields in the
headers.
>  BM> The Archive::Tar module handles the resulting corrupted files,
but it is
>  BM> still abuse of the file structure. If they were built correctly,
the GNU
>  BM> tar (and WinZIP) would still be able to extract them.
> 
> given the fact that my gnu tar on linux handled the tarball just fine
> means the tarball is fine. that is a fact. perl's tar module handles
it
> fine.  your tar from camelbox fails with it. those point to camelbox
as
> guilty, not anyone else. the tar header info may have changed in
harness
> releases but it obviously is supported by standard tar extractors so
it
> is not a broken tarball. camelbox may have coded their tar only to
some
> older or more narrow version of the tar header spec and that is what
is
> failing. 
> 
>  BM> A Camelbox developer provided the workaround via their mailing
>  BM> list, so they are aware of it. But I haven't looked at this
year's
>  BM> Summer of Code projects, so I don't know if they will be working
>  BM> on it or not.
> 
> they know of the workaround since they know their tar is failing. no
one
> else is complaining to the harness author but you. they all must be
> using working tar extractors (either a program or the perl module). so
> they did nothing wrong and the harness tarball is good. i just use
> sherlock holmes' rule here are eliminate all suspects and the one that
> is left must be guilty. :)

You do know that Sherlock Holmes was a fictional character, don't you?
If any of my diagnostics were that superficial, I would never have
lasted 30 years in this profession, nor any other. A much better
guideline would be one Bob Pease (an analog EE) used to say in
Electronic Design and EDN magazines; "If you notice anything funny,
record the amount of funny."

Can you point me at any specification that states a tar archive may
split the path between the two header fields? I haven't found one and
until I see that, I will continue to believe the archives are corrupted,
no matter how many utilities have implemented a workaround.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-22 Thread Bob McConnell
From: Uri Guttman

>>>>>> "BM" == Bob McConnell  writes:
> 
>  BM> To remove the tar binary from Config.pm:
>  BM> 1) Open C:\camelbox\lib\CPAN\Config.pm in an editor that
understands
>  BM> Unix files (NOT notepad.exe; wordpad will work for this)
>  BM> 2) Find the line that says 'tar' => q[C:\\camelbox\\bin\\tar.EXE]
and
>  BM> remove the tar.EXE command; the tar command should look like this
when
>  BM> you're done:
> 
>  BM> 'tar' => q[],
> 
>  BM> CPAN will then switch to using Archive::Tar when you go to
>  BM> download/install modules.
> 
> that implicates the tar.exe in your box as the guilty party. put the
> blame on camelbox for not handling some variation in tar headers that
> all other tar utils and modules can handle. report this as a big bug
to
> them.

Sorry Uri, but I don't agree with any of that. The way I see it: there
is a bug in the program building those tar files that is erroneously
splitting the path between the prefix and name fields in the headers.
The Archive::Tar module handles the resulting corrupted files, but it is
still abuse of the file structure. If they were built correctly, the GNU
tar (and WinZIP) would still be able to extract them.

A Camelbox developer provided the workaround via their mailing list, so
they are aware of it. But I haven't looked at this year's Summer of Code
projects, so I don't know if they will be working on it or not.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-22 Thread Bob McConnell
From: Steve Bertrand

> On 2010.06.21 18:22, Bob McConnell wrote:
> 
>> After a little more digging, and trying your suggestion to try from
>> Linux, I have determined that the directory information in the new
tar
>> files is being put into the prefix field of the header. But
apparently
>> the older versions of tar (and WinZIP) don't expect anything in that
>> field until the name field is completely full. I haven't seen
anything
>> that suggests that doing this should be a standard practice.
>> 
>> One of the Camelbox developers did give me a workaround that seems to
>> get me past this issue for now.
> 
> Please post the workaround for the archives, if you wouldn't mind.

The workaround for this is to remove the tar
binary from CPAN's Config.pm file.  I just confirmed Test::Harness
unpacks after you do this.

To remove the tar binary from Config.pm:
1) Open C:\camelbox\lib\CPAN\Config.pm in an editor that understands
Unix files (NOT notepad.exe; wordpad will work for this)
2) Find the line that says 'tar' => q[C:\\camelbox\\bin\\tar.EXE] and
remove the tar.EXE command; the tar command should look like this when
you're done:

'tar' => q[],

CPAN will then switch to using Archive::Tar when you go to
download/install modules.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-21 Thread Bob McConnell
From: Bob McConnell 

> From: Uri Guttman

>>>>>>> "BM" == Bob McConnell  writes:
>> 
>>  BM> Looking at the two tar files with a binary viewer after
uncompressing
>>  BM> them through gzip, I see several differences, but other than the
>>  BM> obvious, I don't know which are significant. The obvious
difference is
>>  BM> that the tar file headers for 3.17 all have absolute paths for
each
>>  BM> file. The 3.21 headers do not. The 3.21 headers also contain
more fields
>>  BM> and some are padded differently, but I don't know what effect
this would
>>  BM> have.
>> 
>> the absolute vs relative paths may mean something. maybe the author
>> switched tars when they switched source control? tar is best with
>> relative paths so you can untar it anywhere.
> 
> I should have said full paths, instead of relative. The difference
> is 'prove' vs 'Test-Harness-3.17/bin/prove'.
> 
>> one idea is to untar the file on a linux box and then transfer over
that
>> tree (using tar again or scp or some other tool like zip).
> 
> CPAN won't let me substitute files. In the first place, the checksum
> would no longer work.
> 
>> and this is getting way beyond a beginner's problem. i would take
this
>> to some other forums like perlmonks or usenet. also have you written
to
>> the author of the module about this? if it fails for you on winblows,
>> then it might fail elsewhere. also try this on another winblows box
>> which can help isolate whatever is different about yours.
> 
> I have posted the question on the Camelbox forum, but have not yet
> received any response. I don't know where to take CPAN problems,
> since I have never had any before. After reading what I can find
> of the tar format, I think the utility used to build that tarball
> is broken. Each file header should have a full path from the base
directory.

After a little more digging, and trying your suggestion to try from
Linux, I have determined that the directory information in the new tar
files is being put into the prefix field of the header. But apparently
the older versions of tar (and WinZIP) don't expect anything in that
field until the name field is completely full. I haven't seen anything
that suggests that doing this should be a standard practice.

One of the Camelbox developers did give me a workaround that seems to
get me past this issue for now.

Thank you,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-21 Thread Bob McConnell
From: Uri Guttman

>>>>>> "BM" == Bob McConnell  writes:
> 
>  BM> Looking at the two tar files with a binary viewer after
uncompressing
>  BM> them through gzip, I see several differences, but other than the
>  BM> obvious, I don't know which are significant. The obvious
difference is
>  BM> that the tar file headers for 3.17 all have absolute paths for
each
>  BM> file. The 3.21 headers do not. The 3.21 headers also contain more
fields
>  BM> and some are padded differently, but I don't know what effect
this would
>  BM> have.
> 
> the absolute vs relative paths may mean something. maybe the author
> switched tars when they switched source control? tar is best with
> relative paths so you can untar it anywhere.

I should have said full paths, instead of relative. The difference is
'prove' vs 'Test-Harness-3.17/bin/prove'.

> one idea is to untar the file on a linux box and then transfer over
that
> tree (using tar again or scp or some other tool like zip).

CPAN won't let me substitute files. In the first place, the checksum
would no longer work.

> and this is getting way beyond a beginner's problem. i would take this
> to some other forums like perlmonks or usenet. also have you written
to
> the author of the module about this? if it fails for you on winblows,
> then it might fail elsewhere. also try this on another winblows box
> which can help isolate whatever is different about yours.

I have posted the question on the Camelbox forum, but have not yet
received any response. I don't know where to take CPAN problems, since I
have never had any before. After reading what I can find of the tar
format, I think the utility used to build that tarball is broken. Each
file header should have a full path from the base directory.

Thanks,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-21 Thread Bob McConnell
From: Uri Guttman

>>>>>> "BM" == Bob McConnell  writes:

>  BM> Yes, that was all one line. Lookout doesn't give me any options
to
>  BM> prevent it from wrapping. Microsoft _always_ believe they know
what's
>  BM> best for you.
> 
> so don't use outhouse for mail. simple!

Not my choice. It is decreed from on high and cannot be changed as long
as I need a regular paycheck.

>  BM> In the meantime, I need to know what the difference is between
the 3.17
>  BM> and 3.21 archives on CPAN. Why does one work and the other not?
> 
> i can't imagine anything diff on the cpan modules as i did unzip both
of
> them. it must be something with your local box and setup. not much
more
> i can do from here. sorry.

Looking at the two tar files with a binary viewer after uncompressing
them through gzip, I see several differences, but other than the
obvious, I don't know which are significant. The obvious difference is
that the tar file headers for 3.17 all have absolute paths for each
file. The 3.21 headers do not. The 3.21 headers also contain more fields
and some are padded differently, but I don't know what effect this would
have.

Doing a text comparison also suggests that 3.17 was in a Subversion
archive, while 3.21 is now in a GIT archive. I don't believe that should
have any impact on this problem, but it does suggest there may have been
some tooling changes that could contribute to this problem.

Has the tar file format been changed in the last, say ten years or so?
Or are there variations that not all utilities will recognize?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: store and edit perl hash data

2010-06-21 Thread Bob McConnell
From: Uri Guttman

>>>>>> "pp" == philge philip  writes:
> 
>  pp> is it possible to change values of my hash "%position_counts"
>  pp> stored in the file without retrieving it back using "fd_retrieve"?
>
>  pp> if its not possible can you tell me how to store a huge hash data
>  pp> to a file or dbm and edit it without retrieving it back in
>  pp> perl. Is "storable" module the best option?
> 
> storable uses a binary format which can't be edited. if you must edit
> the data file outside a perl program you can use Data::Dumper which puts
> out perl data structures. you need to be careful if you have a complex
> structure which loops back and such. there are options to handle that
> but they may make it harder to edit the data cleanly. you then read the
> file back and run eval on it (or use do/require). it also depends on how
> you write out the file itself. you may need to edit (in perl) the dumper
> text to make it work in your context (package space, lexicals, etc.)
> 
> another alternative if your hash is simplistic is to use CSV or a DBD
> that handles CSV or another text format.

YAML is another option, since he specified he wanted it to be editable.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-18 Thread Bob McConnell
From: Uri Guttman

>>>>>> "BM" == Bob McConnell  writes:
>  BM> From: Uri Guttman
> 
>  >> tar zxvf Test-Harness-3.17.tar.gz
> 
>  BM> C:\camelbox\.cpan\build\tmp-Test>tar xzvf
>  BM> D:\Downloads\Test-Harness-3.21.tar.gz
>  BM> tar: Cannot use compressed or remote archives
>  BM> tar: Error is not recoverable: exiting now
> 
> what is different from my options vs yours? :) gnu tar can properly
call
> gzip if the z option is in the right place.

I don't see any difference. But I also don't see anything that tells me
where they got this one from. It may not be one of the more recent
releases.

-
C:\camelbox\.cpan\build\tmp-Test>tar zxvf
D:\Downloads\Test-Harness-3.21.tar.gz
tar: Cannot use compressed or remote archives
tar: Error is not recoverable: exiting now
-

>  BM> But piping from gzip still works. The current build gives me:
> 
>  BM> -
>  BM> C:\camelbox\.cpan\build\tmp-Test>gzip -dc
>  BM> D:\Downloads\Test-Harness-3.21.tar.gz
>  BM> | tar xvf -
>
> is that all one line? don't let your emailer wrap lines for you. this
is
> a general rule about posting commands with long lines.

Yes, that was all one line. Lookout doesn't give me any options to
prevent it from wrapping. Microsoft _always_ believe they know what's
best for you.

> are you sure the tar command is the camelbones one? 

Yes, I have done a search for tar.exe and renamed every other one that
is even close to an active PATH.

>  BM> tar: prove: Could not create directory: Permission denied
>   BM> ...
> 
> ok, that is a clue. make sure you have a clean subdir below you when
you
> do this. again, winblows is wierd with things like this.

Each was done in a clean directory. This one was denied because there
was already a file named 'prove' that should have been put into the bin/
directory but wasn't.

>  BM> Only the older archive will work.
> 
>  BM> -
>  BM> C:\camelbox\.cpan\build\tmp-Test>gzip -dc
>  BM> D:\Downloads\Test-Harness-3.17.tar.gz
>  BM> | tar xvf -
>  BM> Test-Harness-3.17/
>  BM> Test-Harness-3.17/Build.PL
> 
> is this with a clean subdir or overwriting the existing 3.17 subdir? 
> 
> i really suspect you are doing some dumb little subtle thing wrong.
like
> i said, do it with a clean subdir. make sure you are calling the
> camelbones programs (try full paths to them). try just using tar like
i
> showed (LOOK AT THE OPTIONS ORDER. it matters)

It wasn't me that did it the first time. I simply ran

 'CPAN Test::Harness'

And this problem popped up. Now that this is in the queue, i can't get
CPAN to install anything else because this one errors out first and
terminates the process.

> also try to be in the dir with the tarball itself. make sure there is
> nothing else in that dir. do that with both versions. don't use the
pipe
> idea as it will work on unix but $DEITY knows on windows.

Unfortunately, for the next few months I have to suffer with MS-Windows
in order to collect a regular pay check. After I retire I can finally
get away from it. All nine computers at home are already running various
distributions of Linux or FreeBSD.

In the meantime, I need to know what the difference is between the 3.17
and 3.21 archives on CPAN. Why does one work and the other not?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-18 Thread Bob McConnell
From: Uri Guttman

>>>>>> "BM" == Bob McConnell  writes:
> 
>  BM> From: Uri Guttman
>  >> i will assume the tarball from cpan is in good shape. so the
issues
>  >> seems to be you have a broken unzipping of a tar.gz file. can you
try
>  >> unzipping another cpan module or any tgz file? this would verify
my
>  >> conjecture or not. can you install a gnu or other real tar
utility?
>  >> cygwin? does winblows unzip handle tarballs correctly in general?
> 
>  BM> Camelbox installed the GNU tar and gzip. Both appear to be
working
>  BM> correctly with Test-Harness-3.17.tar.gz and earlier builds.
> 
>  BM> I went directly to cpan.org and have downloaded each Test-Harness
>  BM> tarball back to 3.17. That is the last one with valid path
information
>  BM> in it. 3.17_01 through 3.21 all come up with no paths in both
WinZip and
>  BM> these GNU utilities. But neither tool has a problem with
>  BM> Test-Harness-3.17.tar.gz, Bundle-CPAN-1.858.tar.gz,
CPAN-1.9402.tar.gz
>  BM> or Net-Pcap-0.16.tar.gz.
> 
>  BM> It is obvious that something has changed. But how do I determine
what?
> 
> i just downloaded and unzipped harness 3.17 and 3.21 and both have
full
> trees. so the tarballs are fine as i expected. the question is why is
> your tar and gzip failing on the recent harness modules but not
> others. try this command on a know working tarball and one that
breaks:
> 
>   tar zxvf Test-Harness-3.17.tar.gz
> 
> the output should show all the paths as the files are extracted. i am
> assuming the camelbones tools work the same as the normal gnu ones. if
> you don't get a nice looking listing of the paths, something very odd
is
> happening. the only last idea is to upgrade camelbones itself.

I am running the current release of Camelbox. It was created during a
Google Summer of Code, and I don't believe it has been updated since.

You're used to the Linux tar as well. GNU won't do that.

-
C:\camelbox\.cpan\build\tmp-Test>tar xzvf
D:\Downloads\Test-Harness-3.21.tar.gz
tar: Cannot use compressed or remote archives
tar: Error is not recoverable: exiting now
-

But piping from gzip still works. The current build gives me:

-
C:\camelbox\.cpan\build\tmp-Test>gzip -dc
D:\Downloads\Test-Harness-3.21.tar.gz
| tar xvf -
Test-Harness-3.21
Build.PL
Changes
Changes-2.64
HACKING.pod
MANIFEST
MANIFEST.CUMMULATIVE
META.yml
Makefile.PL
README
perlcriticrc
bin
prove
examples
README
tar: README: Could not create file: Permission denied
analyze_tests.pl
my_exec
silent-harness.pl
test_urls.txt
bin
forked_tests.pl
test_html.pl
tprove_gtk
harness-hook
hook.pl
lib
Harness
Hook.pm
t
10-stuff.t
ruby.t
inc
MyBuilder.pm
lib
App
Prove.pm
Prove
tar: prove: Could not create directory: Permission denied
...
-

Only the older archive will work.

-
C:\camelbox\.cpan\build\tmp-Test>gzip -dc
D:\Downloads\Test-Harness-3.17.tar.gz
| tar xvf -
Test-Harness-3.17/
Test-Harness-3.17/Build.PL
Test-Harness-3.17/Changes
Test-Harness-3.17/Changes-2.64
Test-Harness-3.17/HACKING.pod
Test-Harness-3.17/MANIFEST
Test-Harness-3.17/META.yml
Test-Harness-3.17/Makefile.PL
Test-Harness-3.17/README
Test-Harness-3.17/bin/
Test-Harness-3.17/bin/prove
Test-Harness-3.17/examples/
Test-Harness-3.17/examples/README
Test-Harness-3.17/examples/analyze_tests.pl
Test-Harness-3.17/examples/bin/
Test-Harness-3.17/examples/bin/forked_tests.pl
Test-Harness-3.17/examples/bin/test_html.pl
Test-Harness-3.17/examples/bin/tprove_gtk
Test-Harness-3.17/examples/harness-hook/
Test-Harness-3.17/examples/harness-hook/hook.pl
Test-Harness-3.17/examples/harness-hook/lib/
Test-Harness-3.17/examples/harness-hook/lib/Harness/
Test-Harness-3.17/examples/harness-hook/lib/Harness/Hook.pm
Test-Harness-3.17/examples/my_exec
Test-Harness-3.17/examples/silent-harness.pl
Test-Harness-3.17/examples/t/
Test-Harness-3.17/examples/t/10-stuff.t
Test-Harness-3.17/examples/t/ruby.t
Test-Harness-3.17/examples/test_urls.txt
Test-Harness-3.17/inc/
Test-Harness-3.17/inc/MyBuilder.pm
Test-Harness-3.17/lib/
Test-Harness-3.17/lib/App/
-

I really don't want to go back to the ActiveState garbage pile, so how
do I fix this?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-18 Thread Bob McConnell
From: Uri Guttman

>>>>>> "BM" == Bob McConnell  writes:
> 
>   BM> Just that, there are no paths shown in the directory tree. When
>   BM> unpacked, I see this:
> 
>   BM> --
>   BM> C:\camelbox\.cpan\build\tmp-4908>ls -al
>   BM> total 2320
>   BM> drwxrwxrwx   1 user group   0 Jun 18 14:36 .
>   BM> drwxrwxrwx   1 user group   0 Jun 18 14:36 ..
>   BM> -r--r--r--   1 user group2061 Jan 30 07:24
000-load.t
>   BM> -r--r--r--   1 user group 314 Jan 30 07:24
10-stuff.t
>   BM> -r--r--r--   1 user group9274 Jan 30 07:24
Aggregator.pm
>   BM> drwxrwxrwx   1 user group   0 Jun 18 14:36 App
>   BM> -r--r--r--   1 user group1735 Jan 30 07:24 Array.pm
>   BM> -r--r--r--   1 user group1181 Jan 30 07:24
Bailout.pm
>   BM> -r--r--r--   1 user group2228 Jan 30 07:24 Base.pm
>   BM> -r--r--r--   1 user group   15424 Jan 30 07:24
Beyond.pod
>   BM> -r--r--r--   1 user group1050 Jan 30 07:24 Build.PL
>   BM> drwxrwxrwx   1 user group   0 Jun 18 14:36 Builder
>   BM> -r--r--r--   1 user group   42199 Jan 30 07:24
Builder.pm
>   BM> -r--r--r--   1 user group   35724 Jan 30 07:24 Changes
>   BM> -r--r--r--   1 user group   27433 Jan 30 07:24
Changes-2.64
>   BM> -r--r--r--   1 user group3291 Jan 30 07:24 Color.pm
> 
>   BM> There were also several name collisions, so not all of the files
are
>   BM> there. There is no chance Make is going to work.
> 
>   BM> I also have CPAN and Net::PCAP source packages which do show a
directory
>   BM> structure and unpack into the correct directories.
> 
> i will assume the tarball from cpan is in good shape. so the issues
> seems to be you have a broken unzipping of a tar.gz file. can you try
> unzipping another cpan module or any tgz file? this would verify my
> conjecture or not. can you install a gnu or other real tar utility?
> cygwin? does winblows unzip handle tarballs correctly in general?

Camelbox installed the GNU tar and gzip. Both appear to be working
correctly with Test-Harness-3.17.tar.gz and earlier builds.

-
C:\camelbox\.cpan\build\tmp-4908>tar --version
tar (GNU tar) 1.12

Copyright (C) 1988, 92, 93, 94, 95, 96, 97 Free Software Foundation,
Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Written by John Gilmore and Jay Fenlason.

C:\camelbox\.cpan\build\tmp-Test>gzip --version
gzip 1.2.4 (18 Aug 93)
Compilation options:
DIRENT SYS_UTIME STDC_HEADERS HAVE_UNISTD_H NO_CHOWN PROTO ASMV
-

I went directly to cpan.org and have downloaded each Test-Harness
tarball back to 3.17. That is the last one with valid path information
in it. 3.17_01 through 3.21 all come up with no paths in both WinZip and
these GNU utilities. But neither tool has a problem with
Test-Harness-3.17.tar.gz, Bundle-CPAN-1.858.tar.gz, CPAN-1.9402.tar.gz
or Net-Pcap-0.16.tar.gz.

It is obvious that something has changed. But how do I determine what?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: No paths in Test-Harness-3.21.tar

2010-06-18 Thread Bob McConnell
Just that, there are no paths shown in the directory tree. When
unpacked, I see this:

--
C:\camelbox\.cpan\build\tmp-4908>ls -al
total 2320
drwxrwxrwx   1 user group   0 Jun 18 14:36 .
drwxrwxrwx   1 user group   0 Jun 18 14:36 ..
-r--r--r--   1 user group2061 Jan 30 07:24 000-load.t
-r--r--r--   1 user group 314 Jan 30 07:24 10-stuff.t
-r--r--r--   1 user group9274 Jan 30 07:24 Aggregator.pm
drwxrwxrwx   1 user group   0 Jun 18 14:36 App
-r--r--r--   1 user group1735 Jan 30 07:24 Array.pm
-r--r--r--   1 user group1181 Jan 30 07:24 Bailout.pm
-r--r--r--   1 user group2228 Jan 30 07:24 Base.pm
-r--r--r--   1 user group   15424 Jan 30 07:24 Beyond.pod
-r--r--r--   1 user group1050 Jan 30 07:24 Build.PL
drwxrwxrwx   1 user group   0 Jun 18 14:36 Builder
-r--r--r--   1 user group   42199 Jan 30 07:24 Builder.pm
-r--r--r--   1 user group   35724 Jan 30 07:24 Changes
-r--r--r--   1 user group   27433 Jan 30 07:24 Changes-2.64
-r--r--r--   1 user group3291 Jan 30 07:24 Color.pm
...
--

There were also several name collisions, so not all of the files are
there. There is no chance Make is going to work.

I also have CPAN and Net::PCAP source packages which do show a directory
structure and unpack into the correct directories.

Bob McConnell


-Original Message-
From: Jim Gibson [mailto:jimsgib...@gmail.com] 
Sent: Friday, June 18, 2010 2:48 PM
To: beginners@perl.org
Subject: Re: No paths in Test-Harness-3.21.tar

On 6/18/10 Fri  Jun 18, 2010  11:27 AM, "Bob McConnell" 
scribbled:

> I am trying to update Test::Harness from CPAN, but it's not working.
> When I go into the downloaded file at
>
 z> using WinZip 9.0 SR1 I see a lot of files but no paths. When CPAN
> tries to untar them, it creates the directories in the tmp-
> directory, but puts all of the files there as well, instead of in the
> directories. Is this tar ball broken?

What do you mean by "no paths"? I downloaded Test-Harness-3.21.tar.gz
directly from CPAN and looked at the contents. Every file is contained
in
the Test-Harness-3.21 directory or a subdirectory thereof (bin,
examples,
inc, lib, t, xt), so every file in the tar listing is preceded by a
path.

Have you tried manually installing the module with:

perl Makefile.PL
make
make test
make install

(or does that not work on your Windows system?)



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




No paths in Test-Harness-3.21.tar

2010-06-18 Thread Bob McConnell
I am trying to update Test::Harness from CPAN, but it's not working.
When I go into the downloaded file at
 using WinZip 9.0 SR1 I see a lot of files but no paths. When CPAN
tries to untar them, it creates the directories in the tmp-
directory, but puts all of the files there as well, instead of in the
directories. Is this tar ball broken?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Location of Perl libraries

2010-05-27 Thread Bob McConnell
From: Marilyn Sander

> On May 26, 2010, at 3:35 PM, Shawn H Corey wrote:
>> On 10-05-26 05:41 PM, Marilyn Sander wrote:
>>> What would be the preferred practice here?
>> 
>> See `perldoc lib`
>> 
> Thanks, this document just explains about @INC.  I already
> know how to use @INC.  My  question was about "normal",
> "standard", or "best" practice for placement of scripts
> and Perl libraries on Windows.   The default setup for
> ActiveState is to put site-specific stuff into
> c:\Perl\site\lib.  I would rather use a location on the
> network, mapped to a network drive.  I know how to do that,
> I just want to know if Windows people would find that weird
> or objectionable.  

There is very little in the way of standards, normality or best
practices in the MS-Windows world. It really doesn't matter what you do
as long as you document it so that others can understand it. ActiveState
and Cygwin each have their own ideas about where to put files, and they
are not necessarily compatible. I haven't tried Strawberry Perl, but
Camelbox also has a unique directory structure. I would be more
concerned about making sure I can restore each system after a hard drive
failure.

.bat was the old MS-DOS script extension. I always put those files in
C:\Belfry. Just make sure they are in the %PATH% or all of your
scheduled events and scripts use absolute paths.

The only other issue is to make sure your base scripts record errors
when there are network problems and they can't reach those servers.
Notice I said 'when' not 'if'. It is a basic theorem that there will be
times that your scripts can't get through.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Return value = 0

2010-05-26 Thread Bob McConnell
while (system($command) != 0) {
} 

Bob McConnell

-Original Message-
From: Andros Zuna [mailto:andros.z...@gmail.com] 
Sent: Wednesday, May 26, 2010 8:57 AM
To: Chaitanya Yanamadala
Cc: beginners@perl.org
Subject: Re: Return value = 0

Hi,
Thank you for the tip Chaitanya, but I still don't thik my script is
working correct!?



2010/5/26 Chaitanya Yanamadala 


u should give it as 
$command=`ls -la`;


use the key on the top of TAB button with shift..

Chaitanya

"A man can get discouraged many times but he is not a failure
until he stops trying..."

"The difference between 'involvement' and 'commitment' is like
an eggs-and-ham breakfast: the chicken was 'involved' - the pig was
'committed'."
ic_mob.gif me if u need any thing
preview_document.jpg



On Wed, May 26, 2010 at 6:19 PM, Andros Zuna
 wrote:


Hi!
I am trying to write a perl code that will retry the
same command over
and over again until the return value is 0.
This is what I got for now:

#! /usr/bin/perl
use warnings;
use strict;

$command = 'ls -l';

if (system($command) == 0) {
}
elsif(system($command != 0)) {
 print "Failed to execute: $command\n";
 my $c++
}

I'm not shure to test it, because I don't know any unix
commands that
gives other than 0 in return
(I'm a n00b, but willing and trying to learn), could
anyone please
take a look and see if this is correct, and if not, help
me??

Tnx :)





--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Unable to install Net::Pcap on Slackware

2010-05-24 Thread Bob McConnell
I am getting the following error report when I try to install Net::Pcap
for Perl 5.10.0 as root on Slackware 12.2.0. Can anyone tell me what I
am missing?

Bob McConnell


Test Summary Report
---
t/03-openlive.t  (Wstat: 256 Tests: 14 Failed: 1)
   Failed test:  13
   Non-zero exit status: 1
t/06-offline.t   (Wstat: 0 Tests: 403 Failed: 0)
   TODO passed:   398
t/07-stats.t (Wstat: 0 Tests: 134 Failed: 0)
   TODO passed:   68, 81, 107
t/10-fileno.t(Wstat: 0 Tests: 21 Failed: 0)
   TODO passed:   19
Files=30, Tests=1607, 23 wallclock secs ( 0.62 usr  0.06 sys +  2.79 
cusr  1.34 csys =  4.81 CPU)
Result: FAIL
Failed 1/30 test programs. 1/1607 subtests failed.
make: *** [test_dynamic] Error 255
   SAPER/Net-Pcap-0.16.tar.gz
   /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module,
try:
   reports SAPER/Net-Pcap-0.16.tar.gz
Running make install
   make test had returned bad status, won't install without force
bash-3.1# perl -version

This is perl, v5.10.0 built for i486-linux-thread-multi

Copyright 1987-2007, Larry Wall

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Installation of WinPcap developer's pack

2010-05-24 Thread Bob McConnell
From: Bob McConnell 

> I am trying to install Net::Pcap for Camelbox Perl on WinXP. cpan
> returns the error message below, but won't tell me what the standard
> location should be for WpdPack.
> 
> Where do I put it?

I am also having problems installing Net::Pcap on Slackware Linux. It
fails a number of tests and simply refuses to complete the installation.
This is Perl 5.10.0 on Slackware 12.2.0.

Any suggestions?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Installation of WinPcap developer's pack

2010-05-24 Thread Bob McConnell
I am trying to install Net::Pcap for Camelbox Perl on WinXP. cpan
returns the error message below, but won't tell me what the standard
location should be for WpdPack.

Where do I put it?

Bob McConnell

-8<
  CPAN.pm: Going to build S/SA/SAPER/Net-Pcap-0.16.tar.gz

socket.h patched... ok
looking for -lwpcap... yes
checking for pcap_lib_version() in -lwpcap... no
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
You appear to lack the WinPcap developer pack.

If it is installed in a non-standard location, please try setting the
LIBS
and INC values on the command line.  For instance, if you have unziped
the
developer's pack in C:\WpdPack, you should execute:

perl Makefile.PL INC=-IC:/WpdPack/Include "LIBS=-LC:/WpdPack/Lib
-lwpcap"

Or get and install the WinPcap developer's pack from
  http://www.winpcap.org/install/
-8<


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: maping a network with perl

2010-05-19 Thread Bob McConnell
From: Brian

> On May 19, 2010, at 1:19 PM, packet wrote:
> 
>> How can we map a network in perl?
>> 
>> i was just thinking how we can do that.Sorry new to perl.
>> 
> 
> Only way I know how to do it is with the use of Net::SNMP and
> Net::Ping. Use Net::SNMP to get a list of adjacent networks
> from routers, and use net::Ping to ping sweep those networks
> looking for new nodes. Basically repeat that process until the
> network is mapped.
> 
> That's a very very simplified explanation. There are entire
> books written on SNMP and you have to be pretty familiar with
> that service to know how to get the info you need.

I would start by playing with nmap and think about using Perl to reduce
the results
to a usable format.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Determining real network delays

2010-05-19 Thread Bob McConnell
I am looking for some strategic help. I am about to receive several days
worth of Wireshark captures from two ends of an OpenVPN connection.
These will show the public view of traffic over that connection. I have
been asked to determine the variation in transport time between the two
NICs. I do not expect the two clocks to be in sync, so I think I am
looking to find the MIN and MAX delta between the timestamps. I can use
the ACK/SEQ numbers to match the packets, then calculate the time
difference.

Is there a Perl parser for pcap binary files?

The initial goal is to determine if there is more than a 10 second
difference between MIN and MAX. IF there is, how frequently does it
reach the high end. Yes, we are having timeout issues with the
applications talking over this connection.

Any suggestions?

Thank  you,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: help in perl script

2010-05-18 Thread Bob McConnell
The Perl command opens a new instance of the shell, not the one you
called Perl from. The new instance has no history to report.

Bob McConnell

-Original Message-
From: Chaitanya Yanamadala [mailto:dr.virus.in...@gmail.com] 
Sent: Tuesday, May 18, 2010 10:20 AM
To: Bob McConnell
Cc: beginners@perl.org
Subject: Re: help in perl script

dear Bob
if my current shell does not have any history then how come i am getting
the history when i run the same in the terminal??
from where i am getting this history.


Chaitanya




On Tue, May 18, 2010 at 7:03 PM, Bob McConnell  wrote:


From: Chaitanya Yanamadala


> hai
>  both of these didnt help me..
>
> @kammen
> i can run the history command from the command line..
> but not through the perl script..
> i have tried ur choice but it also didnt work..
>
> @shawn
>  yes it didnt gave me any out put..
> but i require to print the output..
> so hw do i do it..
>
> can some body help me on this..


Not until you learn a little more about Unix shells. Your
command worked
perfectly, it just didn't output what you expected. The history
command
in bash returnes the command history of the current shell. Since
you
just opened it via the system call, it has no history, so it
returns an
empty string. That behavior is correct.

Now, what are you actually looking for?

Bob McConnell




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: help in perl script

2010-05-18 Thread Bob McConnell
From: Chaitanya Yanamadala

> hai
>  both of these didnt help me..
> 
> @kammen
> i can run the history command from the command line..
> but not through the perl script..
> i have tried ur choice but it also didnt work..
> 
> @shawn
>  yes it didnt gave me any out put..
> but i require to print the output..
> so hw do i do it..
> 
> can some body help me on this..

Not until you learn a little more about Unix shells. Your command worked
perfectly, it just didn't output what you expected. The history command
in bash returnes the command history of the current shell. Since you
just opened it via the system call, it has no history, so it returns an
empty string. That behavior is correct.

Now, what are you actually looking for?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: data dumper

2010-05-17 Thread Bob McConnell
From: Shawn H Corey
>On 10-05-16 11:17 PM, Uri Guttman wrote:
>> it can be used to save data (e.g. a config
>> file) in a file for reloading in the future (via running the dumper
>> output with eval).
>m
>mBy saving the output of Data::Dumper to a *.pm file, it can be
reloaded 
>mvia "use".

What is the difference between this and exporting a YAML file? Where
would either be preferred over the other?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: How do I control a C programme from perl?

2010-05-13 Thread Bob McConnell
From: robert Key

>   I want to capture UNBUFFERED output from a C programme and then 
> control it depending on its output. Problem is nothing seems to 
> unbufferd the output from the C programme. Only when the child has 
> finished executing do I get all the output which is too late.
> 
> The C programe is just like hello world in a loop of 20.



> I have tried all the recipes int the Perl cook book but none work.

The buffering is probably being done in the C runtime, so it isn't
sending any of the data until it closes. You need to check that code for
a way to disable output buffering.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Merging YAML nodes/streams

2010-05-07 Thread Bob McConnell
From: Tom

> I'm having trouble merging YAML streams.
> 
> Basic premise is that I load multiple YAML files and I want to combine
> the result. There may be common elements within subsequent YAML files
> and I would want the last loaded to be the taken value if one already
> existed.
> 
> I have tried treating the YAML nodes like hashes:
> eg $yaml = ($yaml1, $yaml2)
> but this does not merge them.
> Also there may be more than 2 streams, but I would like to cascade
> merge them as I loop through a list of YAML files to load (eg
> $yaml=($yaml, $next_yaml)) but this gives me a void context.
> 
> Can anyone suggest how I could merge them?

You might try the suggestion here:
<http://www.perlmonks.org/?node_id=813443>. As usual, I ran across it
yesterday while looking for something else.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Still pondering working with hashs

2010-05-04 Thread Bob McConnell
From: Philip Potter
> On 4 May 2010 13:45, Bob McConnell  wrote:
>> From: Uri Guttman
>>
>>>>>>>> "HP" == Harry Putnam  writes:
>>>
>>>   HP> "Uri Guttman"  writes:
>>>   >> nope. been doing this for 35 years and it is solid advice. you
>> can't do
>>>   >> a proper program unless you have a proper goal which is what the
>>>   >> specification is.
>>>
>>>   HP> Some of it looks suspiciously like hair splitting and karping of
>> the
>>>   HP> first order.
>>>
>>> what you think is hair splitting, we think of as moving mountains.
>> this
>>> is what experience in developing projects (big and small) tells us.
>> you
>>> came here to learn perl. there is much more to programming than
>> learning
>>> a particular language. in fact most programming skills and knowledge
>> is
>>> language independent and that is also important to know.
>>
>> This is sounding more and more like an argument between waterfall and
>> agile managers about the best methodology for developing applications.
>> In waterfall you always started with a locked down requirements
>> document, but in agile we never do. The best we can get is the product
>> manager's interpretation of what she heard the client describe. That
>> usually changes as soon as she sees the first prototype.
>>
>> Harry has said he is just beginning to learn the language. As a result,
>> I would expect his short range goals to be adjusted as he learns what is
>> possible and what it takes to accomplish it. That does require some
>> 'driving around' to get an idea of the lay of the land and the paths
>> available to get from here to there. It is also called experimenting
>> with the tool set, or working through the exercises at the end of the
>> chapter. As long as he is learning, what difference does it make what
>> his final destination is. Do any of us know what that will be when we
>> start playing in a new sand box?
> 
> You have to start with *some* goal. Even in agile, you start with
> stories to work out in what direction you are headed. You formalise
> your requirements into tests and then you start coding. Yes, you
> revise your stories, requirements and tests as you learn more about
> the design and the technology, but you still need to start from
> somewhere.
> 
> Agile is a more nuanced approach to having everything planned out
> before you begin coding but it's still the same underlying model of
> [requirements] -> [design] -> [code], just repeated daily ad nauseum.
> 
> I do agree that there is a contiuum here, with "totally uninformed
> undirected exploring and experimentation" on one end, and "totally
> preplanned careful single-minded coding" on the other. Waterfall is
> totally preplanned, agile is somewhere in the middle. I don't think
> anyone advocates having *no plan* at all and guessing everywhere.

Your version of agile sounds a *lot* more formal than ours. We are nowhere near 
the middle, but much closer to the 'no plan' end of the spectrum. The story we 
get is often a one liner with more wish than reality. I have thrown out several 
weeks of work over the past year because what the PM gave us to work from 
wasn't what she or the client meant.

We have one developer that has described the situation like this: "Management 
asked me to build a box. But as soon as that box was done, they looked at it 
and said it was supposed to have round corners. So we rounded the corners and 
then they said it was supposed to have a lid. So we build the lid and then they 
said, the lid should have hinges..." He implemented one PDA application from 
scratch three times before they were happy with it, changing SDKs twice and the 
target OS once.

Yes, we have a real problem getting management to give us useful requirements 
before we start a project, or even part way through it when we show them 
prototypes. We try to pry more details out of them, and do come close most of 
the time, but it is about as easy as pulling hen's teeth.

The PDA developer and I are now waiting to see which of us retires first. He 
has less than 400 days left. If I decide to wait until the 25th anniversary of 
my date of hire, I have 518 days. But I will be eligible for early retirement 
in 273 days.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Still pondering working with hashs

2010-05-04 Thread Bob McConnell
From: Uri Guttman

>>>>>> "HP" == Harry Putnam  writes:
> 
>   HP> "Uri Guttman"  writes:
>   >> nope. been doing this for 35 years and it is solid advice. you
can't do
>   >> a proper program unless you have a proper goal which is what the
>   >> specification is.
> 
>   HP> Some of it looks suspiciously like hair splitting and karping of
the
>   HP> first order.
> 
> what you think is hair splitting, we think of as moving mountains.
this
> is what experience in developing projects (big and small) tells us.
you
> came here to learn perl. there is much more to programming than
learning
> a particular language. in fact most programming skills and knowledge
is
> language independent and that is also important to know.

This is sounding more and more like an argument between waterfall and
agile managers about the best methodology for developing applications.
In waterfall you always started with a locked down requirements
document, but in agile we never do. The best we can get is the product
manager's interpretation of what she heard the client describe. That
usually changes as soon as she sees the first prototype.

Harry has said he is just beginning to learn the language. As a result,
I would expect his short range goals to be adjusted as he learns what is
possible and what it takes to accomplish it. That does require some
'driving around' to get an idea of the lay of the land and the paths
available to get from here to there. It is also called experimenting
with the tool set, or working through the exercises at the end of the
chapter. As long as he is learning, what difference does it make what
his final destination is. Do any of us know what that will be when we
start playing in a new sand box?

Bob McConnell


I know that you think you understand what you thought you heard me say.
But I don't believe you realize that what I said is not what I meant.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Creating groups of bat files from perl script

2010-04-30 Thread Bob McConnell
From: Paul

> OK, it was late at night, and working 7 days/week doesn't help.
Anyhow,
> after looking at my convoluted script, I have one that works now, but
am 
> now trying to figure out an easy way to change the "/" in the
resultant
> file to "\" to work in windows.  Always something.

Do you really need to change them? Many applications on MS-Windows will
parse either slash correctly. Test what you have before you spend
(waste) time changing them.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Perl not closing TCP sockets if clients are no longer connected?

2010-04-28 Thread Bob McConnell
I haven't done much of this with Perl, but for most socket drivers the
only way to detect the connection was closed by the other end is to try
to read from it. If the remote end actually sends a FIN packet, you will
get a specific result from the read that you can use to trigger closure
on your end. Otherwise, the half open socket will remain until something
triggers a network error that causes the write to fail. But you don't
check the results of the send() either, so you may have missed that as
well.

Bob McConnell

-Original Message-
From: Leon Meyer [mailto:lmeyer.blt...@gmail.com] 
Sent: Wednesday, April 28, 2010 3:29 PM
To: beginners@perl.org
Subject: Perl not closing TCP sockets if clients are no longer
connected?

The purpose of the application is to listen for a specific UDP multicast
and
then to forward the data to any TCP clients connected to the server. The
code works fine, but I have a problem with the sockets not closing after
the
TCP clients disconnects. A socketsniffer utility shows the the sockets
remain open and all the UDP data continues to be forwarded to the
clients.
The problem I believe is with the "if ($write->connected())" block as it
always return true, even if the TCP client is no longer connected. I use
standard Windows Telnet to connect to the server and to see the data.
When I
close telnet, the TCP socket is suppose to close on the server.

Any reason why connected() show the connections as active even if they
are
not? Also, what alternative should I use then?

Code:

#!/usr/bin/perl

use IO::Socket::Multicast;
use IO::Socket;
use IO::Select;

my $tcp_port = "4550";
my $tcp_socket = IO::Socket::INET->new(
   Listen=> SOMAXCONN,
   LocalAddr => '0.0.0.0',
   LocalPort => $tcp_port,
   Proto => 'tcp',
   ReuseAddr => 1,
  );
use Socket qw(IPPROTO_TCP TCP_NODELAY);
setsockopt( $tcp_socket, IPPROTO_TCP, TCP_NODELAY, 1);

use constant GROUP => '239.2.0.81';
use constant PORT  => '6550';
my $udp_socket=
IO::Socket::Multicast->new(Proto=>'udp',LocalPort=>PORT);
$udp_socket->mcast_add(GROUP) || die "Couldn't set group: $!\n";

my $read_select  = IO::Select->new();
my $write_select = IO::Select->new();

$read_select->add($tcp_socket);
$read_select->add($udp_socket);

## Loop forever, reading data from the UDP socket and writing it to the
## TCP socket(s).
while (1) {

## No timeout specified (see docs for IO::Select).  This will block
until a TCP
## client connects or we have data.
my @read = $read_select->can_read();

foreach my $read (@read) {

if ($read == $tcp_socket) {

## Handle connect from TCP client.  Note that UDP
connections
are
## stateless (no accept necessary)...
my $new_tcp = $read->accept();
$write_select->add($new_tcp);

}
elsif ($read == $udp_socket) {

## Handle data received from UDP socket...
my $recv_buffer;

$udp_socket->recv($recv_buffer, 1024, undef);

## Write the data read from UDP out to the TCP client(s).
Again, no
## timeout.  This will block until a TCP socket is writable.
my @write = $write_select->can_write();

foreach my $write (@write) {

## Make sure the socket is still connected before
writing.
   if ($write->connected()) {
 $write->send($recv_buffer);
   }
else {
$write_select->remove($write);
close $write;

}

}

}

}

}

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Problem in installing ActivePerl 5.10 on Windows 7 with x64 chipset

2010-04-14 Thread Bob McConnell
From: Sisyphus
> - Original Message - 
> From: "CHAN, KENNETH

>>   I tried to Google it but couldn't find a solution. Do you have any
>> idea how to fix it and install ActivePerl properly? Thanks in
advance.
>> 
>> ===
>
> Not really - seems like some sort of permissions issue. Someone on the

> ActivePerl mailing list might have a better idea. I use the x64 build
of 
> ActivePerl 5.10.1 (build 1007) - but I installed from the .zip package

> (instead of the msi installer).
> If you think that could be worth a try just download the zip package,
unzip 
> it to some temporary location, 'cd' to that location and run
'installer.bat' 
> (or is it 'install.bat' ? ... I can never remember).  Afaik, that 
> installation method doesn't mess with the registry at all. After it's 
> installed you can then 'rmdir /s /q' the "temporary location".

To install on 64 bit systems, you need a 64 bit installer that knows it
is installing a 32 bit application. Otherwise, by default MS-Windows
will install the registry entries in the 64 bit hive where the 32 bit
apps can't find them.

Has ActiveState produced a 64 bit package yet?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Looping in Test::Harness

2010-04-09 Thread Bob McConnell
From: Uri Guttman

>>>>> "BM" == Bob McConnell  writes:

>  BM> From: Philip Potter
>  >> On 6 April 2010 16:52, Bob McConnell  wrote:
>  >>> I have a test harness set up with a series of Selenium test
scripts.
>  >>> Each script tests a specific scenario on my web site. But I have
some
>  >>> scenarios that I want to test multiple times with different data
>  BM> entered
>  >>> each time. Currently I am using environment parameters to pass
the
>  BM> test
>  >>> data into each script. But that doesn't work for multiple passes,
>  BM> since
>  >>> I have no way to save the base data and restore it after
modifying
>  BM> it.
>  >>> 
>  >> [snip]
>  >>> 
>  >>> How can I make this loop through some tests multiple times with
>  >>> different sets of data each time?
> 
>  BM> After a great deal of reading and speculation, it looks like YAML
is the
>  BM> way to go. I will have to move the loop inside each test script,
and
>  BM> iterate thorough the records read. The biggest problem is that
the plan
>  BM> is no longer fixed, so I do lose some auditability, but I don't
see a
>  BM> cleaner way to do this.
> 
> i call this table driven testing. i have done it for several of my
> modules which required many variations on a theme. check out the test
> code in Sort::Maker. it does a double level loop on each test with
> different data and different arguments (sort methods). it doesn't need
> external files as the args are in a perl data structure. the concept
is
> very simple and easy to implement. it needs to be customized for your
> testing but you can steal the overall design from there.

Working examples are good, I'll take a look at that. But this is for
integration test, not a unit test.

>  BM> I will end up with a test.yml file (which I didn't even know
existed
>  BM> when I got the referenced message) defining an array of hashes,
each
>  BM> with input for one iteration of the test. I'll loop over the
whole
>  BM> scenario, stepping through the array until it is gone.
> 
> you can even use perl itself. just write a perl data structure and
> call do on it. it can be an anon array or hash which is the returned
> value. no need to learn yaml or load another module. you can also
> slurp/eval the file (which is what do does anyhow). or do what i did
and
> put the data in the test file, write a shared driver module which you
> load and then you write a simple wrapper to run the tests. also you
can
> still do a plan. all you need to do is prescan the data to count all
the
> tests (and variations) and send that to the test plan. i do that too.

But QA techs and managers won't be able to read or extend the data in
Perl. What attracted me to YAML specifically was that other less
technical folks should be able to modify and add test cases. Once I am
done with this, it will get checked into Perforce and may eventually
become part of a Hudson managed regression test suite. I will add more
test scripts, but they will need to maintain the individual cases. In
some situations, I expect they will want to completely rewrite the input
data set using data sets exported from other related systems.

>  BM> Then the next step will be to figure out how to do fuzz testing
on those
>  BM> forms. The response to submitting a form will change with each
incorrect
>  BM> input, which will present a challenge in how to detect which
response is
>  BM> correct and how to react to each one.
> 
> you write pairs of inputs and expected outputs in your data. not
tricky
> at all. in my structures i have input data, golden sort code (which is
> supposed to generate expected results) or expected results. you then
> compare the expected to actual results for the ok() call. this is very
> easy for almost any kind of test where you could call ok().

The problem is that I can't define a one to one pairing. There are
multiple fields in the forms that interact, so one value in a field may
cause different results depending on the values in one or more of the
other fields. For example, if I enter a valid VISA card number but
select Discover from a drop down, whether everything else is correct or
not, I should get a specific error. When they match correctly and I
enter a valid but incorrect zip code for that card, I get a different
error. Even with the correct zip code, an incorrect street address will
produce another error. (No, I haven't figured out what happens if both
the zip and address are wrong. I assume one of them takes precedence,
but the vendor's document doesn't say.) I just can't see any logical way
to map all of these interactions.

But thank you for the suggestions and pointers. I have a lot more to
learn before I resolve these problems.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Looping in Test::Harness

2010-04-09 Thread Bob McConnell
From: Philip Potter

> On 6 April 2010 16:52, Bob McConnell  wrote:
>> I have a test harness set up with a series of Selenium test scripts.
>> Each script tests a specific scenario on my web site. But I have some
>> scenarios that I want to test multiple times with different data
entered
>> each time. Currently I am using environment parameters to pass the
test
>> data into each script. But that doesn't work for multiple passes,
since
>> I have no way to save the base data and restore it after modifying
it.
>>
> [snip]
>>
>> Is there a cleaner way to pass those variables into each test script?
>>
>> How can I make this loop through some tests multiple times with
>> different sets of data each time?
> 
> I suppose you could group your variables by testcase and put them into
> a configuration file (say testcases.yml) and get each test to read in
> the configuration using Config::Any. With Config::Any you can use most
> config file formats: XML, YAML, JSON, .ini, etc.
> 
> Also you can use prove.exe to run tests under harness rather than
> using your perl one-liner. http://search.cpan.org/perldoc?prove for
> details though I normally just do "prove -bv t/*.t".

After a great deal of reading and speculation, it looks like YAML is the
way to go. I will have to move the loop inside each test script, and
iterate thorough the records read. The biggest problem is that the plan
is no longer fixed, so I do lose some auditability, but I don't see a
cleaner way to do this.

I will end up with a test.yml file (which I didn't even know existed
when I got the referenced message) defining an array of hashes, each
with input for one iteration of the test. I'll loop over the whole
scenario, stepping through the array until it is gone.

Then the next step will be to figure out how to do fuzz testing on those
forms. The response to submitting a form will change with each incorrect
input, which will present a challenge in how to detect which response is
correct and how to react to each one.

Thanks for the suggestions,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Using References in Modules within threads

2010-04-07 Thread Bob McConnell
From: Shawn H Corey

>Shlomi Fish wrote:
>> Nevertheless, if you are going to run Perl on UNIX systems
exclusively, you 
>> shouldn't use threads. And if you're planning to do such
multi-tasking on 
>> Windows using Perl - please reconsider.
> 
> Personally, I don't see why anyone would want to run Windows.  It's
like 
> trying to run a marathon while dragging a bus.

It's not that we want to run MS-Windows, but the PHB's don't give us any
choice.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Looping in Test::Harness

2010-04-06 Thread Bob McConnell
I have a test harness set up with a series of Selenium test scripts.
Each script tests a specific scenario on my web site. But I have some
scenarios that I want to test multiple times with different data entered
each time. Currently I am using environment parameters to pass the test
data into each script. But that doesn't work for multiple passes, since
I have no way to save the base data and restore it after modifying it.

Since I'm stuck with MS-Windows, the test suite is run from a batch file
like so:

--8<---
  @echo off
  
  REM This script sets a number of environment parameters, then runs all
of the Perl
  REM test scripts in the Tests/ directory.
  
  REM First we set some basic parameters
  
  set MMID_BROWSER=firefox
  set MMID_SITE=tst11.dev
  set MMID_BUILD=0044_00
  set mmid_user=devmmi...@tpsmail.dev
  set MMID_PWD=password1
  set MMID_FIRSTNAME=James
  set MMID_LASTNAME=Smith
  set MMID_USID=146702
  
  REM Then run all of the Perl test scripts in the Tests directory.
  
  perl -MTest::Harness -e "@ARGV= map glob, @ARGV   if  $^O =~ /^MSWin/;
runtests @ARGV;" Tests/*.pl
--8<---

Each test script starts out something like this:

--8<---
  use strict;
  use warnings;
  use Time::HiRes qw(sleep);
  use Test::WWW::Selenium;
  use Test::More tests => 24;
  use Test::Exception;
  use Env;
  
  my $browser = $ENV{'MMID_BROWSER'};
  my $site = $ENV{'MMID_SITE'};
  my $build = $ENV{'MMID_BUILD'};
  
  my $user = $ENV{'MMID_USER'};
  my $pwd = $ENV{'MMID_PWD'};
  
  my $sel = Test::WWW::Selenium->new( host => "localhost",
  port => ,
  browser => "*$browser",
  browser_url =>
"http://$site.example.com/"; );
  
  $sel->open_ok("http://$site.example.com/";);
  $sel->set_speed("500");
  sleep 5;
  cmp_ok ($sel->get_text("css=div[id=footerNarrow]"), "=~", $build,
"Correct build number")
or BAIL_OUT("Build number doesn't match!");
  
  like($sel->get_title(), qr/ - Login/, "Login page");
  $sel->type_ok("LoginID", "$user");
  $sel->type_ok("LoginPWD", "$pwd");
  $sel->click_ok("LoginSubmit");
  $sel->wait_for_page_to_load_ok("1");
--8<---

Is there a cleaner way to pass those variables into each test script?

How can I make this loop through some tests multiple times with
different sets of data each time?

Is there a better forum for these questions?

Thank you,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: hv_store hoh

2010-04-01 Thread Bob McConnell
From: Patrick Dupre

> I do not know what to tell you.
> 
> I tried another webmail, but I cannot sent an empty email with an
empty
> subjet !!!

Just put the word "Subscribe" in each field. The server will ignore
them.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Connecting to a socket

2010-03-31 Thread Bob McConnell
From: Rene Schickbauer

> walt wrote:
>> I am new to Perl and want to connect to an smtp server on port 25 and
then
>> send it the helo, mail from:, rcpt to:, data, commands but I would
also like
>> to evaluate the response from the smtp server.
>> 
>> Has anyone got a script or can point me in the right direction?
> 
> A simple example on how to work with sockets can be found here:
> <http://www.osix.net/modules/article/?id=441>
> 
> (just google for: perl io::socket tutorial)
> 
> As for the protocol, Wikipedia has a good article on that, look 
> especially at the included example:
> 
>
<http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol#SMTP_transpo
rt_example>
> 
> You should really also have a look at the official documentation of
SMTP:
> <http://www.faqs.org/rfcs/rfc821.html>
> 
> And yes, i know RFC821 is deprecated, and there are newer, more 
> complicated, more feature-rich versions of the protocol available. But
i 
> have yet to find a server that doesn't understand the basics layed out

> in this specification.

I believe the current document is RFC2821. It mostly extends the
original protocol and tries to clarify some explanations. So 821 is
still a proper subset. I do think it is best to read 821 first. One
difference that does matter is that the CR+LF pair as line terminator is
now explicitly required by both 2821 and 2822. That was not clear in the
originals.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Where is the error

2010-03-31 Thread Bob McConnell
From: Harry Putnam

> "Uri Guttman"  writes:
> 
> [...]
> 
>> . . . . . . . . . . . . . . . . . . . . . . . . . . . .  but it
>> all starts in your head. a disorganized mind can't ever be a good
>> coder.
> 
> I may be in deep do do here...
> 

Aren't we all?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Get result of a https page with SSL after login.

2010-03-30 Thread Bob McConnell
From: chew23

> To automate my work i have to get a html page by my company site after
a 
> login in an secure area.
> After a long googling job, I decided to use WWW:Selenium to do this.
> It seems to be bugged and i would ask to you if there is e clear
method 
> to do this.

I believe the first step is to go to the Selenium home site and get an
updated copy of Selenium.pm. (Last I checked they hadn't posted recent
updates to CPAN.)

You might also want to look over my wiki page about SeRC and Perl at
<http://wiki.openqa.org/display/SRC/Selenium+RC+and+Perl>. You are
welcome to modify or add to it.

The other option is their Google group at
<http://groups.google.com/group/selenium-users>.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Subroutines With Multiple Parameters

2010-03-26 Thread Bob McConnell
From: Shlomi Fish [mailto:shlo...@iglu.org.il] 
> On Friday 26 Mar 2010 18:39:30 Shawn H Corey wrote:

>> It's nice to be brief but only providing it does interfere with
>> understanding.  Remember:  Hard to understand code is costly to
>> maintain code.
> 
> I don't believe in programming in an idiot-proof manner and avoiding
useful 
> features in order to dumb down the code.

It wouldn't work anyway, since each generation of idiots just gets more
ingenious than the last.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Getting garbage fast

2010-03-23 Thread Bob McConnell
From: Eric Veith1

> this is rather unusual: I want a chunk of random garbage, and I want
it 
> fast. The background is that I have a streaming test, and to run into
some 
> intelligent read-ahead/write-behind/caching algorithm, I need random 
> stuff. /dev/null is fast, but obviously won't do it. /dev/urandom is
too 
> slow. In C, I once resorted in a similar case to using malloc() to get

> some portion of memory without initializing it and writing that, but
Perl 
> doesn't let me access malloc(), at least not via POSIX. I already
tested 
> something like "rand x 100", but that's too slow, too. :-/
> 
> Any ideas are greatly appreciated.

Copy a text or binary file into the stream. Any file in /bin or /sbin
could be used.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Testing with Perl and Selenium RC

2010-03-12 Thread Bob McConnell
Does anyone here know where I can find information about using Perl to
run tests with Selenium Remote Control? There is no Perl specific
information in their documentation or SDK and they don't appear to have
any Perl developers involved in the project any more. I pasted together
some of my notes in a page on their wiki
<http://wiki.openqa.org/display/SRC/Selenium+RC+and+Perl>, but it's not
a very good explanation of how to do it.

Thank you,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Controlling one process depending on the status of another

2010-03-05 Thread Bob McConnell
From: Jay Savage
> On Wed, Mar 3, 2010 at 8:28 AM, Bob McConnell  wrote:
> [snip]
>>
>> However, if the application is this complex, is Perl really the best
>> language to use? It would not be my first choice.
> 
> That is a very strange statement to make on a Perl beginners list, not
> least because it's complete bosh.
> 
> What better language to simple network control structures? This is
> exactly the sort of task that Perl accomplishes better and more easily
> than any other language out there, and why it's "the glue of the
> internet."

The way I read his problem description, it sounded neither simple nor
easy.

While Perl is very useful for a number of things, it is not the best
hammer to use for everything, and I believe that needs to be pointed out
occasionally. Even though Larry has tried to put the kitchen sink into
the interpreter, there are still tools that can do some tasks better
than Perl can. In particular, all too often I see warnings that threads
are still not handled very well in Perl. Until that changes, I will not
consider Perl for anything that requires multi-threaded code.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Controlling one process depending on the status of another

2010-03-04 Thread Bob McConnell
From: Eric Veith1

> Bob,
> 
> what language would you have used? I admit this is my first Perl
project 
> to involve this kind of child process handling. 

Eric,

The final choice depends very much on A) target environment and B)
resources required. The use of libraries, both private and third party,
will also have a marked impact on how long it takes to complete a
project. Personally, I have a lot of C experience (> 20 years) with
various multi-tasking and multi-processing environments. So on a Posix
platform I would probably write the control program in C with pthreads.
On MS-Windows it would still be C, but using a different API. I know
several programmers that would do it in Java, and a couple that would
even fight through it with C++.

How to write the applications also depends on what they need to do. The
description I gave is a rough outline of the MS-Windows Service Control
Manager and the way it interacts with various services and the display
applet. Again, I have written several services in C, so I have working
templates already available for that model. But, if they have a GUI
component, that is a very different requirement from a console/ daemon/
service process, and requires significantly different tool kits. Also,
the choice of OS will dictate some of those requirements. Unfortunately,
there are not a lot of tool kits that are fully portable between
MS-Windows and the rest of the world.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Controlling one process depending on the status of another

2010-03-03 Thread Bob McConnell
From: Jeremiah Foster
> On Feb 26, 2010, at 10:34 PM, Eric Veith1 wrote:
>> 
>> I'm wrinting a perl program that works with different threads.
> 
> Your first sentence already has me worried. Threads are un-fun. 
> 
>> Those 
>> threads depend on each other, not all in the same way. Some threads
should 
>> stop when others are finished with their work, and again others are
to be 
>> started afterwards.
> 
> Now getting really complex.
> 
>> I have six worker machines, M1 to M6, and a controller machine, M0.
The 
>> perl program runs on the controller machine. This program is
basically a 
>> dispatcher I control from a command line interface. A command causes
two 
>> threads to be started, say on M1 and M2.
> 
>At this point, these are really processes. Threads are in the kernel,
you
> are just starting a separate process on two different machines.
> 
>> One thread on M1 produces work, 
>> the other on M2 plots the network traffic. When M1 is finished, I
want the 
>> thread M0 that caused the workload to signal to the dispatcher that
M1 is 
>> finished. The dispatcher then shall signal M2 to stop monitoring. 
>> Afterwards, I want the results from both M1 and M2, preferably in
form of 
>> a perl structure.
> 
> These are all separate processes, not threads. Are you sure you need
to
> use threads? In general a thread is something that runs _inside_ a
> process. http://en.wikipedia.org/wiki/Thread_(computer_science)
> 
>> First of all, is that possible?
> 
> Yes. Not that hard. You have exit values from your process so you can
> trap that and do something based on your exit value.
>> 
>> I have already looked at threads, threads::shared and the traditional

>> fork(). With the standard IPC stuff, I'm able to signal and trap that
in 
>> the master process with a signal handler. But I cannot, however, get
the 
>> PID of the child that emitted the signal, thus I'm not able to send a

>> SIGTERM to another process. I'm also not sure how I could get my
result 
>> data.
> 
> Well, why not just create something in a perl structure and just use
> something like the Storable module or YAML to dump it to disk and you
> can read it from your other machine.
>> 
>> threads::shared allows me to share a perl structure I could fill, but
I 
>> don't know how to signal the master thread. Passing a subroutine
reference 
>> doesn't work, of other options I don't know.
>> 
>> I'd very much appreciate any hints.
> 
> I would avoid threads. I would have a program / process on machine 0
> that fires off another program / process on machine 1. Then I guess
> you need to fire off your program on machine 2 to do network
> monitoring (?). When the program on 1 is finished, it dumps its data
> to disk and call machine 0 who in turn calls 2.

Depending on how much control you have over development of this package,
I would suggest a hybrid approach. First, launch an application which
creates multiple threads to start up the individual processes. Open a
communications channel between each thread and the process it called.
Then use the threads to monitor and/or control the individual processes
until they terminate. Once the process is done, terminate the matching
thread.

When processes run on the local machine, any of the IPC options can be
used for the comm channel. On remote machines it is more likely to be a
socket. Interprocess communications can be done either via IPC or
relayed through the control threads.

However, if the application is this complex, is Perl really the best
language to use? It would not be my first choice.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: being smart about script structure

2009-12-18 Thread Bob McConnell
From: Peter Scott
On Wed, 16 Dec 2009 17:47:16 -0600, Bryan R Harris wrote:
>> Okay, here's one I struggle with often -- is one of these better than
>> the other?
>> 
>> **
>>   A.
>> if ( isFlat($tire) ) { changeTire($tire); }
>> 
>>   B.
>> checkFlatAndChangeTireIfNecessary($tire);
>> 
>> **
> 
> Ah, a recovering Java programmer :-)
> 
> Seriously, the letsRunAsManyWordsAsPossibleTogether style bugs the
heck 
> out of me.  The Perlish style (perldoc perlstyle) would be

There is one other question about B. that I haven't seen mentioned in
this thread. There may be other reasons why you would change that tire.
Would you really want it bound that tightly with CheckFlat() when you
need to add them?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: SMTP black hole script

2009-12-15 Thread Bob McConnell
From: Bob McConnell 

> Just to avoid re-inventing a pair of wheels, does anyone
> have a script that will accept any and all SMTP connections
> and messages, but dumps them into a file instead of trying
> to forward them?

To close the loop on this question, even though I didn't receive any
responses, I found several honey pot packages with SMTP black hole
servers in them. I am reviewing a few of them to see which would be the
best starting point for my requirements.

Thanks,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




SMTP black hole script

2009-12-14 Thread Bob McConnell
Just to avoid re-inventing a pair of wheels, does anyone have a script
that will accept any and all SMTP connections and messages, but dumps
them into a file instead of trying to forward them?

We have several development and test servers that send email. I have a
Port25 appliance server that accepts those messages. But due to the
manner in which the tests are run, many of those messages have addresses
which are not reachable. Currently I am getting a few thousand error
messages each day about them. This quickly overloads the limited disk
space in that appliance and makes it difficult for me to spot any real
problems.

I would like to set up a dummy relay server that would accept all of
those messages and simply dump them into one or more files. I have
downloaded several packages that I may be able to cannibalize, but if
someone has already done this, you would save me a lot of time and
frustration.

Thank you,

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Getting USER env variable in Windows -- How to?

2009-12-09 Thread Bob McConnell
From: Tony Esposito

> I need to get the current USER env var in a Windows Perl
> program.  Does anyone know how this is done?  I have done
> it on UNIX/Linux.

I believe it is labeled USERNAME in the MS-Windows environment.

Bob McConnell



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Simple XML to XLS format

2009-11-02 Thread Bob McConnell
From: Shlomi Fish
> On Saturday 31 Oct 2009 06:38:20 Ganesh Babu N wrote:
>> CPAN modules are meant for Linux. It is very easy to install CPAN
>> modules on Linux.
>> 
>> Please refer http://www.cpan.org/modules/INSTALL.html
>> 
> 
> First of all, CPAN modules are not meant for Linux in particular. Most
CPAN 
> modules work best under most modern and high-quality UNIX-like
operating 
> systems (e.g: Linux, the BSDs, Solaris and OpenSolaris, and to a
lesser extent 
> HP/UX, AIX, etc.), but many can also easily work on the Microsoft
Windows NT-
> based operating systems. Most Perl Authors don't wish to discriminate
against 
> MS-Windows users unless they really need to.
> 
> Some more links than yours are:
> 
> * http://sial.org/howto/perl/life-with-cpan/
> 
> * http://sial.org/howto/perl/life-with-cpan/non-root/
> 
> * http://perl-begin.org/topics/cpan/
> 
> * http://www.shadowcat.co.uk/blog/matt-s-trout/but-i-cant-use-cpan/
> 
>> It is not easy to install CPAN modules directly on Windows. For
>> windows the famous distribution is ActiveState. Please read this for
>> installation of modules http://cpan.uwinnipeg.ca/par/webstart.html
>> 
> 
> Actually, installing CPAN modules on Windows with Strawberry Perl or
cygwin's 
> perl is pretty easy. It's just that ActivePerl has been heavily under-
> maintained and also is dependent on various proprietary tools (such as

> Microsoft Developer Studio), and it took some time for Adam Kennedy
and his 
> good friends to realise that they need to start the Vanilla Perl and 
> Strawberry Perl efforts to create a community-maintained and
free-as-in-speech 
> distribution of perl for Windows.
> 
> If you can, please use Strawberry Perl instead of ActivePerl. See:
> 
> http://win32.perl.org/wiki/index.php?title=Main_Page

I would suggest you also take a look at camelbox. It was the result of a
Google "Summer of Code" project. I have been using it on WinXP for more
than six months with no issues. Modules install directly from CPAN.

 <http://code.google.com/p/camelbox/>

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Larry's filename fixer

2009-10-19 Thread Bob McConnell
From: Mark Wagner

> On Wed, Oct 14, 2009 at 15:38, Felix Dorner  wrote:
>>
>> I did the best book purchase in years: The Perl Cookbook. They have an
>> example that seems to come right from Larry Wall himself. And I don't get
>> it. I can use it but I don't understand why it works with wildcards.
>>
>> $op = shift or die "Usage: rename expr [files]\n";
>> chomp (@ARGV = ) unless @ARGV;
>> for(@ARGV) {
>>   $was = $_;
>>   eval $op;
>>   die $@ if $@;
>>   rename ($was, $_) unless $was eq $_;
>> }
>>
>>
>> #rename.pl s/\.orig// httpd.conf.orig
>>
>> will rename httpd.conf.orig to httpd.conf. But it also works with wildcards:
>>
>> #rename.pl s/\.orig// *
>>
>> will chop .orig from all files in the current directory.
>> So it assigns  to @ARGV. But  is just a * right? Does the
>> shell expand this, or perl? Any comments/detailed explanations welcome.
> 
> IIRC, under *nix, the shell expands it, while under Windows, Perl
> expands it.  It doesn't really matter, because by the time @ARGV is
> populated, it's been expanded and the script only ever sees the
> expansion.

This depends on which distribution of Perl you use on MS-Windows. Only a couple 
of them actually expand the wildcards.

I use this line in a batch file for testing with Camelbox on MS-Windows. Most 
mail clients will wrap it, but it should all be typed on one line. I don't know 
if the extra spaces are significant, but it works so I haven't changed it.

perl -MTest::Harness -e "@ARGV= map glob, @ARGV   if  $^O =~ /^MSWin/; runtests 
@ARGV;" t/*.t

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: yet another question

2009-10-07 Thread Bob McConnell
From: Slick
> 
> What do you guys do to practice? Do you practice one script
> over and over again? Do you read differnt scripts and figure
> out what is happening in each one? Do you think of ideas to
> do things, then make the script for that? 

It sounds to me like you are looking at Perl as a solution, but you haven't 
recognized a problem for it to solve. I suspect most of us have done it the 
other way around.

My job is solving problems. For a long time the primary problem was lack of 
equipment to exercise servers, or the lack of space for that equipment. For 
example, I have written scripts that emulate a variety of cash registers and 
credit card terminals. These scripts open socket connections via TCP/IP and 
send messages that appear to be from real terminals. I can vary the frequency 
of messages, the number of terminals, the payment selection and a variety of 
other parameters. This allows me to do a wide range of functional tests, 
compatibility tests, performance tests, etc. all with a set of Perl scripts.

I have also written emulations for devices that don't yet exist. By working 
from the protocol and message specifications I can test the interface to our 
transaction processors before the terminals can even be shipped by the vendors.

My latest project is to use Test::Harness to drive Selenium Remote Control as 
it does functional and regression tests on web sites. The Selenium IDE captures 
the manual test as a macro and exports it to Perl. I then add additional 
validations, input some variables from the environment and put it into a test 
directory to add to the growing suite of tests.

What problems do you need to solve?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: decimal to binary?

2009-09-23 Thread Bob McConnell
From: Bryan R Harris

>> From: Uri Guttman
>> 
>>>>>>>> "BM" == Bob McConnell  writes:
>>> 
>>>   BM> From: Bryan R Harris
>>>>> 
>>>>> I need to convert a number like this:   -3205.0569059
>>>>> ... into an 8-byte double (big and little endian), e.g. 4f 3e 52
>> 00 2a
>>>   BM> bc 93
>>>>> d3  (I just made up those 8 byte values).
>>>>> 
>>>>> Is this easy in perl?  Are long and short ints easy as well?
>>> 
>>>   BM> The sprintf() family is your friend.
>>> 
>>> that will only generate text (hex and other formats). he needs pack
>>> which does exactly what he wants. read perlpacktut for a tutorial on
>>> pack/unpack and then perlfunc -f pack for the reference on it.
>> 
>> That statement just confuses me. His initial value of -3205.0569059
is
>> also text. It is the human readable representation of the number, and
is
>> not anything like what it looks like inside the computer. He just
asked
>> for a different format for that text. Why is sprintf not a reasonable
>> way to do that?
> 
> The 8 bytes is an IEEE 754-2008 formatted number -- see here for an
> explanation:
>  
>   http://en.wikipedia.org/wiki/Double_precision
> 
> It's not just a simple hex of a decimal...  You've got an exponent and
a
> sign encoded in there too.

OK, that I can understand. However, I don't see where that was expressed
or implied in the original query. Are you assuming that every current
architecture and Perl implementation uses that format to store double
precision numbers? Is that a safe assumption?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: decimal to binary?

2009-09-23 Thread Bob McConnell
From: Uri Guttman

>>>>>> "BM" == Bob McConnell  writes:
> 
>   BM> From: Bryan R Harris
>   >> 
>   >> I need to convert a number like this:   -3205.0569059
>   >> ... into an 8-byte double (big and little endian), e.g. 4f 3e 52
00 2a
>   BM> bc 93
>   >> d3  (I just made up those 8 byte values).
>   >> 
>   >> Is this easy in perl?  Are long and short ints easy as well?
> 
>   BM> The sprintf() family is your friend.
> 
> that will only generate text (hex and other formats). he needs pack
> which does exactly what he wants. read perlpacktut for a tutorial on
> pack/unpack and then perlfunc -f pack for the reference on it.

That statement just confuses me. His initial value of -3205.0569059 is
also text. It is the human readable representation of the number, and is
not anything like what it looks like inside the computer. He just asked
for a different format for that text. Why is sprintf not a reasonable
way to do that?

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: decimal to binary?

2009-09-23 Thread Bob McConnell
From: Bryan R Harris
> 
> I need to convert a number like this:   -3205.0569059
> ... into an 8-byte double (big and little endian), e.g. 4f 3e 52 00 2a
bc 93
> d3  (I just made up those 8 byte values).
> 
> Is this easy in perl?  Are long and short ints easy as well?

The sprintf() family is your friend.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Testing with Selenium

2009-09-23 Thread Bob McConnell
From: Steve Bertrand
> Steve Bertrand wrote:
> > Bob McConnell wrote:
>>>
>>> I have begun the task of automating functional tests for some of our
web
>>> servers. I have had some success using Selenium IDE in Firefox to
>>> capture input sequences, exporting them to Perl scripts, then using
the
>>> Se remote control server to execute them. But I have run into one
minor
>>> problem.
>>>
>>> A basic test is to verify the error message returned when an invalid
>>> password is entered. This test script is shown below. I can run this
as
>>> a simple test, or it can be part of a suite. The command line to
>>> manually run the suite is normally:
>>>
>>> perl -MTest::Harness -e "@ARGV= map glob, @ARGV \
>>>   if  $^O =~ /^MSWin/; runtests @ARGV;" test/*.pl
>>>
>>> Unfortunately, yes this is running on a WinXP system.
>>>
>>> My problem is that we have multiple virtual hosts on that server,
and I
>>> need to select a specific host for each run. So when I run the
harness I
>>> need some way to pass the "tst12.dev" portion of the URL into each
of
>>> the test scripts. I can't see any way with Test::Harness or
Test::More
>>> to do this. If I can, then I have other parameters that need to be
>>> passed in as well.
>> 
>> Do I understand you correctly in believing that you are trying to run
>> specific tests against numerous hosts within a single test file?
> 
> Appears as though I've totally misunderstood what you are after...
> 
> After re-reading, it looks as though you are trying to execute
multiple
> test 'files', and want to supply the hostname (and perhaps other
params)
> into them. Yes?

Yes, I have a 'tests' directory with a growing number of Selenium
scripts that will become an automated regression test. Each time I run
those scripts with Test::Harness I need to pass a server name to each
script. There are other variables I would also like to control.

On my test server there are three hosts that I maintain, which normally
have the current and two previous builds of the application. After I add
or modify a test script, or make a change to the current version, if
there is a test failure I can then run the same test on the previous
versions to find out if they produce the same failure. These test
scripts will be checked into our SCM so the QA and production teams have
access to them as well. In addition, those teams should be able to
record and add scripts that recreate problems they find or any that are
reported by clients. Once fixed, those tests will also become part of
the regression suite.

This reduces the time to run a reasonably complete regression test from
most of a man-week to a couple of hours.

Paul's suggestion of environment variables appears to be the only viable
option I have seen so far.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Testing with Selenium

2009-09-22 Thread Bob McConnell
Good morning,

I have begun the task of automating functional tests for some of our web
servers. I have had some success using Selenium IDE in Firefox to
capture input sequences, exporting them to Perl scripts, then using the
Se remote control server to execute them. But I have run into one minor
problem.

A basic test is to verify the error message returned when an invalid
password is entered. This test script is shown below. I can run this as
a simple test, or it can be part of a suite. The command line to
manually run the suite is normally:

perl -MTest::Harness -e "@ARGV= map glob, @ARGV \
  if  $^O =~ /^MSWin/; runtests @ARGV;" test/*.pl

Unfortunately, yes this is running on a WinXP system.

My problem is that we have multiple virtual hosts on that server, and I
need to select a specific host for each run. So when I run the harness I
need some way to pass the "tst12.dev" portion of the URL into each of
the test scripts. I can't see any way with Test::Harness or Test::More
to do this. If I can, then I have other parameters that need to be
passed in as well.

Any suggestions?

Bob McConnell


--8<
# Check for invalid password
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";  # currently 9 tests
use Test::Exception;

# The SeRC server must already be running in another process.
my $sel = Test::WWW::Selenium->new( host => "localhost",
port => ,
browser => "*chrome",
browser_url =>
"http://tst12.dev.managemyid.com/"; );

$sel->open_ok("http://tst12.dev.managemyid.com/";);
$sel->set_speed("1000");# without this line, everything
will error out.
$sel->wait_for_page_to_load_ok("1");

$sel->type_ok("LoginID", "devmmi...@tpsmail.dev");
$sel->type_ok("LoginPWD", "password");
$sel->click_ok("LoginSubmit");

$sel->wait_for_page_to_load_ok("1");

like($sel->get_title(), qr/ManageMyID.com - Login/, "Login failed");
cmp_ok ($sel->get_text("css=div[class=Error]"), "=~",
"Invalid Email Address and / or Password for", "Correct error
message");
--8<

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




  1   2   >