[17583] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5003 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 30 21:10:38 2000

Date: Thu, 30 Nov 2000 18:10:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975636614-v9-i5003@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 30 Nov 2000     Volume: 9 Number: 5003

Today's topics:
    Re: Multi Recipients from email attachment script (Chris Fedde)
        Need a web-based real-time option quote provider... <davesisk@ipass.net>
        Problems with HTML::FormatText <waitword@mindspring.com>
    Re: Recursively load all objects in an HTML page... <bart.lateur@skynet.be>
        reformat time output <me@privacy.net>
    Re: reformatting a perl script <ka@pacific.net>
    Re: reformatting a perl script <joe+usenet@sunstarsys.com>
    Re: reformatting a perl script <ka@pacific.net>
    Re: reformatting a perl script (Tad McClellan)
    Re: reformatting a perl script <bart.lateur@skynet.be>
        Regex to replace double-returns with <P> <pobbard@hotresponse.com>
    Re: Regex to replace double-returns with <P> <ren.maddox@tivoli.com>
    Re: Regex to replace double-returns with <P> <pobbard@hotresponse.com>
    Re: running encrypted files <jakeeboy420@yahoo.com>
    Re: Search & Replace (Honza Pazdziora)
    Re: Should { } always indicate a scope? <johnlin@chttl.com.tw>
        Sorry Just noticed localtime jmwjr@my-deja.com
    Re: txt files getting denied. <johngros@Spam.bigpond.net.au>
        URL Get targeting HTTPS . . . (Ameen Dausha)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 01 Dec 2000 01:35:17 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Multi Recipients from email attachment script
Message-Id: <pfDV5.38$_g6.189585408@news.frii.net>

In article <906htb$pq4$1@nnrp1.deja.com>,
 <dtbaker_dejanews@my-deja.com> wrote:
>
>>
>> You may also choose to queue the mail using the Net::SMTP module.
>> In this way you can address the envelope directly by using the
>> Net::SMTP::recipient method.  Then you can put almost anything you
>> want into the To: header.
>----------
>yes, but with Net::SMTP is is a much more manual process to handle
>attachments.
>

Did you even bother to look at the code that I posted?  It uses MIME::Lite
to create a body then uses Net::SMTP.  What's so hard about that? 

chris
-- 
    This space intentionally left blank


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

Date: Fri, 01 Dec 2000 00:11:12 GMT
From: "David Sisk" <davesisk@ipass.net>
Subject: Need a web-based real-time option quote provider...
Message-Id: <A0CV5.8706$88.1413743@typhoon.southeast.rr.com>

 ...similar to Yahoo or CBOE (where an http call from Perl can grab a simple
CSV file that is returned), EXCEPT I need real-time stock and option quotes
that don't have any redistribution limitations.  For instance, CBOE offers
paid web-based real-time snapshot quotes similar to their free delayed
quotes, but they have a use limitation (cannot be redistributed).  I need a
real-time provider that charges a monthly fee and doesn't impose any
limitations.  If anyone knows of any possibilities, please post or email!

Best regards,
Dave





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

Date: Fri, 01 Dec 2000 01:09:29 GMT
From: Jim <waitword@mindspring.com>
Subject: Problems with HTML::FormatText
Message-Id: <3A26F9DE.B2FD1EA@mindspring.com>


I am trying to use the HTML::FormatText module and
I have tried the sample code in the pod, but, I get the
following error

    Undefined subroutine &main::parse_htmlfile called at parseHTML.pl
line 4.
    BEGIN failed--compilation aborted at parseHTML.pl line 4.

--- code
 use HTML::FormatText;
# use HTML::Parse         I tried adding it since it's the .ppm with the
sub parse_htmlfile

 $html = parse_htmlfile("index.html");
 $formatter = HTML::FormatText->new(leftmargin => 0, rightmargin => 50);

 print $formatter->format($html);


--- Version Inf.
    OS tried
        2000
        NT 4.0

    Perl -v
    v5.6.0 built for MSWin32-x86-multi-thread

    PPM query HTML
    HTML-Parser [2.23] SGML parser class




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

Date: Fri, 01 Dec 2000 00:54:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Recursively load all objects in an HTML page...
Message-Id: <2atd2t8q36js4ad678hqq95vqb8roqgvbq@4ax.com>

Eli the Bearded wrote:

>If you need a hash, one could be used just for those:
>
>	# Netscape
>	$get{FRAMES} = 'HREF';              # use HREF for <FRAME>
>	$get{IMG}    = { 'SRC', 'LOWSRC' }; # use SRC and LOWSRC for <IMG>
>	$get{TR}     = 'BACKGROUND';        # use BACKGROUND for <TR>

That second one doesn't seem right. You have a hash with 'SRC' as the
key and 'LOWSRC' as the value?

