[23268] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5488 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 11 14:10:47 2003

Date: Thu, 11 Sep 2003 11:10:13 -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           Thu, 11 Sep 2003     Volume: 10 Number: 5488

Today's topics:
        not able to access a URL with LWP::UserAgent.  <danglesocket@no_spam>
    Re: not able to access a URL with LWP::UserAgent. <bharnish@technologist.com>
    Re: pass cmd line file glob to grep for readdir (qanda)
        Perl 5 for MS-DOS (Rudi Langhanki)
    Re: Perl 5 for MS-DOS <jwillmore@cyberia.com>
    Re: Printing a hash of hashes using an array for the he <mothra@nowhereatall.com>
    Re: Printing a hash of hashes using an array for the he <usenet@dwall.fastmail.fm>
    Re: seeking Win32::OLE example (Greg Bacon)
    Re: Speeding up LWP::Simple <postmaster@castleamber.com>
    Re: Speeding up LWP::Simple <postmaster@castleamber.com>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 11 Sep 2003 12:57:02 -0400
From: danglesocket <danglesocket@no_spam>
Subject: not able to access a URL with LWP::UserAgent. 
Message-Id: <3f60a960@shknews01>

I need to solve this problem with perl, forgive me if it stretches the 
'params' of this group. thanks

This problem originated from not being able to access a URL with
LWP::UserAgent. 

Error, cant get page https://webpage.jsp -- 302 Moved Temporarily
Aborting at ./curu.pl line 77.
(sorry it's an intranet page,... not available outside)
(yes, i am also using use Crypt::SSLeay for SSL support)

I can access the url/page fine from any GUI browser.

I thought to check lynx: (my only other 'text' based http protocol resource.
(lynx -version has ssl support)
# lynx: Can't access startfile https://webpage.jsp  
# HTTP/1.1 302 Moved Temporarily
# Data transfer complete
# HTTP/1.1 302 Moved Temporarily
# Alert!: Redirection limit of 10 URL's reached.

I know this is because of a  redirection loop at the start of the url. how
can i write around this?
I even have found out where it's get's re-directed and tried to acces that
directly, no success.

So i can not access the page from any 'text' based script or browser. (?!) 
As im reading this, it sounds like a https protocal issue (or ssl) and not a
perl issue but i really 
have to solve this issue with perl. - I have to be able to access this page
wtih perl, any ideas?

thank you.






__danglesocket__



------------------------------

Date: Thu, 11 Sep 2003 17:53:27 GMT
From: Brian Harnish <bharnish@technologist.com>
Subject: Re: not able to access a URL with LWP::UserAgent.
Message-Id: <pan.2003.09.11.17.53.56.208013@technologist.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

On Thu, 11 Sep 2003 12:57:02 -0400, danglesocket wrote:

> I need to solve this problem with perl, forgive me if it stretches the 
> 'params' of this group. thanks
> 
> This problem originated from not being able to access a URL with
> LWP::UserAgent. 
> 
> Error, cant get page https://webpage.jsp -- 302 Moved Temporarily
[snip...]

Try a real URL. Looks like your server is "webpage.jsp", can
you "ping webpage.jsp"? If not then your url is bad. Also, if that is the
server name, try putting a '/' on the end of it, thats the way it should
be.

> thank you.
[snip 6 blank lines before your name...]
> __danglesocket__

 - Brian
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/YLauiK/rA3tCpFYRAmLoAKCZB7obGtoi04JqftbmUh4YgvAT6ACfU0ns
rtK7cykR8UTUKWqxCSu6o9A=
=2dX8
-----END PGP SIGNATURE-----



------------------------------

Date: 11 Sep 2003 06:53:58 -0700
From: fumail@freeuk.com (qanda)
Subject: Re: pass cmd line file glob to grep for readdir
Message-Id: <62b4710f.0309110553.7f709fb3@posting.google.com>

Sorry for posting on top of my last reply, but I really do need help
with this one.  I will be forever (well quite some time at least) in
your debt if you can help :)


------------------------------

Date: 11 Sep 2003 08:19:50 -0700
From: rudi.langhanki@web.de (Rudi Langhanki)
Subject: Perl 5 for MS-DOS
Message-Id: <48629b9c.0309110719.6964e6e@posting.google.com>

Hello,

I'm trying to run Perl 5 under MS-DOS. Until now I found out that
there are two serious ports of Perl 5 available:

one of Laszlo Molnar. This is a MSDOS/DJGPP port of perl 5.004_02.
The other is Ilya Zakharevich's OS/2 port of Perl.

As I have to use Perl on an MS-DOS machine with the following
config.sys, I'm not sure which of the both Perls is better suited for
me:

config.sys:
----------
DEVICE=a:\himem.sys /int15=4096 /testmem:off
DEVICE=a:\emm386.exe noems x=C000-D1FF
DOS=HIGH,UMB
BREAK=ON
FILES=69
BUFFERS=10
LASTDRIVE=Z
SHELL=a:\command.com /E:2048 /P
DEVICEHIGH=a:\setver.exe

I read the instructions of both and as it is quiet a lot of work to
set-up a running system I decided not just to try the installation but
ask the newsgroup if there exist a more detailed installation
instruction for theese Perl ports, or even another (better?) Perl port
for MS-DOS.

Thank you for any help or advice ...
(except those advices that I should better use another language or OS
or ...).

I look forward to hear from one of you
Rudi


------------------------------

Date: Thu, 11 Sep 2003 17:03:14 GMT
From: James Willmore <jwillmore@cyberia.com>
Subject: Re: Perl 5 for MS-DOS
Message-Id: <20030911130322.0f1400da.jwillmore@cyberia.com>

On 11 Sep 2003 08:19:50 -0700
rudi.langhanki@web.de (Rudi Langhanki) wrote:
> I'm trying to run Perl 5 under MS-DOS. Until now I found out that
> there are two serious ports of Perl 5 available:
> 
> one of Laszlo Molnar. This is a MSDOS/DJGPP port of perl 5.004_02.
> The other is Ilya Zakharevich's OS/2 port of Perl.
> 
> As I have to use Perl on an MS-DOS machine with the following
> config.sys, I'm not sure which of the both Perls is better suited
> for me:
<snip>

http://www.activestate.com/
http://www.perl.com/

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Nasrudin walked into a teahouse and declaimed, "The moon is more 
useful than the sun."  "Why?", he was asked.  "Because at night
we need the light more." 


------------------------------

Date: Thu, 11 Sep 2003 06:16:58 -0700
From: "Mothra" <mothra@nowhereatall.com>
Subject: Re: Printing a hash of hashes using an array for the headings and getting the columns to line up
Message-Id: <3f607569$1@usenet.ugs.com>

Hi Anno,

"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:bjpp9q$7o$4@mamenchi.zrz.TU-Berlin.DE...
[snipped]
>
> I can't resist the temptation to plug my module Text::Table.  Here
> is how:
>
>     use Text::Table;
>
>     my $tb = Text::Table->new( 'name', @family);
>     $tb->add( $_, @{ $people{ $_}}{ @family}) for sort keys %people;
>
>     print $tb;
>
> The advantage is that it figures out the alignment for you, that is,
> you don't have to write and maintain the printf format.
>
Oh, that is cool!!!
Off to CPAN  I go :-)

