[28465] in Perl-Users-Digest
Perl-Users Digest, Issue: 9829 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 10 14:06:01 2006
Date: Tue, 10 Oct 2006 11:05:06 -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 Tue, 10 Oct 2006 Volume: 10 Number: 9829
Today's topics:
Re: Can't call method "mail" - w3mail/cascade soft brok <don@lizardhill.com>
Re: Class::Std and AUTOMETHOD anno4000@radom.zrz.tu-berlin.de
Re: Firefox Won't Execute My Perl Script <mgarrish@gmail.com>
Re: Firefox Won't Execute My Perl Script <sherm@Sherm-Pendleys-Computer.local>
IO::Prompt with Keymap <dale.gerdemann@googlemail.com>
Re: IO::Prompt with Keymap anno4000@radom.zrz.tu-berlin.de
Re: LWP and Unicode <tzz@lifelogs.com>
Re: Option Values with Spaces using GetOpt::Long <mritty@gmail.com>
Re: Option Values with Spaces using GetOpt::Long <mritty@gmail.com>
Re: Output of Concise <benmorrow@tiscali.co.uk>
Re: Parsing HTML - using HTML::TreeBuilder <bartthebear@gmail.com>
Re: Parsing HTML - using HTML::TreeBuilder <john@castleamber.com>
Re: Perl ActiveX: A VBA string passed to my control is david.f.jenkins@usa.net
Re: perl support for 64 bit processing xhoster@gmail.com
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <tadmc@augustmail.com>
Re: question about using jpegtran for lossless compress ewaguespack@gmail.com
return a series of matches from a hash lookup <jack_posemsky@yahoo.com>
Re: return a series of matches from a hash lookup <mritty@gmail.com>
Re: second substitution to work only on a found pattern <is@invalid.111>
Re: Unique in-depth problem <tzz@lifelogs.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Oct 2006 09:23:56 -0700
From: "Don O'Neil" <don@lizardhill.com>
Subject: Re: Can't call method "mail" - w3mail/cascade soft broken
Message-Id: <1160497436.444599.12530@h48g2000cwc.googlegroups.com>
Yes, I know what caused the crash, a failing disk... which has been
problematic in the past. So it's not a cracker/hacker....
If the author was still around, I would gladly contact them, but their
website (www.cascadesoft.com) is gone, and I can't seem to find
anything about them anywhere else.
The strange thing is that until we had the disk crash, which probably
corrupted some library somewhere, the application worked perfectly.
Tad McClellan wrote:
> Don O'Neil <don@lizardhill.com> wrote:
>
> > Until last night, my CascadeSoft w3mail webmail program was working
> > perfectly, now this morning, after a server crash,
>
>
> Have you determined what caused the crash?
>
> A common cause of server crashing is being cracked, and Googling
> shows that this program is an open invitation to crackers...
>
> Have you contacted the author of the program for support?
>
>
> > I'm getting the
> > error "The SMTP server responded: Can't call method "mail" on an
> > undefined value at
> > /var/shc/servers/lizardhill.com/root/webmail/cgi/sendmessage.cgi line
> > 179" when I try to send an email message.... Anyone have any ideas what
> > could be going on?
>
>
> Maybe a bad guy is exploiting your insecure site.
>
> Apart from that, the problem is that you are attempting to call
> a method on an undefined value at line 179.
>
> Go look at that line and see what values might be undefined, then
> trace them back to figure out where they are getting that value.
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: 10 Oct 2006 13:50:00 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Class::Std and AUTOMETHOD
Message-Id: <4p1mo8Fg9q3tU1@news.dfncis.de>
<don.hosek@gmail.com> wrote in comp.lang.perl.misc:
> OK, so I'm going back over the last project to see what I can learn
> from my efforts and I run into one annoying bit of cut-and-paste coding
> which would better off not being such.
>
> I had a number of classes derived from a base class which had some
> member data which were in array form:
>
> package A;
> use Class::Std;
> use base qw(BaseClass);
> use strict;
>
> # Both of these will be references to arrays
> my %this_list_ref_of : ATTR;
> my %that_list_ref_of : ATTR;
>
> I want to have methods which give me the number of elements so that I
> can do
>
> my $foo=A->new();
> print $foo->count_of_this_list_ref_of();
>
> Now generating the functions by cut and paste is doable, but it's also
> error-prone: What if I accidentally don't do all the substitutions and
> $foo->count_of_that_ref_of() gives me the size of the array in
> $this_list_ref_of{$this} rather than $that_list_ref_of{$this}?
>
> Ignoring the autovivification issues,
You mean "substitution issues", I suppose.
> I had tried setting up an
> AUTOMETHOD which used symbolic refs and found that this wasn't going to
> work [easily] since an auto-vivified ${'foo'} is a different entry in
> the symbol table than my $foo. I suppose I could look at what class my
"my $foo" doesn't have a symbol table entry.
> AUTHOMETHOD is called from and use that to set up the symbol table, but
> there's still the whole autovivification issue. Any thoughts on what
> the best practice way of dealing with this problem would be?
Unfortunately your code doesn't show essential points of your problem.
Do you want to put the "count" methods in your base class or in the
derived class?
In the first case you can access the attribute hashes directly from
AUTOMETHOD if you must. It would still be better to go through the
official accessors. In the second case you *must* go through the
accessors the base class provides. It's the point of inside-out
classes that you cannot access the attributes directly except from
the class that defines them.
Here is an AUTOMETHOD that should work in both cases. It supposes
that the accessors in BaseClass are get_this_list_ref_of and
get_that_list_ref_of.
sub AUTOMETHOD {
my ($self, $obj_ID, @other_args) = @_;
if ( my ( $what) = /^count_of_(\w+_list_ref_of)$/ ) {
my $get_what = "get_$what";
return sub { scalar @{ $self->$get_what } };
}
warn "Can't call $_ on ", ref $self, " object";
return;
}
------------------------------
Date: 10 Oct 2006 05:07:25 -0700
From: "Matt Garrish" <mgarrish@gmail.com>
Subject: Re: Firefox Won't Execute My Perl Script
Message-Id: <1160482045.299796.44500@c28g2000cwb.googlegroups.com>
Ben Morrow wrote:
> Quoth "Matt Garrish" <mgarrish@gmail.com>:
> >
> > steve.ziring@gmail.com wrote:
> >
> > > I have a perl script that executes successfully in MSIE, but Firefox
> > > prompts me to open or save the same file. I can not get the Perl file
> > > to execute in Firefox.
> > >
> > > I've seen a lot of posts with the same problem except I haven't anybody
> > > that can get the script to execute in one browser but not the other.
> > >
> >
> > Your terminology is a bit off. Browsers don't execute scripts.
>
> ObPedant: so is yours. Browsers can and frequently do execute scripts,
> though they're not usually written in Perl. Browsers, with the exception
> of Lynx, don't execute *CGI* scripts.
>
Alright, I deserved that. I did say a bit off, though... : )
In the context of this question, it must be a server-side script that's
being run/requested. Embedded code in an html page cannot directly
access the download prompt dialog, it's appearance indicates client /
server interaction.
Matt
------------------------------
Date: Tue, 10 Oct 2006 12:56:01 -0400
From: Sherm Pendley <sherm@Sherm-Pendleys-Computer.local>
Subject: Re: Firefox Won't Execute My Perl Script
Message-Id: <m2bqokqfdq.fsf@Sherm-Pendleys-Computer.local>
robic0 writes:
> On Tue, 10 Oct 2006 03:25:04 GMT, "Jürgen Exner" <jurgenex@hotmail.com> wrote:
>
>>steve.ziring@gmail.com wrote:
>>> I have a perl script that executes successfully in MSIE,
>>
>>I highly doubt that unless you are talking about Perlscript, a language that
>>is _VERY_ rarely used.
>>
>>jue
>>
> Hey Jew there must be something that is Perl used heavily in page production.
> Jeez what could it be. Oh well, it must be a fuckin secret........
'PerlScript' ne 'Perl'. Perl is used heavily. PerlScript - ActiveState's
Windows Scripting Host support for Perl - is very rarely used.
And no, PerlScript is not a secret. You're just clueless as usual.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 10 Oct 2006 05:10:58 -0700
From: "Dale" <dale.gerdemann@googlemail.com>
Subject: IO::Prompt with Keymap
Message-Id: <1160482257.928864.204980@i42g2000cwa.googlegroups.com>
I'm trying to make a program that promts for word in Cyrillic and then
does something with the word, like look it up in a dictionary, or
analyze it's morphology, or whatever.
The problem is that I would to reassign the key mappings at the prompt,
so that a user using a keyboard with Latin letters will be able to type
Cyrillic. After experimenting with modifications to IO::Prompt, I found
that I could add my mapping right after the line that says:
elsif ($next !~ /$cntl/ && defined $next) {
So right after this line, I put:
$next =3D $next eq "a" ? "=D0=B0"
: $next eq "b" ? "=D0=B1"
: $next eq "v" ? "=D0=B2"
: $next eq "g" ? "=D0=B3"
: $next eq "d" ? "=D0=B4"
etc
Question: Is this the best way to do it? Or is there some module
somewhere that already does what I'm trying to do?
Dale
------------------------------
Date: 10 Oct 2006 14:32:18 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: IO::Prompt with Keymap
Message-Id: <4p1p7iFgloqtU1@news.dfncis.de>
Dale <dale.gerdemann@googlemail.com> wrote in comp.lang.perl.misc:
> I'm trying to make a program that promts for word in Cyrillic and then
> does something with the word, like look it up in a dictionary, or
> analyze it's morphology, or whatever.
>
> The problem is that I would to reassign the key mappings at the prompt,
> so that a user using a keyboard with Latin letters will be able to type
> Cyrillic. After experimenting with modifications to IO::Prompt, I found
> that I could add my mapping right after the line that says:
>
> elsif ($next !~ /$cntl/ && defined $next) {
>
> So right after this line, I put:
>
> $next = $next eq "a" ? "а"
> : $next eq "b" ? "б"
> : $next eq "v" ? "в"
> : $next eq "g" ? "г"
> : $next eq "d" ? "д"
> etc
>
> Question: Is this the best way to do it? Or is there some module
> somewhere that already does what I'm trying to do?
Use a hash instead of nested ?:
my %translate = (
a => "а",
b => "б",
...
);
Then you can write:
$next = $translate{ $next} or invalid_char();
Anno
------------------------------
Date: Tue, 10 Oct 2006 18:33:17 +0100
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: LWP and Unicode
Message-Id: <g69lknot6si.fsf@lifelogs.com>
On 6 Oct 2006, benmorrow@tiscali.co.uk wrote:
> It's not a question of this group's charter, it applies generally on
> Usenet. There is no header in a Usenet article that specifies a charset,
> so no way to use anything other than the default ASCII.
>
> I agree in principle: some form of charset header should be added, or
> the charset should simply be specified to be UTF8. But until it is,
> please refrain from using it.
So there are really two questions:
1) are there any newsreaders that would cause problems when they found
UTF-8 encoded text? Anything from a crash to an unusable session
would qualify (if Ctrl-L fixes it, I wouldn't consider it a
significant problem).
2) why not do a vote to change the charter to make UTF-8 the charset
for c.l.p.m? I personally see no problem with this, since UTF-8
works well in practice and is conservative in byte usage.
Ted
------------------------------
Date: 10 Oct 2006 06:22:39 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Option Values with Spaces using GetOpt::Long
Message-Id: <1160486559.404503.112390@i3g2000cwc.googlegroups.com>
himanshu.garg@gmail.com wrote:
> I am using GetOpt::Long for parsing Command Line Options. However
> for options having value a string containing spaces only the first word
> is passed as the option value.
>
> e.g.:-
>
> cli.pl
> # The soap server
> my $server = '';
>
> # The method that is called
> my $method = '';
>
> # These are the parameters that are sent to the module
> my %params;
>
> GetOptions('server=s' => \$server,
> 'method=s' => \$method,
> 'param=s%' => \%params);
>
> Called as:-
> perl cli.pl --server=server.example.com --param username=himanshu
> --param --param dep_type='Double E' --param resource_group='FIRST
> Resource Group' --param emaild=ehgarg@example.com
>
> Am I missing something or I should look for other modules to
> parse space separated strings.
I modified your code to add in a call to Dumper of all three lexical
variables above. I modified your call to remove the empty --param
argument, as your code shows param needing to take a value. After
that, I get:
$ perl clpm.pl --server=server.example.com --param username=himanshu
--param dep_type='Double E' --param resource_group='FIRST Resource
Group' --param emaild=ehg...@example.com
$VAR1 = \'server.example.com';
$VAR2 = \'';
$VAR3 = {
'emaild' => 'ehg...@example.com',
'resource_group' => 'FIRST Resource Group',
'dep_type' => 'Double E',
'username' => 'himanshu'
};
which looks correct to me. If you're having problems, I posit that it
is due to your shell, not Perl. The responsibility of breaking up the
command line into individual arguments is done by your shell (or
command line interpreter), and *then* those arguments are passed to the
executing process.
Please post the output of your code after adding these lines:
use Data::Dumper;
print Dumper(\$server, \$method, \%params);
And please note which command shell you're using.
Paul Lalli
------------------------------
Date: 10 Oct 2006 06:23:58 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Option Values with Spaces using GetOpt::Long
Message-Id: <1160486638.408541.95710@k70g2000cwa.googlegroups.com>
himanshu.garg@gmail.com wrote:
> I am using GetOpt::Long for parsing Command Line Options. However
> for options having value a string containing spaces only the first word
> is passed as the option value.
>
> e.g.:-
>
> cli.pl
> # The soap server
> my $server = '';
>
> # The method that is called
> my $method = '';
>
> # These are the parameters that are sent to the module
> my %params;
>
> GetOptions('server=s' => \$server,
> 'method=s' => \$method,
> 'param=s%' => \%params);
>
> Called as:-
> perl cli.pl --server=server.example.com --param username=himanshu
> --param --param dep_type='Double E' --param resource_group='FIRST
> Resource Group' --param emaild=ehgarg@example.com
>
> Am I missing something or I should look for other modules to
> parse space separated strings.
I modified your code to add in a call to Dumper of all three lexical
variables above. I modified your call to remove the empty --param
argument, as your code shows param needing to take a value. After
that, I get:
$ perl clpm.pl --server=server.example.com --param username=himanshu
--param dep_type='Double E' --param resource_group='FIRST Resource
Group' --param emaild=ehg...@example.com
$VAR1 = \'server.example.com';
$VAR2 = \'';
$VAR3 = {
'emaild' => 'ehg...@example.com',
'resource_group' => 'FIRST Resource Group',
'dep_type' => 'Double E',
'username' => 'himanshu'
};
which looks correct to me. If you're having problems, I posit that it
is due to your shell, not Perl. The responsibility of breaking up the
command line into individual arguments is done by your shell (or
command line interpreter), and *then* those arguments are passed to the
executing process.
Please post the output of your code after adding these lines:
use Data::Dumper;
print Dumper(\$server, \$method, \%params);
And please note which command shell you're using.
Paul Lalli
------------------------------
Date: Tue, 10 Oct 2006 15:53:32 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Output of Concise
Message-Id: <coosv3-aoh.ln1@osiris.mauzo.dyndns.org>
Quoth "Ferry Bolhar" <bol@adv.magwien.gv.at>:
> Ben Morrow:
>
> > Most ops have a target. This is a SV allocated in the lexical pad for
> > that op, and, unless the op has the OPf_STACKED flag, it is used to
> > avoid allocating a new SV for the op's return value. Instead, the TARG
> > is filled in with the required value, and a pointer to it pushed onto
> > the stack.
> >
> > The [t4] in the output of B::Concise says that this op has op_targ = 4,
> > which means that the TARG of this op is the fifth entry in the current
> > sub's lexical pad.
>
> Many thanks for your help. Especially the last phrase was the one
> I missed because it explains _what_ a target actually is - an entry
> in a lexical (scratch) pad.
What is unclear about
#define GETTARGET targ = PAD_SV(PL_op->op_targ)
#define dTARGET SV * GETTARGET
from pp.h? It took me about 30 seconds to find that, given that I knew I
was looking for something called a 'target' that has something to do
with ops.
> > Now *please* start making an effort to work these things out for
> > yourself, instead of expecting us to hand-feed you.
>
> My apologies - it wasn't my intention to borrow you (and others).
> And to be true - I can't understand the problem in answering to
> questions like mine. Whenever someone comes to me and ask me
> somewhat, I'll help him/her - I will not say "Look at the docs for
> this or ask someone other!". If I can help, I will help. And until now,
> I thought this is the principle of c.l.p.m as well and that everyone
> who read and post here is willing to help and to answer to questions
> if he is able to do so. Even if a question looks stupid. It may look
> stupid to _you_ but not to the _one_ who asked.
The problem was not that the question appeared to be stupid, but rather
that the answer is only to be found by grovelling aroung in the source.
You appeared to be asking others to do that for you since you couldn't
be bothered yourself.
Maybe I was a little harsh, but I really think that if you don't
understand the code well enough to figure things like this out for
yourself then you don't know enough to make use of them.
> Reading almost completely uncommented source code is easy
> for one person only - the one who wrotes the code.
I disagree. Well, maybe it's not *easy*; understanding something complex
is never easy. I don't think it's substantially harder than reading an
800-page book on the subject, though: in the end, you have to understand
what the code does.
> Look at the
> Perl source - the only kind of documentation found therein is the
> documentation for perldocs, describing some parts of perlguts,
> perlapi and perlintern. That's all. There are very often 30 or more
> lines of code without _any_ comment.
So *read* *the* *code*. Read every line, work out what it does, and move
on to the next. It's not anything like reading prose: it's much slower,
for a start, and you have to think hard. But that's simply because code
is an extremely compact way of expressing certain classes of idea.
> You have to find out
> yourself what the code does without knowing whether you're
> right or wrong at some point inside the code. This is very hard,
> because you must make assumptions and these assumptions
> may be wrong, resulting in incorrect code interpretation and
> therefore assuming false behaviour.
Where there are non-obvious assumptions, they are commented. Or, at
least, I've never come across anything outside the insane bits (the
lexer and the regex engine) that didn't make sense.
> Again, sorry for my intrusion. It's up to you to refuse to answer
> to my questions. But like I do help if I can, I hope that others
> here are willing to do so as well. And there is no other way to
> get this information - there are no books about this kind of Perl
> guts. There are books about the Perl API, about SVs, AVs and
> so on, but no book describe the compilation process in detail,
> describe how OPs are generated, which flags are set under
> which circumstances, and what will happen at runtime when
> they are set or cleared.
What do you hope to do with this information? (This is a serious
question. I am having a hard time coming up with a use you could put it
to that *doesn't* require you to have read and understood the source.)
> BTW: would it have been so hard for the author of B::Concise
> to add your explantation to the modules docs?
It wouldn't have been *hard*, but I don't think it would have been
*useful*, either. Sometimes things are left intentionally undocumented,
as a way of keeping people from playing with things they don't
understand properly.
Ben
--
"Awww, I'm going to miss her."
"Don't you hate her?"
"Yes, with a fiery vengeance."
[benmorrow@tiscali.co.uk]
------------------------------
Date: Tue, 10 Oct 2006 12:12:38 GMT
From: Bart The Bear <bartthebear@gmail.com>
Subject: Re: Parsing HTML - using HTML::TreeBuilder
Message-Id: <pan.2006.10.10.12.12.37.922861@gmail.com>
On Fri, 06 Oct 2006 11:33:12 -0700, olson_ord wrote:
> -- so that you can process the file further. (Perl calls the 'break'
> statement 'last').
It also calls the "continue" statement "next" and allows combining things
like "next if $a > 0" or "last if $a > 0". The reason for that is the fact
that Perl is not C. Perl is pathologically eclectic rubbish lister.
Personally, I find "last" being more logical then "break". Keyword "last"
tells you that, provided certain conditions are met, this is the last
iteration of the loop.
------------------------------
Date: 10 Oct 2006 16:13:24 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Parsing HTML - using HTML::TreeBuilder
Message-Id: <Xns9858722C4FE9Acastleamber@130.133.1.4>
olson_ord@yahoo.it wrote:
> Hi,
> I am trying to use Perl to parse a webpage - and I cannot get
> started. I hope someone could help me.
> I searched online and I found that I am supposed to use the
> HTML::TreeBuilder. In the example below I am trying to get the text in
> the TAG named "H2".
my $h2 = $tree->look_down( _tag => 'h2' );
defined $h2 or die "Can't find 'h2'";
my $text = $h2->as_trimmed_text;
$tree->delete;
http://johnbokma.com/perl/ has several example scripts that use
HTML::TreeBuilder
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 10 Oct 2006 06:41:16 -0700
From: david.f.jenkins@usa.net
Subject: Re: Perl ActiveX: A VBA string passed to my control is treated as a doubel-quoted string
Message-Id: <1160487676.326163.186390@i3g2000cwc.googlegroups.com>
robic0 wrote:
> On 9 Oct 2006 16:29:02 -0700, david.f.jenkins@usa.net wrote:
>
> >
> >david.f.jenkins@usa.net wrote:
> >> Hi: I'm very new at all things Perl, so I may have my terminology
> >> boogered up. Here goes:
> >>
> >> I have written a Perl ActiveX control that's suppose to do some regular
> >> expression operations on data and patterns sent from VBA (as VT_BSTR).
> >> Everything seems to be working ok, except that it appears the pattern
> >> arguments to Perl are being treated as double-quoted strings.
> >>
> >> Here is a string I'm passing in from VBA (and also using when testing
> >> using a Perl call):
> >>
> >> "(\s)(-{1,2}|-)(\s)" (the character after the vertical bar is an en
> >> dash.)
> >>
> >> When I use this string in VBA, I get erroneous resutls from my control.
> >> If I write a call in Perl, using the same arguments as I use in VBA, I
> >> also get erroneous results. However, if I change the Perl argument
> >> string to a single-quoted string, then I get correct results. Alos, if
> >> I change the \s's to blanks and use double quotes, it works ok. If I
> >> leave the \s's in and use single-quotes, it works ok. But as is -
> >> unh-unh.
> >>
> >> Do I have interpolative context problems? The larger question I have,
> >> is how can I coerce the control to treat the string that's being passed
> >> in as single-quoted string? Or is there perhaps some easier solution?
> >
> >I found this in a post to this group from 1996 - it pretty much sums up
> >my problem, I think:
> >
> >"If a variable [function argument, in my case] has a string which will
> >be interpreted as a double-quoted string, is there a way to cause the
> >variable to be interpreted as a single-quoted string?
> >"
>
> So you are sending a regex string from VB embedded in Power Point to
> a ActiveX (com object) control that has an embedded Perl regex lib.
>
> Hmm, interesting. Seems pretty high power stuff for someone who doesen't
> know what single/double quoted (in-solution) strings are.
>
> Perl regex has its own set of escape characters like any other parser.
> The reason the single '' quotes worked for you is that '\s' is \s
> in any language. The \ is the universal escape character.
>
> To make '\s' come out the other end of the pipe you have to use "\\s"
> double flavor. It then goes into solution as \s. In solution means after
> the parser transforms it and its in memory and will never get changed
> unless it comes out and posibly goes back in modified.
>
> Perl regex has a further set of escape characters. Using the universal '\'
> character you should, on the VBA side, escape all of Perls regex escape
> characters.
>
> Below is a sample Perl code to escape all regex from a perl string.
> You need to extrapolate this to the VBA side.
>
> Good luck, you seem to be in total misery......
> robic0
>
> ps. just escape everything..... literally!
>
> ------------------------------------
>
>
> use strict;
> use warnings;
>
> my ($pat_convert);
>
> $pat_convert = convertPatternMeta ( 'Hello...?' );
> showMatchResult ($pat_convert, 'Hello...? this is a big string x');
> showMatchResult ($pat_convert, 'Oh Hello x');
>
> $pat_convert = convertPatternMeta ( '*?+' );
> showMatchResult ($pat_convert, 'Hello...? this (*?+) is a big string x');
> showMatchResult ($pat_convert, '*?+ and so is this');
>
> ## ------------------------------------
> ## Helpers
> ##
> sub convertPatternMeta
> {
> my ($pattern) = shift;
> my @regx_esc_codes =
> (
> "\\", '/', '(', ')', '[', ']', '?', '|',
> '+', '.', '*', '$', '^', '{', '}', '@'
> );
> foreach my $tc (@regx_esc_codes) {
> # code template for regex
> my $xxx = "\$pattern =~ s/\\$tc/\\\\\\$tc/g;";
> eval $xxx;
> if ($@) {
> # the compiler will show the escape char, add
> # it char to @regx_esc_codes
> $@ =~ s/^[\s]+//s; $@ =~ s/[\s]+$//s;
> die "$@";
> }
> }
> return $pattern;
> }
> ##
> sub showMatchResult
> {
> my ($pattern, $string) = @_;
> my $result_txt = '';
> my ($result) = $string =~ /$pattern/;
> if ($result) { $result_txt = 'DOES match'}
> else { $result_txt = 'Does NOT match' }
> print "\nString: $string\n$result_txt\nPattern: $pattern\n";
> }
Thanks so very much.
Over the evening, I discovered this: I have unnecessarily compounded
the problem by writing some Perl calls and using double-quoted strings.
Because of interpolation, I was misled into thnking that the calls
from VBA were being treated similarly. On the VBA side, I'm using some
symbols in both search and replacement strings and I need to do some
back-flips to handle those properly in the Perl/ActiveX environment, as
well as properly handling the escape considerations.
At any rate, all is now well, and I very much appreciate the time you
obviously expended in helping me out.
------------------------------
Date: 10 Oct 2006 15:24:42 GMT
From: xhoster@gmail.com
Subject: Re: perl support for 64 bit processing
Message-Id: <20061010112733.601$WG@newsreader.com>
"Jack" <jack_posemsky@yahoo.com> wrote:
> Hello I wanted to know if perl can leverage the memory situation in 64
> bit systems, no longer being constrained by the 2GB addressable limit ?
>
> If anyone know please confirm
Yes.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Tue, 10 Oct 2006 06:56:56 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.7 $)
Message-Id: <slrnein2k8.ovk.tadmc@magna.augustmail.com>
usenet@DavidFilmer.com <usenet@DavidFilmer.com> wrote:
> tadmc@augustmail.com wrote:
>> Posting Guidelines for comp.lang.perl.misc ($Revision: 1.7 $)
>
> Ah, 1.7.
>
> Do you maintain a diff of revisions?
No, but one could be easily generated.
> I see this corrects the
> chopped-off paragraph previously noticed by Dr. Ruud, but I wonder what
> else is new/changed/fixed...
Nothing else changed in this revision.
I should probably post a diff when a new revision is cut. I'll
try and remember to do that from now on.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 10 Oct 2006 07:55:20 -0700
From: ewaguespack@gmail.com
Subject: Re: question about using jpegtran for lossless compression of jpegs
Message-Id: <1160492120.135264.166020@i3g2000cwc.googlegroups.com>
bugbear wrote:
> ewaguespack@gmail.com wrote:
> >
> > so, anyway to finally get to my point, the jpegtran (Linux) solution
> > does everything that jstrip (windows) does, (and more: optimize,
> > progressive) except remove the jfif header
>
> jpegtran -copy none a.jpg b.jpg
>
> on my machine strips EXIF (and everything else :-)
> perfectly.
>
> My jpeg version is libjpeg-6b-34
>
> Are you sure of your results?
>
> I'm checking for EXIF using
> Image-ExifTool-5.62
>
> BugBear
well I am not an expert at jpeg file structure, but if you download
that jstrip program and enable the optional "jfif header removal" your
get a 18 byte (i believe) reduction in size beyond what jpegtran
provided.
------------------------------
Date: 10 Oct 2006 07:37:39 -0700
From: "Jack" <jack_posemsky@yahoo.com>
Subject: return a series of matches from a hash lookup
Message-Id: <1160491059.436832.305830@c28g2000cwb.googlegroups.com>
Hello,
I have been using the T/F exists with hashlookups successfully like
this:
if (exists $hash{$inputvalue}) { }
But, can anyone provide a code example of doing a lookup that returns
all the values which find a hash match in the event there is more than
1 match, allowing me to process those values ?
Thank you,
Jack
------------------------------
Date: 10 Oct 2006 07:42:28 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: return a series of matches from a hash lookup
Message-Id: <1160491348.186374.210120@m7g2000cwm.googlegroups.com>
Jack wrote:
> I have been using the T/F exists with hashlookups successfully like
> this:
> if (exists $hash{$inputvalue}) { }
>
> But, can anyone provide a code example of doing a lookup that returns
> all the values which find a hash match in the event there is more than
> 1 match, allowing me to process those values ?
Your question is somewhat non-sensical. One key of a hash has one
value, and one value only.
You need to define what you mean by "more than one match".
Please provide some sample input and output to help describe what
you're looking for.
Paul Lalli
------------------------------
Date: Tue, 10 Oct 2006 19:42:22 +0200
From: "I.M. Postor" <is@invalid.111>
Subject: Re: second substitution to work only on a found pattern
Message-Id: <uk2tv3x2p1.ln2@abacus.mid.example.com>
Hello John,
On Mon, 09 Oct 2006 18:36:20 GMT, John W. Krahn wrote:
> I.M. Postor wrote:
> > I have some xml which is formatted bij a xsl processor:
> > but whenever there is a <c0X level="file"> element, for working
> > purposese i'd rather have flattened components:
> > <XXX level="file"> could be from <c01 level="file"> to <c12 level="file">, therefore:
> > while ($slurped_text =~ /(<(c0[1-9]|c1[012]) level="file">.*?<\/\2>)/sg)
> > {$1 =~ s/\n *//g; }
> > ERROR: Modification of a read-only value attempted
> $ perl -e'
> my $slurped_text = <<XML;
>
> <c02 level="group">
> <did>
> <unitid>13-16</unitid>
> <unittitle>several weeklies</unittitle>
> <unitdate normal="1928/1931">1928-1931</unitdate>
> <unitid>13-16</unitid>
> </did>
> <c03 level="file">
> <unitid>13</unitid>
> <unittitle>
> <unitdate>1928</unitdate>
> </unittitle>
> </c03>
> <c03 level="file">
> <unitid>14</unitid>
> <unittitle>
> <unitdate>1929</unitdate>
> </unittitle>
> </c03>
> <c03 level="file">
> <unitid>15</unitid>
> <unittitle>
> <unitdate>1930</unitdate>
> </unittitle>
> </c03>
> </c02>
>
> XML
[snip]
> $slurped_text =~ s{(<(c0[1-9]|c1[012]) level="file">.*?</\2>)}{ ( my $x = $1 )
> =~ s!\n *!!g; $x }seg;
> print $slurped_text;
[snip]
> <c02 level="group">
> <did>
> <unitid>13-16</unitid>
> <unittitle>several weeklies</unittitle>
> <unitdate normal="1928/1931">1928-1931</unitdate>
> <unitid>13-16</unitid>
> </did>
> <c03
> level="file"><unitid>13</unitid><unittitle><unitdate>1928</unitdate></unittitle></c03>
> <c03
> level="file"><unitid>14</unitid><unittitle><unitdate>1929</unitdate></unittitle></c03>
> <c03
> level="file"><unitid>15</unitid><unittitle><unitdate>1930</unitdate></unittitle></c03>
> </c02>
Thanks a lot. It's the /e modifier, which does the trick I guess. I
could not have written it, though.
I had to rewrite the line to understand that {}{} were used here as
paired regex delimiters:
$slurped_text =~ s#(<(c0[1-9]|c1[012]) level="file">.*?</\2>)# ( my $x = $1 ) =~ s/\n *//g; $x #seg;
Thanks, cheers
------------------------------
Date: Tue, 10 Oct 2006 18:57:08 +0100
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Unique in-depth problem
Message-Id: <g69bqokt5or.fsf@lifelogs.com>
On 7 Oct 2006, idgarad@gmail.com wrote:
> The back end is SQL, for the sake of sanity I broke up the dates
> into separate fields for day, month, and year. Even SQL dies a
> horrible grizzley death when querying say the duration of the roman
> empire per the database entries. It is sheer horror so far.
Sorry, but this doesn't make sense. SQL is a language. Do you mean
you use MySQL?
I can promise you with certainty that your data can be stored in a
database and queried efficiently. I can't tell you exactly what that
will involve, because I'm not a professional database administrator
and I don't know your operating parameters (budget, server resources,
etc.) It may well be outside your budget to hire someone that can
design your database well. But it's better to consider that
possibility than to try to design such a database yourself. What you
are describing sounds like a disaster waiting to happen.
> As far as the perl side of this goes it doesn't seem that there is
> any modules that exist to handle something of this nature so they're
> going to need to bring in someone to write an epoc-less date module,
> that is outside of my capabilities. I appreciate the feedback from
> everyone. Thank You All!
Great. As I and others suggested, make sure you look at how Google
Maps works. It's a great example of precomputed visual data, served
quickly and efficiently.
Ted
------------------------------
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 9829
***************************************