Also:

	$get{IMG}    = [ 'SRC', 'LOWSRC' ];

does show the most annoying property of Perl WRT single/multiple values
for hash values. With autodereferencing, it wouldn't matter, but having
to do

	@src = ref($get{$tag}) ? @{$get{$tag}} : $get{$tag};

is really quite tiresome.

-- 
	Bart.


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

Date: Fri, 01 Dec 2000 01:48:46 GMT
From: "EM" <me@privacy.net>
Subject: reformat time output
Message-Id: <2sDV5.6176$Nw6.20959@news.iol.ie>

How do i turn
Fri Dec  1 01:44:30 2000 (outputted by localtime)
into
01-Dec-2000 01:44

--------
Eric




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

Date: Thu, 30 Nov 2000 15:20:03 -0800
From: Ken <ka@pacific.net>
Subject: Re: reformatting a perl script
Message-Id: <3A26E0A3.78D72994@pacific.net>

I was attempting this when I received your message.
> C-x C-f <filename>
> M-x cperl-mode
I got that far okay, but the next lines confuse me.
I am able to initiate a search / replace dialog, but not sure how the
C-qC-j work?
Can you elaborate a bit on this?
Thanks,
Ken


Joe Schaefer wrote:
> 
> Ken <ka@pacific.net> writes:
> 
> > :-)
> > uh. Thanks, but unless there is a simple set of keystrokes to do this in
> > emacs, I am not likely to figure it out anytime soon, since I don't
> > normally use emacs for editing.
> > Ken
> > ;
> 
> C-x C-f <filename>
> M-x cperl-mode
> M-% ; <RET> ; C-qC-j  <RET> (omit spaces)
> <SPC>, <DEL> as needed
> <TAB>, <SPC> arrow keys as needed
> 
> HTH
> --
> Joe Schaefer


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

Date: 30 Nov 2000 18:25:09 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: reformatting a perl script
Message-Id: <m3hf4pt54a.fsf@mumonkan.sunstarsys.com>

Ken <ka@pacific.net> writes:

> I was attempting this when I received your message.
> > C-x C-f <filename>
> > M-x cperl-mode
> I got that far okay, but the next lines confuse me.
> I am able to initiate a search / replace dialog, but not sure how the
> C-qC-j work?
> Can you elaborate a bit on this?

We're way offtopic here Ken,
but the C-q C-j sequence (Control-q Control-j) 
allows you to add a (formatted) linefeed to the 
end of your replacement string.

After you've taken care of the ";"'s you might need to
repeat with the "{" 's  and "}" 's too.

HTH
-- 
Joe Schaefer


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

Date: Thu, 30 Nov 2000 16:14:11 -0800
From: Ken <ka@pacific.net>
Subject: Re: reformatting a perl script
Message-Id: <3A26ED53.A8F35569@pacific.net>

Well, I upgraded PERL to 5.6.0 and tried this:

perl -MO=Deparse,-upackagename test1.cgi > test2.cgi

Unfortunately, I got an error message...

Can't call method "sibling" on an undefined value at
/usr/local/lib/perl5/5.6.0/i686-linux/B/Deparse.pm line 257.
CHECK failed--call queue aborted.

Looks like a bug in Deparse.pm, unless my command line is wrong.
Ken

Andrew Johnson wrote:
> 
> In article <3A26AB9E.51D6DB7D@mail.org>,
>  Ken <ken@mail.org> wrote:
> > Does anyone know of a RELIABLE script or program for unix or windows
> > that will take a not very readable perl script that has been stripped of
> > most white space and appropriate line returns, and format it in a more
> > standard kind of way?
> > Freeware only please.
> 
> Why not give the Deparse backend module a try:
> 
>     perl -MO=Deparse scriptname > newscriptname
> 
> It changes a few things that are semantically equivelant (like:
> 'while(1)' to 'for(;;)') but the output is readable and not
> only is it free, but if you have 5.6.0, you already have it :-)
> 
> regards,
> andrew
> 
> --
> Andrew L. Johnson   http://members.home.net/andrew-johnson/


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

Date: Thu, 30 Nov 2000 18:21:01 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: reformatting a perl script
Message-Id: <slrn92do6t.7rk.tadmc@magna.metronet.com>

revjack <revjack@radix.net> wrote:
>Randal L. Schwartz explains it all:
>:>>>>> "Tad" == Tad McClellan <tadmc@metronet.com> writes:
>
>:Tad> Ask it here, get the answer here (maybe).
>
>:Get many answers here usually, some of which will be relatively
>:correct, some of which will be wrong, a few of which will likely be
>:wrong in a cargo-cult sense, republished from previous cargo-cult
>:answers from the previous time. :)
>
>That reminds me, what's the general rule for converting a
>list into a scalar again? I keep forgetting.