Mothra




------------------------------

Date: Thu, 11 Sep 2003 16:05:29 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: Printing a hash of hashes using an array for the headings and getting the columns to line up
Message-Id: <Xns93F37AF98E3FCdkwwashere@216.168.3.30>

Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

> I can't resist the temptation to plug my module Text::Table.  Here
> is how:
> 
>     use Text::Table;
> 
>     my $tb = Text::Table->new( 'name', @family);
>     $tb->add( $_, @{ $people{ $_}}{ @family}) for sort keys
>     %people; 
> 
>     print $tb;
> 
> The advantage is that it figures out the alignment for you, that
> is, you don't have to write and maintain the printf format.

I like it, and I have a project at hand for which it is very useful.  
Thank you!  

But there's one thing I haven't been able to figure out, and that's 
how to right-align a column title.  For example,

    use Text::Table;
    my $tb = Text::Table->new("TLA");
    $tb->load( qw(188.52 0.00 97.36 185.51) );
    print $tb;

produces

TLA   
188.52
  0.00
 97.36
185.51

What I want to produce is 

   TLA
188.52
  0.00
 97.36
185.51


Maybe I'm being obtuse or haven't read the docs closely enough, but I  
don't see how to do this.

-- 
David Wall


------------------------------

Date: Thu, 11 Sep 2003 15:01:21 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: seeking Win32::OLE example
Message-Id: <vm13i1f4kbse1c@corp.supernews.com>

In article <3f5fbdd5.696097308@news.erols.com>,
    Jay Tilton <tiltonj@erols.com> wrote:

: gbacon@hiwaay.net (Greg Bacon) wrote:
: 
: : I was trying to put together a quick hack to extract review comments
: : (using the Comments property) from a Word document to jump start
: : compiling review minutes, but I found the MSDN Word object model
: : documentation surprisingly opaque.  For example, the docs didn't say
: : which property held the comment tag (e.g., [b1]),
: 
: What is your example "[b1]" meant to show?  Is that the expected content
: of the document's comments property?

