[28045] in Perl-Users-Digest
Perl-Users Digest, Issue: 9409 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 30 06:05:47 2006
Date: Fri, 30 Jun 2006 03:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 30 Jun 2006 Volume: 10 Number: 9409
Today's topics:
Re: accessing object variables from callback function <kaisung@gmail.com>
Re: accessing object variables from callback function <rvtol+news@isolution.nl>
Cam::PDF question <LtCommander@gmail.com>
new CPAN modules on Fri Jun 30 2006 (Randal Schwartz)
Posting Guidelines for comp.lang.perl.misc ($Revision: tadmc@augustmail.com
Re: Professional IDE for a cross-platform Perl applicat <catdogbeloved@yahoo.com>
Re: Professional IDE for a cross-platform Perl applicat <catdogbeloved@yahoo.com>
Re: Question on printerhandling <"v.niekerk at hccnet.nl">
Re: Question on printerhandling anno4000@zrz.tu-berlin.de
Re: Question on printerhandling <rvtol+news@isolution.nl>
Re: Question on printerhandling <"v.niekerk at hccnet.nl">
Re: Question on printerhandling <rvtol+news@isolution.nl>
Re: stuck in a while loop anno4000@zrz.tu-berlin.de
Re: stuck in a while loop <no@email.com>
Re: stuck in a while loop <rvtol+news@isolution.nl>
test value <shane@weasel.is-a-geek.net>
Re: test value <sisyphus1@nomail.afraid.org>
Re: test value <john@castleamber.com>
Re: test value <josef.moellers@fujitsu-siemens.com>
Re: validating data before trusting to use in a system anno4000@zrz.tu-berlin.de
Re: WIN32 PPM and perldoc problems <sisyphus1@nomail.afraid.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Jun 2006 23:01:10 -0700
From: "kaisung@gmail.com" <kaisung@gmail.com>
Subject: Re: accessing object variables from callback function
Message-Id: <1151647270.641620.115930@x69g2000cwx.googlegroups.com>
Thanks for the tip on closures, that's what I was looking for. For
completeness, here's what my final program looks like.
-Kai
-----BEGIN MyTest.pm-----
#################################
# A simple class that loads an
# XML file and returns the number
# of tags in the file.
#################################
package MyTest;
use XML::Parser;
# Create a new object
sub new {
my $invocant = shift;
my $class = ref($invocant) || $invocant;
my $self = { @_ };
bless($self, $class);
return $self;
}
# Load an xml file and count the number of tags
sub load {
my $self = shift;
my $file = shift;
my $parser = XML::Parser->new(ErrorContext => 2);
$parser->setHandlers(Start => sub { $self->_start_handler(@_); });
$parser->parsefile($file);
}
# Return the number of tags in loaded xml file
sub numTags {
my $self = shift;
return $self->{numTags};
}
# Private method
sub _start_handler {
my $self = shift;
my $p = shift;
$self->{numTags}++;
}
1;
-----END MyTest.pm-----
-----BEGIN mytest.pl-----
#!/usr/bin/perl -w
use MyTest;
my $test = MyTest->new();
$test->load("test.html");
print "numTags = " . $test->numTags() . "\n";
-----END mytest.pl-----
------------------------------
Date: Fri, 30 Jun 2006 09:24:11 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: accessing object variables from callback function
Message-Id: <e82qmo.1ik.1@news.isolution.nl>
kaisung@gmail.com schreef:
> package MyTest;
Missing:
use strict ;
use warnings ;
> use XML::Parser;
>
> # Create a new object
> sub new { [...]
> }
>
> # Load an xml file and count the number of tags
> sub load { [...]
> }
>
> # Return the number of tags in loaded xml file
> sub numTags { [...]
> }
> [...]
> 1;
> -----END MyTest.pm-----
>
> -----BEGIN mytest.pl-----
> #!/usr/bin/perl -w
Missing:
use strict ;
If your perl is not very old, replace the -w (in the shebang) by the
lexical
use warnings ;
> use MyTest;
>
> my $test = MyTest->new();
Variant:
my $test = new MyTest ;
> $test->load("test.html");
> print "numTags = " . $test->numTags() . "\n";
Variant:
$test->load('test.html') ;
print "numTags = @{[ $test->numTags() ]}\n" ;
or even:
print "numTags = $test->{numTags}\n" ;
(which bypasses the method)
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 30 Jun 2006 03:01:24 -0700
From: "LtCommander" <LtCommander@gmail.com>
Subject: Cam::PDF question
Message-Id: <1151661684.842559.119270@d56g2000cwd.googlegroups.com>
Hi all,
I am using the CAM::PDF module to extract text from PDF files. (It's an
AMAZING module!!) You can pretty much do everything with it.
My snippet for extracting text from a PDF file is:
$pdf = CAM::PDF->new($Fil);
$page = $pdf->getPageText($Pg);
This works fine for all pages without any graphics. I am able to print
the contents of $page without any problems whatsoever. However, if a
particular page has some sort of an inline graphic, the $page returns
an empty value!
I was wondering:
- If somebody knows how to remove all the graphics from the $pdf object
before running the next line of code. I think that should fix it and no
longer return any empty string.
I've tried searching plenty but no luck so far!
Would be grateful for your help.
Vince
------------------------------
Date: Fri, 30 Jun 2006 04:42:12 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Jun 30 2006
Message-Id: <J1np2C.175E@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Algorithm-RabinKarp-0.38
http://search.cpan.org/~nnunley/Algorithm-RabinKarp-0.38/
Rabin-Karp streaming hash
----
Apache-Upload-Slurp-00.01
http://search.cpan.org/~ebruni/Apache-Upload-Slurp-00.01/
Component to slurp all uploaded file
----
Catalyst-Action-RenderView-0.02
http://search.cpan.org/~mramberg/Catalyst-Action-RenderView-0.02/
Sensible default end action.
----
Catalyst-Plugin-Authentication-Store-DBIC-0.07
http://search.cpan.org/~dkamholz/Catalyst-Plugin-Authentication-Store-DBIC-0.07/
Authentication and authorization against a DBIx::Class or Class::DBI model.
----
Catalyst-Plugin-Session-PerUser-0.03
http://search.cpan.org/~dkamholz/Catalyst-Plugin-Session-PerUser-0.03/
Per user sessions (instead of per browser sessions).
----
DBIx-Class-0.06999_04
http://search.cpan.org/~jrobinson/DBIx-Class-0.06999_04/
Extensible and flexible object <-> relational mapper.
----
Deco-0.05
http://search.cpan.org/~narked/Deco-0.05/
Module for simulating body tissue during a scuba dive
----
Exception-Class-DBI-0.94
http://search.cpan.org/~dwheeler/Exception-Class-DBI-0.94/
DBI Exception objects
----
File-HomeDir-0.60_01
http://search.cpan.org/~adamk/File-HomeDir-0.60_01/
Get the home directory for yourself or other users
----
GD-Tab-Ukulele-0.01
http://search.cpan.org/~tateno/GD-Tab-Ukulele-0.01/
Ukulele tab image generator.
----
Graph-0.76
http://search.cpan.org/~jhi/Graph-0.76/
graph data structures and algorithms
----
Gtk2-Ex-DBITableFilter-0.04
http://search.cpan.org/~ofeyaikon/Gtk2-Ex-DBITableFilter-0.04/
----
Gtk2-Sexy-0.02
http://search.cpan.org/~flora/Gtk2-Sexy-0.02/
Perl interface to the sexy widget collection
----
Language-XS-0.02
http://search.cpan.org/~mlehmann/Language-XS-0.02/
Write XS code on the fly and load it dynamically.
----
Lemonldap-Config-Parameters-3.0.0
http://search.cpan.org/~egerman/Lemonldap-Config-Parameters-3.0.0/
Backend of configuration for lemonldap SSO system
----
Module-List-0.001
http://search.cpan.org/~zefram/Module-List-0.001/
module `directory' listing
----
Object-Accessor-0.20
http://search.cpan.org/~kane/Object-Accessor-0.20/
----
Regexp-MultiLanguage-0.02
http://search.cpan.org/~robwalker/Regexp-MultiLanguage-0.02/
Convert common regular expressions checks in to Perl, PHP, and JavaScript code.
----
Regexp-MultiLanguage-0.03
http://search.cpan.org/~robwalker/Regexp-MultiLanguage-0.03/
Convert common regular expressions checks in to Perl, PHP, and JavaScript code.
----
Set-Cluster-0.01
http://search.cpan.org/~tonvoon/Set-Cluster-0.01/
Distribute items across nodes in a load balanced way and show takeovers in failure scenarios
----
Spreadsheet-WriteExcel-FromXML-1.1
http://search.cpan.org/~bwmcadams/Spreadsheet-WriteExcel-FromXML-1.1/
Create Excel Spreadsheet from XML
----
TAP-1.00
http://search.cpan.org/~petdance/TAP-1.00/
The Test Anything Protocal
----
Test-Distribution-1.26
http://search.cpan.org/~srshah/Test-Distribution-1.26/
perform tests on all modules of a distribution
----
Test-Parser-1.3
http://search.cpan.org/~bryce/Test-Parser-1.3/
Base class for parsing log files from test runs, and displays in an XML syntax.
----
Test-TAP-XML-0.03
http://search.cpan.org/~wonko/Test-TAP-XML-0.03/
Output test results as XML
----
Text-Ngram-0.10
http://search.cpan.org/~ambs/Text-Ngram-0.10/
Ngram analysis of text
----
Time-UTC-Now-0.003
http://search.cpan.org/~zefram/Time-UTC-Now-0.003/
determine current time in UTC correctly
----
XML-Filter-RemoveEmpty-0.02
http://search.cpan.org/~kulp/XML-Filter-RemoveEmpty-0.02/
Filter out tags with no character data
----
backup-1.5
http://search.cpan.org/~johngh/backup-1.5/
renames multiple files to have their timestamp in the filename
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 30 Jun 2006 07:22:18 GMT
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
Message-Id: <44a4d12a$0$57729$ae4e5890@news.nationwide.net>
Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information
- Do not provide too much information
- Do not post binaries, HTML, or MIME
Social faux pas to avoid
- Asking a Frequently Asked Question
- Asking a question easily answered by a cursory doc search
- Asking for emailed answers
- Beware of saying "doesn't work"
- Sending a "stealth" Cc copy
Be extra cautious when you get upset
- Count to ten before composing a followup when you are upset
- Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------
Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
This newsgroup, commonly called clpmisc, is a technical newsgroup
intended to be used for discussion of Perl related issues (except job
postings), whether it be comments or questions.
As you would expect, clpmisc discussions are usually very technical in
nature and there are conventions for conduct in technical newsgroups
going somewhat beyond those in non-technical newsgroups.
The article at:
http://www.catb.org/~esr/faqs/smart-questions.html
describes how to get answers from technical people in general.
This article describes things that you should, and should not, do to
increase your chances of getting an answer to your Perl question. It is
available in POD, HTML and plain text formats at:
http://www.augustmail.com/~tadmc/clpmisc.shtml
For more information about netiquette in general, see the "Netiquette
Guidelines" at:
http://andrew2.andrew.cmu.edu/rfc/rfc1855.html
A note to newsgroup "regulars":
Do not use these guidelines as a "license to flame" or other
meanness. It is possible that a poster is unaware of things
discussed here. Give them the benefit of the doubt, and just
help them learn how to post, rather than assume
A note about technical terms used here:
In this document, we use words like "must" and "should" as
they're used in technical conversation (such as you will
encounter in this newsgroup). When we say that you *must* do
something, we mean that if you don't do that something, then
it's unlikely that you will benefit much from this group.
We're not bossing you around; we're making the point without
lots of words.
Do *NOT* send email to the maintainer of these guidelines. It will be
discarded unread. The guidelines belong to the newsgroup so all
discussion should appear in the newsgroup. I am just the secretary that
writes down the consensus of the group.
Before posting to comp.lang.perl.misc
Must
This section describes things that you *must* do before posting to
clpmisc, in order to maximize your chances of getting meaningful replies
to your inquiry and to avoid getting flamed for being lazy and trying to
have others do your work.
The perl distribution includes documentation that is copied to your hard
drive when you install perl. Also installed is a program for looking
things up in that (and other) documentation named 'perldoc'.
You should either find out where the docs got installed on your system,
or use perldoc to find them for you. Type "perldoc perldoc" to learn how
to use perldoc itself. Type "perldoc perl" to start reading Perl's
standard documentation.
Check the Perl Frequently Asked Questions (FAQ)
Checking the FAQ before posting is required in Big 8 newsgroups in
general, there is nothing clpmisc-specific about this requirement.
You are expected to do this in nearly all newsgroups.
You can use the "-q" switch with perldoc to do a word search of the
questions in the Perl FAQs.
Check the other standard Perl docs (*.pod)
The perl distribution comes with much more documentation than is
available for most other newsgroups, so in clpmisc you should also
see if you can find an answer in the other (non-FAQ) standard docs
before posting.
It is *not* required, or even expected, that you actually *read* all of
Perl's standard docs, only that you spend a few minutes searching them
before posting.
Try doing a word-search in the standard docs for some words/phrases
taken from your problem statement or from your very carefully worded
"Subject:" header.
Really Really Should
This section describes things that you *really should* do before posting
to clpmisc.
Lurk for a while before posting
This is very important and expected in all newsgroups. Lurking means
to monitor a newsgroup for a period to become familiar with local
customs. Each newsgroup has specific customs and rituals. Knowing
these before you participate will help avoid embarrassing social
situations. Consider yourself to be a foreigner at first!
Search a Usenet archive
There are tens of thousands of Perl programmers. It is very likely
that your question has already been asked (and answered). See if you
can find where it has already been answered.
One such searchable archive is:
http://groups.google.com/advanced_group_search
If You Like
This section describes things that you *can* do before posting to
clpmisc.
Check Other Resources
You may want to check in books or on web sites to see if you can
find the answer to your question.
But you need to consider the source of such information: there are a
lot of very poor Perl books and web sites, and several good ones
too, of course.
Posting to comp.lang.perl.misc
There can be 200 messages in clpmisc in a single day. Nobody is going to
read every article. They must decide somehow which articles they are
going to read, and which they will skip.
Your post is in competition with 199 other posts. You need to "win"
before a person who can help you will even read your question.
These sections describe how you can help keep your article from being
one of the "skipped" ones.
Is there a better place to ask your question?
Question should be about Perl, not about the application area
It can be difficult to separate out where your problem really is,
but you should make a conscious effort to post to the most
applicable newsgroup. That is, after all, where you are the most
likely to find the people who know how to answer your question.
Being able to "partition" a problem is an essential skill for
effectively troubleshooting programming problems. If you don't get
that right, you end up looking for answers in the wrong places.
It should be understood that you may not know that the root of your
problem is not Perl-related (the two most frequent ones are CGI and
Operating System related), so off-topic postings will happen from
time to time. Be gracious when someone helps you find a better place
to ask your question by pointing you to a more applicable newsgroup.
How to participate (post) in the clpmisc community
Carefully choose the contents of your Subject header
You have 40 precious characters of Subject to win out and be one of
the posts that gets read. Don't waste them. Take care while
composing them, they are the key that opens the door to getting an
answer.
Spend them indicating what aspect of Perl others will find if they
should decide to read your article.
Do not spend them indicating "experience level" (guru, newbie...).
Do not spend them pleading (please read, urgent, help!...).
Do not spend them on non-Subjects (Perl question, one-word
Subject...)
For more information on choosing a Subject see "Choosing Good
Subject Lines":
http://www.cpan.org/authors/id/D/DM/DMR/subjects.post
Part of the beauty of newsgroup dynamics, is that you can contribute
to the community with your very first post! If your choice of
Subject leads a fellow Perler to find the thread you are starting,
then even asking a question helps us all.
Use an effective followup style
When composing a followup, quote only enough text to establish the
context for the comments that you will add. Always indicate who
wrote the quoted material. Never quote an entire article. Never
quote a .signature (unless that is what you are commenting on).
Intersperse your comments *following* each section of quoted text to
which they relate. Unappreciated followup styles are referred to as
"top-posting", "Jeopardy" (because the answer comes before the
question), or "TOFU" (Text Over, Fullquote Under).
Reversing the chronology of the dialog makes it much harder to
understand (some folks won't even read it if written in that style).
For more information on quoting style, see:
http://web.presby.edu/~nnqadmin/nnq/nquote.html
Speak Perl rather than English, when possible
Perl is much more precise than natural language. Saying it in Perl
instead will avoid misunderstanding your question or problem.
Do not say: I have variable with "foo\tbar" in it.
Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
or I have $var = <DATA> (and show the data line).
Ask perl to help you
You can ask perl itself to help you find common programming mistakes
by doing two things: enable warnings (perldoc warnings) and enable
"strict"ures (perldoc strict).
You should not bother the hundreds/thousands of readers of the
newsgroup without first seeing if a machine can help you find your
problem. It is demeaning to be asked to do the work of a machine. It
will annoy the readers of your article.
You can look up any of the messages that perl might issue to find
out what the message means and how to resolve the potential mistake
(perldoc perldiag). If you would like perl to look them up for you,
you can put "use diagnostics;" near the top of your program.
Do not re-type Perl code
Use copy/paste or your editor's "import" function rather than
attempting to type in your code. If you make a typo you will get
followups about your typos instead of about the question you are
trying to get answered.
Provide enough information
If you do the things in this item, you will have an Extremely Good
chance of getting people to try and help you with your problem!
These features are a really big bonus toward your question winning
out over all of the other posts that you are competing with.
First make a short (less than 20-30 lines) and *complete* program
that illustrates the problem you are having. People should be able
to run your program by copy/pasting the code from your article. (You
will find that doing this step very often reveals your problem
directly. Leading to an answer much more quickly and reliably than
posting to Usenet.)
Describe *precisely* the input to your program. Also provide example
input data for your program. If you need to show file input, use the
__DATA__ token (perldata.pod) to provide the file contents inside of
your Perl program.
Show the output (including the verbatim text of any messages) of
your program.
Describe how you want the output to be different from what you are
getting.
If you have no idea at all of how to code up your situation, be sure
to at least describe the 2 things that you *do* know: input and
desired output.
Do not provide too much information
Do not just post your entire program for debugging. Most especially
do not post someone *else's* entire program.
Do not post binaries, HTML, or MIME
clpmisc is a text only newsgroup. If you have images or binaries
that explain your question, put them in a publically accessible
place (like a Web server) and provide a pointer to that location. If
you include code, cut and paste it directly in the message body.
Don't attach anything to the message. Don't post vcards or HTML.
Many people (and even some Usenet servers) will automatically filter
out such messages. Many people will not be able to easily read your
post. Plain text is something everyone can read.
Social faux pas to avoid
The first two below are symptoms of lots of FAQ asking here in clpmisc.
It happens so often that folks will assume that it is happening yet
again. If you have looked but not found, or found but didn't understand
the docs, say so in your article.
Asking a Frequently Asked Question
It should be understood that you may have missed the applicable FAQ
when you checked, which is not a big deal. But if the Frequently
Asked Question is worded similar to your question, folks will assume
that you did not look at all. Don't become indignant at pointers to
the FAQ, particularly if it solves your problem.
Asking a question easily answered by a cursory doc search
If folks think you have not even tried the obvious step of reading
the docs applicable to your problem, they are likely to become
annoyed.
If you are flamed for not checking when you *did* check, then just
shrug it off (and take the answer that you got).
Asking for emailed answers
Emailed answers benefit one person. Posted answers benefit the
entire community. If folks can take the time to answer your
question, then you can take the time to go get the answer in the
same place where you asked the question.
It is OK to ask for a *copy* of the answer to be emailed, but many
will ignore such requests anyway. If you munge your address, you
should never expect (or ask) to get email in response to a Usenet
post.
Ask the question here, get the answer here (maybe).
Beware of saying "doesn't work"
This is a "red flag" phrase. If you find yourself writing that,
pause and see if you can't describe what is not working without
saying "doesn't work". That is, describe how it is not what you
want.
Sending a "stealth" Cc copy
A "stealth Cc" is when you both email and post a reply without
indicating *in the body* that you are doing so.
Be extra cautious when you get upset
Count to ten before composing a followup when you are upset
This is recommended in all Usenet newsgroups. Here in clpmisc, most
flaming sub-threads are not about any feature of Perl at all! They
are most often for what was seen as a breach of netiquette. If you
have lurked for a bit, then you will know what is expected and won't
make such posts in the first place.
But if you get upset, wait a while before writing your followup. I
recommend waiting at least 30 minutes.
Count to ten after composing and before posting when you are upset
After you have written your followup, wait *another* 30 minutes
before committing yourself by posting it. You cannot take it back
once it has been said.
AUTHOR
Tad McClellan <tadmc@augustmail.com> and many others on the
comp.lang.perl.misc newsgroup.
------------------------------
Date: 30 Jun 2006 00:50:30 -0700
From: "Bob" <catdogbeloved@yahoo.com>
Subject: Re: Professional IDE for a cross-platform Perl application
Message-Id: <1151653830.197890.73300@h44g2000cwa.googlegroups.com>
Re: Ala Qumsieh
> Hmm .. I don't think Perl/Tk is 15 years old, but I digress :)
The first version was written in a DOS-based database. The
unix-based perl/tk version is the latest of ports. The former
was perl/cgi running under a web browser.
>> - the client is not compiled, and thus runs slowly;
>
> Compiling won't speed it up. You have to look at where your client is
> spending most of its time, and optimize that code.
I profiled it, but is a complex client. I am thinking about converting
the main routines into C, and use them as libraries.
> > - the client must now run also on osx and windows, natively;
>
> Perl is cross-platform for the most part. So unless you hard-code
> linux-specific stuff, or you use platform-dependent modules, your code
> should run fine on other platforms.
The application uses linux-specific features, such as the use of the
shell
to trigger other languages and routines. Perl is sweet when
prototyping,
but there comes a time when one must tie all strings together.
> > - the client's tk-based gui is limited, but I have no clue about
> > cross-platform alternatives;
>
> Tk runs on most, if not all, platforms that Perl runs on. It certainly runs
> well on windows, *nix and OSX. No need for alternatives.
I need the client to be compiled.
> > - each time I try to port it to windows or osx I get missing components
> > and misbehaviours.
>
> First thing, I guess, is to install any missing modules. What kind of
> misbehaviours are you seeing?
Missing modules, yes. I cannot install cygwin and the whole world of
linux-like utilties and libraries into a machine that is now my own,
and
I cannot even ask people to install it by themselves, because it takes
time and skill they do not have. It is hard enough to run it in linux,
as
I have to keep it up with things breaking at package updates.
> > How do I reshape the client so that I can develop it in one machine and
> > generate reliable and installable executables for other platforms?
>
> make sure you don't use any platform-specific code, unless you have to. If
> you do, then make sure you isolate the code, using something like
> (untested):
>
> BEGIN {
> if ($^O =~ /win/i) {
> require Win32::Specific::Module;
> } elsif ($^O eq 'linux') {
> require Linux::Specific::Module;
> }
> }
Yes, thank you, but we are off road.
Bob
------------------------------
Date: 30 Jun 2006 01:00:47 -0700
From: "Bob" <catdogbeloved@yahoo.com>
Subject: Re: Professional IDE for a cross-platform Perl application
Message-Id: <1151654447.672833.196290@d56g2000cwd.googlegroups.com>
Re: Ch Lamprecht
> I use perl-tk 804 for a Pg client application and haven't encountered these
> problems yet. The Tk-GUI is times faster than the Network / Server side.
OK
> I would recommend, that you do some profiling on your applications code to see
> which parts of your code take most of its time. Otherwise you might be
> disappointed after working for days on another GUI.
At this time, there is no separation between the actual application and
the gui.
I want to divide them. I also do not want to work by hand on another
GUI.
As stated above, I am searching for an integrated development
environment
that would take care of the GUI and its porting. I do not want to type
code
for the GUI, and debug it, and port it, and and and. I am done with
that mess above.
> Porting from/to Linux/Windows works perfectly without changing any Tk-related code.
> There is c.l.p.tk for perl-tk questions.
Sorry, I am no longer interested in tk.
Bob
------------------------------
Date: Fri, 30 Jun 2006 10:01:27 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: Re: Question on printerhandling
Message-Id: <44a4da58$0$29316$e4fe514c@dreader30.news.xs4all.nl>
Unfortunately "/f" feeds an empty page before positioning on top. Any
idea how I can avoid that?
Thanks for helping out.
------------------------------
Date: 30 Jun 2006 08:38:51 GMT
From: anno4000@zrz.tu-berlin.de
Subject: Re: Question on printerhandling
Message-Id: <4gk68rF1nvfg5U1@news.dfncis.de>
Huub <"v.niekerk at hccnet.nl"> wrote in comp.lang.perl.misc:
>
> Unfortunately "/f" feeds an empty page before positioning on top. Any
> idea how I can avoid that?
A form feed goes to the top of the next page. It should skip the
remaining lines on the current page but not eject completely blank
page (except possibly when it is already at the top of a page).
If you get blank pages your printer isn't interpreting form feed
correctly.
Anno
------------------------------
Date: Fri, 30 Jun 2006 10:29:12 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Question on printerhandling
Message-Id: <e82ur5.1jg.1@news.isolution.nl>
Huub" <"v.niekerk at hccnet.nl schreef:
> Unfortunately "/f" feeds an empty page before positioning on top. Any
> idea how I can avoid that?
>
> Thanks for helping out.
ITYM: "\f" (formfeed).
Maybe your previous page has already printed white lines on the new
page. Print something like "test\f" to see were the "test" lands.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Fri, 30 Jun 2006 11:18:57 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: Re: Question on printerhandling
Message-Id: <44a4ec80$0$8689$e4fe514c@dreader27.news.xs4all.nl>
>
> ITYM: "\f" (formfeed).
>
Oops, typo..I do use "\f".
> Maybe your previous page has already printed white lines on the new
> page. Print something like "test\f" to see were the "test" lands.
>
It appears that "test\f" lands on that blank ff page. I'm printing 2
regular pages for testing (costs too much otherwise), and in the code
everything is ok. The first page is printed 100% correctly. Not 1
character too much. Then your test appears on that "\f" page, after
which the 2nd page is printed 100% correctly as well. BTW, "test" is
printed at the same line as the regular next-page text is printed
without using "\f".
In the old dBase code, "eject" is used on the same printer which works
as should. The Perl code is a replacement of the dBase code. I just had
to align some text and figure out the number of empty lines between the
text to fit the form. So, except for the "eject", it's the same.
I hope the above makes (some) sense.
Thank you for helping out.
------------------------------
Date: Fri, 30 Jun 2006 11:56:12 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Question on printerhandling
Message-Id: <e833m1.1ik.1@news.isolution.nl>
Huub schreef:
> Ruud:
>> Maybe your previous page has already printed white lines on the new
>> page. Print something like "test\f" to see were the "test" lands.
>
> It appears that "test\f" lands on that blank ff page. I'm printing 2
> regular pages for testing (costs too much otherwise), and in the code
> everything is ok. The first page is printed 100% correctly. Not 1
> character too much. Then your test appears on that "\f" page, after
> which the 2nd page is printed 100% correctly as well. " BTW, "test" is
> printed at the same line as the regular next-page text is printed
> without using "\f".
So it seems that your printing logic is already "on the next page". So
why do you add the "\f"?
Many HP Laser printer have by default 66 lines on a page. Of course you
can send setup codes to it, to make that a lot more.
But by default, after you have sent 66 lines, you will be on the next
page already.
> In the old dBase code, "eject" is used on the same printer which works
> as should. The Perl code is a replacement of the dBase code. I just
> had to align some text and figure out the number of empty lines
> between the text to fit the form. So, except for the "eject", it's
> the same.
I would let it print to a file, and check the special codes in the file.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 30 Jun 2006 07:10:08 GMT
From: anno4000@zrz.tu-berlin.de
Subject: Re: stuck in a while loop
Message-Id: <4gk12gF1n2d31U1@news.dfncis.de>
Nospam <nospam@home.com> wrote in comp.lang.perl.misc:
> Can anyone identify what is wrong with code, or worse how to fix it?, it
> worked one time, but not anymore, I have hardly made any changes
The outer while loop will never end. There is no "last" statement (or
"goto", or whatever) that would leave it. The one "last" in the code
cuts off an inner loop after the first round, which doesn't make much
sense either. Probably the "last" is misplaced. There is too much
too messy code (left below for reference) to say anything more.
Anno
> #! perl\bin\perl
> use strict;
> use warnings;
>
> use Data::Dumper;
> use WWW::Mechanize;
> use LWP::Useragent;
>
>
>
> open (FILE2, "text1.txt") or die "couldn't open $!";
> use constant START => "<FILE2>";
>
> while()
> {
>
> my $mech = WWW::Mechanize->new( );
>
>
> my @url;
> my $START = <FILE2>;
>
> print "$START \n";
>
>
>
> (my $varia1 = $START) =~ s/\@.*//;
>
>
>
> print "$varia1 \n";
>
>
>
> $mech->get('http://www.loginurl');
>
>
> $mech->form(1);
>
>
> $mech->field('login',"$varia1");
>
> if ($mech->success){ print "login successfully set \n";} else{print $!;}
>
> $mech->submit();
>
> if ($mech->success){ print "login successfully submitted \n";} else{print
> $!;}
>
> $mech->follow_link( text_regex => qr/Daily news/i);
>
> if ($mech->success){ print "link successfully followed \n";} else{print
> $!;}
>
>
>
>
> my ($content3) = $mech->content() =~ /= "(.*)r"/;
>
>
>
> my @content1 = $content3;
>
>
>
> foreach my $content2 (@content1) {
> open (FILE, ">> hm5.txt");
> print $content2."\n";
>
>
>
>
>
> print FILE $content2."\n";
>
> last;
> }
>
> }
>
> close FILE2;
> close FILE;
>
>
------------------------------
Date: Fri, 30 Jun 2006 08:22:22 +0100
From: Brian Wakem <no@email.com>
Subject: Re: stuck in a while loop
Message-Id: <4gk1peF1ndf6nU1@individual.net>
Nospam wrote:
> #! perl\bin\perl
> use strict;
> use warnings;
>
> use Data::Dumper;
> use WWW::Mechanize;
> use LWP::Useragent;
^^^
I don't believe this is real code as there is no such module.
--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
------------------------------
Date: Fri, 30 Jun 2006 10:00:56 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: stuck in a while loop
Message-Id: <e82t1s.1ko.1@news.isolution.nl>
Nospam schreef:
> Can anyone identify what is wrong with code, or worse how to fix it?,
> it worked one time, but not anymore, I have hardly made any changes
>
> #! perl\bin\perl
Does that work? I mainly reformatted:
#!/usr/bin/perl
use strict ;
use warnings ;
use Data::Dumper ;
use WWW::Mechanize ;
use LWP::Useragent ;
my $in = 'text1.txt' ;
my $out = 'hm5.txt' ;
open my $fh_in, '<', $in or die "Error opening $in: $!" ;
open my $fh_out, '>>', $out or die "Error opening $out: $!" ;
while ( <$fh_in> )
{
local $\ = "\n" ;
my $mech = new WWW::Mechanize ;
print ;
s/\@.*// ;
print ;
$mech->get('http://www.loginurl') ;
$mech->form(1) ;
$mech->field('login', $_) ;
print $mech->success
? 'login successfully set'
: "login set failed: $!" ;
$mech->submit() ;
print $mech->success
? 'login successfully submitted'
: "login submit failed: $!" ;
$mech->follow_link( text_regex => qr/Daily news/i ) ;
if ($mech->success)
{
print 'link successfully followed' ;
my ($content) = $mech->content() =~ /= "(.*)r"/ ;
print "\n----\n${content}\n----" ;
print $fh_out $content ;
}
else
{
print "link follow failed: $!" ;
}
}
close $fh_out or die "Error closing $out: $!" ;
close $fh_in or die "Error closing $in: $!" ;
(untested)
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Fri, 30 Jun 2006 16:21:49 +1200
From: Shane <shane@weasel.is-a-geek.net>
Subject: test value
Message-Id: <e828rp$t0b$1@lust.ihug.co.nz>
I have some nasty code, that I want to check the value of something held in
a scalar, but there is 'no' value held in there
Data::Dumper tells me the $val = []
How do I test for that?
--
Rule 6: There is no rule 6
Blog: http://shanes.dyndns.org
------------------------------
Date: Fri, 30 Jun 2006 14:58:19 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: test value
Message-Id: <44a4b045$0$22364$afc38c87@news.optusnet.com.au>
"Shane" <shane@weasel.is-a-geek.net> wrote in message
news:e828rp$t0b$1@lust.ihug.co.nz...
> I have some nasty code, that I want to check the value of something held
in
> a scalar, but there is 'no' value held in there
>
> Data::Dumper tells me the $val = []
>
> How do I test for that?
>
Maybe the Devel::Peek module's Dump($val) will give you what you want.
Certainly worth a try.
(That's only a guess, of course ..... with the information you've provided a
guess is about all you'll get :-)
Cheers,
Rob
------------------------------
Date: 30 Jun 2006 06:35:54 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: test value
Message-Id: <Xns97F210BE2E691castleamber@130.133.1.4>
Shane <shane@weasel.is-a-geek.net> wrote:
> I have some nasty code, that I want to check the value of something
> held in a scalar, but there is 'no' value held in there
>
> Data::Dumper tells me the $val = []
$val contains a reference to an empty array, like:
my @array = ();
my $val = \@array;
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
------------------------------
Date: Fri, 30 Jun 2006 08:46:12 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: test value
Message-Id: <e82hes$b6e$1@nntp.fujitsu-siemens.com>
John Bokma wrote:
> Shane <shane@weasel.is-a-geek.net> wrote:
>=20
>=20
>>I have some nasty code, that I want to check the value of something
>>held in a scalar, but there is 'no' value held in there
>>
>>Data::Dumper tells me the $val =3D []
>=20
>=20
> $val contains a reference to an empty array, like:
>=20
> my @array =3D ();
> my $val =3D \@array;
if (@$val =3D=3D 0) {
print "Empty\n";
}
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 30 Jun 2006 08:56:34 GMT
From: anno4000@zrz.tu-berlin.de
Subject: Re: validating data before trusting to use in a system call
Message-Id: <4gk7a2F1na7biU1@news.dfncis.de>
<guser@packetstorm.org> wrote in comp.lang.perl.misc:
[attributions missing. it was in reply to Ben Morrow]
> > > sub isIP
> > > {
> > > my $target = shift;
> > > print OUT " SUB:isIP: Starting\n" if $debug_arg;
> > > if ($target =~ /^\b\d+\.\d+\.\d+\.\d+$/) {
> >
> > What's the \b for? It's completely redundant with ^.
>
> The idea was to ensure that the match started at the beginning of the
> string (^) and then only if the boundry right after the start was
> matched \b .....$
>
> that way i do not match things like
> 1.2.3.4garbage or garbage1.2.3.4 etc.
You don't, with or without "\b", that was Ben's point. It can't match
those the way the regex is anchored.
Anno
------------------------------
Date: Fri, 30 Jun 2006 16:33:22 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: WIN32 PPM and perldoc problems
Message-Id: <44a4c68a$0$9840$afc38c87@news.optusnet.com.au>
<jovo.miskin@sciatl.com> wrote in message
news:1151587905.432899.58080@j72g2000cwa.googlegroups.com...
>
> The problem seem to be specific to passing arguments to system call.
>
And yet there's no problem in passing arguments from the command line to a
script via @ARGV ... right ?
That makes me think that the shell being invoked by system is a different
shell to the one you're running in. (Could the 'system' call be invoking
command.com or some other shell ?)
> system($opt_exe, @ARGV);
Try forcing it to use the cmd shell by changing the system() call to:
system("cmd /C $opt_exe", @ARGV);
or
system("$ENV{COMSPEC} /C $opt_exe", @ARGV);
Do either of those invocations help ?
Cheers,
Rob
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9409
***************************************