We can't be just giving that information out.

Pretty soon everybody would know then.

A Cabal needs a secret handshake.

Answer 20 clpmisc questions, write 2 modules, and say
5 Hail Larry's, then we'll talk...


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 01 Dec 2000 00:58:27 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: reformatting a perl script
Message-Id: <sstd2tgchp0918b2784h40ujb26cpk77ss@4ax.com>

Ken wrote:

>Does anyone know of a RELIABLE script or program for unix or windows
>that will take a not very readable perl script that has been stripped of
>most white space and appropriate line returns, and format it in a more
>standard kind of way?

	B::Deparse

or is that O::Deparse?

It has a few bugs. But it shows you what Perl makes of the source.

 ;-)

-- 
	Bart.


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

Date: Thu, 30 Nov 2000 18:11:37 -0500
From: "Philip Obbard" <pobbard@hotresponse.com>
Subject: Regex to replace double-returns with <P>
Message-Id: <OfBV5.4445$d%2.42121@e420r-sjo2.usenetserver.com>

Hi all,

I've tried a slew of ways to get this accomplished, but so far I'm having no
luck. Basically, I have a string called $adcopy that contains something
like:

"Hi Ted,

Good to hear from you."

Now, I want to replace the double-return between "Ted," and "Good" with <P>
so that it displays correctly in a browser.

I tried
$adcopy =~ s/\n\n/<P>/g;
$adcopy =~ s/\\n\\n/<P>/g;
 ...but no luck.

I also tried using ASCII codes for the returns like this:
my $val = "\\" . chr(10) . "\\" . chr(10);
if ($adcopy =~ /$val/) {
   warn "we found double RETURNS!!";
}

Still no match.

Has anyone encountered and solved this before? I have a feeling I'm making a
very obvious mistake...

Thanks,
Philip

--
--------------
Hotresponse - www.hotresponse.com
W: (646) 375-7845
pobbard@hotresponse.com







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

Date: 30 Nov 2000 17:10:33 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Regex to replace double-returns with <P>
Message-Id: <m3vgt52h06.fsf@dhcp11-177.support.tivoli.com>

"Philip Obbard" <pobbard@hotresponse.com> writes:

> Has anyone encountered and solved this before? I have a feeling I'm making a
> very obvious mistake...

Perhaps there are CRs in there as well, in which case you will need
something like:

  s/\r\n\r\n/<P>/;

Another possibility is that you are processing data a line at a time in
which case there will never be two newlines -- but it doesn't sound
like you are doing that, so I expect the former.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 30 Nov 2000 20:17:05 -0500
From: "Philip Obbard" <pobbard@hotresponse.com>
Subject: Re: Regex to replace double-returns with <P>
Message-Id: <AWCV5.3640$am4.52698@e420r-sjo3.usenetserver.com>

Your response got me thinking in a different direction, and it WORKS!

$media_copy =~ s/\012\015/<P>/g;

Even though &ord tells me I have two "10"s in a row, using the *Octal* ASCII
codes for new line and CR seemed to work...

Thanks!!

--Philip

"Ren Maddox" <ren.maddox@tivoli.com> wrote in message
news:m3vgt52h06.fsf@dhcp11-177.support.tivoli.com...
> "Philip Obbard" <pobbard@hotresponse.com> writes:
>
> > Has anyone encountered and solved this before? I have a feeling I'm
making a
> > very obvious mistake...
>
> Perhaps there are CRs in there as well, in which case you will need
> something like:
>
>   s/\r\n\r\n/<P>/;
>
> Another possibility is that you are processing data a line at a time in
> which case there will never be two newlines -- but it doesn't sound
> like you are doing that, so I expect the former.
>
> --
> Ren Maddox
> ren@tivoli.com
>






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

Date: Fri, 01 Dec 2000 00:50:07 GMT
From: Jake <jakeeboy420@yahoo.com>
Subject: Re: running encrypted files
Message-Id: <906sjt$2u7$1@nnrp1.deja.com>

In article <904217$aht@news.or.intel.com>,
  "Kelley Kent" <kelley.a.kent@intel.com> wrote:
> I have some Perl files stored in common areas on our network where
everyone
> has access. I was wondering of there was a way to store these Perl
files
> (.pl, .cgi, etc) encrypted [not sure how i would do this though], and
then
> have some "master" perl control file that would decrypt the files and
then
> execute them. In this way, people could see the perl files but not
know the
> contents, meaning they could not execuste them and whatnot.
>
> And I'm running on Linux, fyi. Any ideas? I've not dealt with any
encryption
> before.
>
> Thanx,
>
> Kelley
>
>
just change the file permissions for everyone with chmod as in:
chmod o-r filename.pl