No, not the comment itself, the comment *tag*.  I'm talking about the
tags identify each comment and show up in the document as hidden text.
The leader seems to be the author's initials because in a dummy doc I
just created, Word tagged my comments as [geb1] and so on.

The comment text itself is straightforward:

    print "$_->{Range}{Text}\n" for in $Doc->{Comments};

: : and the empirical
: : measure of iterating over the keys didn't bear fruit.
: 
: A splash of code will better show what you are talking about, and will
: probably show where the difficulty lies.

Here's the code I've been using to explore:

    #! perl

    use strict;
    use Win32::OLE qw/ in /;

    sub usage { "Usage: $0 [--active | --open]\n" }

    ## main
    die usage unless @ARGV;

    Win32::OLE->Option(Warn => 2);

    my $Word;
    my $Doc;

    my $arg = shift;
    if ($arg eq '--active') {
        $Doc = Win32::OLE->GetActiveObject('Word.Application', 'Quit');
    }
    elsif ($arg eq '--open') {
        $Word = Win32::OLE->new('Word.Application', 'Quit');

        # requires absolute path?
        $Doc = $Word->Documents->Open('c:\temp\foo.doc');
    }

    #$Doc->{Visible} = 1;

    foreach my $Property (in $Doc->BuiltinDocumentProperties) {
        my $Name = $Property->Name;
        local $Win32::OLE::Warn = 0;
        my $Value = $Property->Value;

        $Value = '***Error***' if Win32::OLE->LastError;
        $Value = '<undef>' unless defined $Value;
        printf "%s %s = %s\n", $Name, '.' x (40-length($Name)), $Value;
    }

    foreach my $c (in $Doc->{Comments}) {
        print $c->{Reference}{BookmarkID}, " - ", $c->{Range}{Text}, "\n";
    }

    #$Doc->{Saved} = 1;

In the loop over BuiltinDocumentProperties, I'd tried iterating
over keys %$Property and printing out the values, but the comment
tag didn't appear.

: : I played with the code in <36182bc8.8113706@news2.ibm.net> and found
: : that it made a difference whether I called Documents->Open or
: : GetActiveObject -- although the two seem equivalent in the docs.
: 
: Which docs were you reading that suggested that the
: Win32::OLE->GetActiveObject method is similar to the Word application's
: Documents->Open method?
: 
: Are you perhaps thinking of the Win32::OLE->GetObject method when you
: say GetActiveObject?

I see that I was unclear.  I should have written "equivalent, assuming
the document we want is open".  Using the code above with the --active
option, I get the following error:

    Win32::OLE(0.1603) error 0x80020011: "Does not support a collection"
        in METHOD/PROPERTYGET "" at props line 29
    Can't call method "Name" on an undefined value at props line 30.

I obviously read more into the docs than was there, and I'm happy to
take correction.  Where can I find a good orientation to thinking OLE?

: : Can people recommend a good resource?
: 
: A resource on using Win32::OLE?  The pods that come with ActivePerl are
: pretty much it, and pretty much all that is needed.  Win32::OLE is not
: much more than a way for Perl to poke and prod at OLE libaries.
: 
: A resource on how any of those libraries responds to being poked and
: prodded?  That's a job for the library's author.
: 
: The OLE Browser included with ActivePerl is a decent tool for navigating
: the various libraries and the classes within those libraries.  Be sure
: to notice the clickable help icon in the bottom frame.

Didn't notice the help icon before.  Thanks for the pointer.  I'm
closer:

    foreach my $c (in $Doc->{Comments}) {
        my $tag = $c->{Initial} . $c->{Index};
        print "$tag - ", $c->{Range}{Text}, "\n";
    }

Now I'm trying to get at the highlighted portion of the document
associated with a given comment.  Strike that:

    foreach my $c (in $Doc->{Comments}) {
        my $tag = $c->{Initial} . $c->{Index};
        print $tag, " - ", $c->{Range}{Text}, "\n";
        print $c->{Scope}{Text}, "\n";
    }

: [...]
: As for your original quick hack program, see if this does not fill the
: need.
: 
:     #!perl
:     use warnings;
:     use strict;
:     use Win32::OLE;
:     use Win32::OLE::Const 'Microsoft Word';
:     print
:         Win32::OLE
:         ->GetObject('foo.doc')
:         ->BuiltinDocumentProperties(wdPropertyComments)
:         ->Value;

That produced no output.  (Yes, I used the appropriate path.)

A couple of remaining questions:

Why does iterating over the BuiltinDocumentProperties make the
application think I have changes that need saving?  (I see that setting
the Saved property says nothing needs saving.)

What the difference between getting at the document via Documents->Open
versus GetActiveObject?  I'd like to avoid typing long paths.

Greg, drifting off-topic :-(
-- 
Bad terminology is the enemy of good thinking.
    -- Warren Buffett, 2001 Chairman's letter


------------------------------

Date: Thu, 11 Sep 2003 19:15:22 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Speeding up LWP::Simple
Message-Id: <1063300632.79437@halkan.kabelfoon.nl>

Abigail wrote:

> John Bokma (postmaster@castleamber.com) wrote on MMMDCLXIII September
> MCMXCIII in <URL:news:1063246517.512524@halkan.kabelfoon.nl>:
> ==  
> ==  I live in the Netherlands and finally there will be soon a law that 
> ==  makes spamming harder. I don't have read all the details but opt-out is 
> ==  forbidden. Not sure if opt in without confirmation is ok, but it 
> ==  shouldn't. The only sound way is an opt in *with* confirmation.
> 
> Yeah, right. And that's going to help? 

It will prevent *local* companies from spamming. It also gives providers 
means to cut off spammers without any problems at all.

> Local law isn't going to solve global issues.

Many local providers have good contacts with global providers. Also some 
providers are spread over several countries.

> Unless you have an agreement and commitment amongst
> many nations, then you might be able to solve the spam problem with
> laws. But a law in a tiny country that makes "gedogen" (meaning that
> law enforcement looks the other way) and "let's just ask them to come
> with their own rules" standard policies isn't going to solve anything.

If a few make a step which solves local issues hopefully others will 
follow. Several Dutch spammers have been kicked of the net.

See
http://www.google.com/search?q=bbc+bevelander&hl=en&lr=lang_en

for the downfall of Dutch spam supporter(s).

> ==  I recently read a mail I wrote, complaining like mad about 5 or 6 spam 
> ==  mails a day... those where the days (1997). I receive now 200+ unwanted 
> ==  mails a day :-(. Yet I never going as far as changing my email address 
> ==  or munging the ones in the headers.
> 
> I get tons of unwanted email as well. But spam isn't the biggest
> problem, spam filters work well. Bounces from faked email messages
> send by virusses are. If you want to make laws, start with outlawing
> Microsoft products.

Give the users a different product with the same abilities (ie. running 
attachements) or let them first save the attachement and then double 
click and you will see *exactly* the same behaviour. Once again it is 
the *user*. Three months ago I switched to Thunderbird. Before that I 
used Outlook Express. I never had any *running* virus. Never in 20 years 
one of my computers had a *running* virus, ever.

Different software with 101 warning boxes "Are you really sure" won't 
fix this. Educating users will.

I agree that the bounces are a major annoyance. But also many bounces 
happen because of faked from headers. Emails are harvested from the 
Usenet and not demunged resulting in non existant email addresses.

It is known for ages that the email delivery method has major flaws.

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



------------------------------

Date: Thu, 11 Sep 2003 19:22:08 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Speeding up LWP::Simple
Message-Id: <1063301037.569580@halkan.kabelfoon.nl>

Abigail wrote:

> John Bokma (postmaster@castleamber.com) wrote on MMMDCLXII September
> MCMXCIII in <URL:news:1063219488.463658@halkan.kabelfoon.nl>:
> {}  2mb wrote:
> {}  
> {} > David,
> {} > Why not just use one of the commercially available email harvesting
> {} > packages. Most are available for 19.99. If you are going to spam, it is bet
> {} > to get your list built and operational as soon as possible, before more
> {} > legislation goes into effect.
> {}  
> {}  Why is David named a spammer without any proof? Just for harvesting 
> {}  30,000,000 webpages? There are so many legal things to use it for like 
> {}  text analyses, language analyses, making an estimate of size, analyzing 
> {}  HTML tag use, analysing use of scripting, stylesheets etc.
> 
> 
> My first impression was that he wanted to create a search engine.
> Spamming never crossed my mind.

I had no idea what he wanted except getting 30,000,000 web pages :-)

>(Now, had he said 30,000,000 email addresses....)

Indeed, I gues 30,000,000 pages would get you 30,000 addresses, maybe 
way and way less. Maybe even 3,000. I recently got an URI of a site 
someone found with massive files filled with email addresses. He found 
it by searching on Google with one of his email addresses. (The site is 
down /gone now)

If you want 30,000,000 email addresses you could get those in no time, 
for free. (No I don't have them :-)

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



------------------------------

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5488
***************************************


home help back first fref pref prev next nref lref last post