That'll remove the read permission for others that way no one but
owner/group can read the file. If you don't want them to execute the
file at all just do another chmod:
chmod o-x filename.pl

Also, consult the manpage on chmod.

Later Jake


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 29 Nov 2000 18:18:40 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Search & Replace
Message-Id: <G4stJ4.4r0@news.muni.cz>

On Wed, 29 Nov 2000 11:48:46 -0500, Kris Steinwender <kst3inw3@usvisi0n.c0m> wrote:
> 
>     The incoming file looks like this:
> 
> ACT 250
> JCD 00
> RXN 000838-1
> IDN 00002228
> 
>     And should go out like this:
> 
> ACT 11037
> JCD 00
> RXN 000838-1
> IDN 02228
> 
>     The dictionary file looks like this (the format is:  characters 1->3 are
> the lookups,  4-8 are the replacement number).
> 
> 25511037 StoreA
> 33445102 Store B
> 47235026 StoreC

I fail to see how you mapped 'ACT 250' to 'ACT 11037'.

>     Thank you all in advance, any help or insight would be greatly
> appreciated.

You'll obviously need to read the input files and for reading the file,
use the <> operator. That should give you a good start.

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, MTB, Spain.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: Fri, 1 Dec 2000 09:09:52 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Should { } always indicate a scope?
Message-Id: <906ubj$1mk@netnews.hinet.net>

Nobull <nobull@mail.com> wrote:
> Jeff Pinyan <jeffp@crusoe.net> writes:
>
> > The {...} used for dereferencing a reference (as in @{$aref}) are a
right
> > block, if they don't contain a simple expression.
>
> Can you explain that last bit "if they don't contain a simple
> expression"?
>
> Are there any other situations where @{...} can be made to display
> non-BLOCK semantics?  Note, I say "display".

I've found an example:

    my $x = eval { 1,2,3,[4,5,6] };    # comma operator
    print @$x;
456

But

    my @x = @{ 1,2,3,[4,5,6] };    # exactly the same BLOCK
    print @x;
syntax error at line 1, near "@{ "
Execution aborted due to compilation errors.

John Lin




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

Date: Fri, 01 Dec 2000 01:34:27 GMT
From: jmwjr@my-deja.com
Subject: Sorry Just noticed localtime
Message-Id: <906v73$4up$1@nnrp1.deja.com>

Just noticed localtime in the docs.
That gives me what I was expecting.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 01 Dec 2000 01:16:57 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: txt files getting denied.
Message-Id: <d_CV5.2$xW4.220@news-server.bigpond.net.au>

Thanks guys I got it working correctly through your help.
"Helgi Briem" <helgi@NOSPAMdecode.is> wrote in message
news:3a266ea6.271936944@news.itn.is...
> On Thu, 30 Nov 2000 07:05:49 GMT, "John Boy Walton"
> <johngros@Spam.bigpond.net.au> wrote:
>
> >I created some text files and ran a script against them and I keep
getting
> >permission denied. Here is the script.
> > #!e:/millenium programs/perl/bin/perl
> > use strict;
> > my $path = "C:/Program Files/G6FTP/";
> > my $datapath = "C:/Program Files/G6FTP/ftpdatabase/";
> > my $name = "";
> > opendir DIR, $datapath;
> > my $file = $path."Users.ini";
> > open (USERS, "+>$file");
> > while ( defined( $name = readdir DIR ) )
> > {
> >  chomp ($name);
> >  $file = $datapath.$name;
> >  open BOGUS,">>$file" or die "Unopened because $!";
> >  my $pass = <BOGUS>;
> > $name =~ s/.txt//;
> >  my $value = "[".$name."]\nLogin=".$name."\n"."Pass=".$pass."\n\n";
> >                   print USERS $value;
> >                   unlink $file;
> >      close BOGUS;
> >
> >}
> >closedir DIR;
> >close USERS;
> >I have made no permission changes to them yet they stopped being
accessible
> >to my scripts. Does anyone know what I did to trigger this?
> >
> I dare say you have to close the file before
> you try unlinking it.
>
> I'm to lazy to check for myself.
>
> Regards,
> Helgi Briem




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

Date: Thu, 30 Nov 2000 23:43:45 GMT
From: ameen @ dausha . net (Ameen Dausha)
Subject: URL Get targeting HTTPS . . .
Message-Id: <3a26e591.2577605@news>

How would I go about accessing HTTPS in Perl? In a discussion today
with some peers I was told it was impossible in Perl without using an
unreliable hack.


Ben Wilson (a.k.a. Ameen, Last of the Dausha)
____________________________
-"Ever heard of Aristotle . . . Plato . . . Socrates?!"
-"Yes."
-"Morons!"


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 5003
**************************************


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