[17435] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4855 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 9 11:11:31 2000

Date: Thu, 9 Nov 2000 08:05:10 -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: <973785909-v9-i4855@ruby.oce.orst.edu>
Content-Type: text

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

Today's topics:
    Re: CGI slow, command line fast ? mgrabens@popd.isinet.com
    Re: fileevent not working in Perl Tk for NT (bowman)
        Help needed with dereferencing in multihash j_f9@my-deja.com
    Re: help on improving code (pine2mutt-script ca 130 lin (Jan Schaumann)
    Re: I do not Understand Perl Formats <rick.delaney@home.com>
    Re: I do not Understand Perl Formats <mjcarman@home.com>
    Re: I do not Understand Perl Formats <jeffp@crusoe.net>
        Inline.pm newbie question <djberg96@my-deja.com>
    Re: Last 128 bytes of xxx files? (Bernard El-Hagin)
    Re: Last 128 bytes of xxx files? <stephen.kloder@gtri.gatech.edu>
    Re: Last 128 bytes of xxx files? <jeffp@crusoe.net>
        mail & MIME <bertrand.valle@travelprice.com>
    Re: mail & MIME <james@NOSPAM.demon.co.uk>
    Re: mail & MIME (John J. Trammell)
    Re: mail & MIME <bertrand.valle@travelprice.com>
    Re: Mail mapping from "ÄÜÖ ?1" -> "ÿso-8859-1Q?C4DCD6?" <Peter.Dintelmann@dresdner-bank.com>
    Re: NT4 - How do I display the current userid? <bill_border@agilent.com>
    Re: OOP and information hiding <quantum_mechanic@my-deja.com>
        Passing Cookes Problem kdolan@my-deja.com
        Please teach how to read binary data in Perl language. <naoto21@cronos.ocn.ne.jp>
    Re: Problem reading a binary file <Peter.Dintelmann@dresdner-bank.com>
    Re: Pushing a hash on to a stack... <ren.maddox@tivoli.com>
    Re: strip html tags from string $text (Bernard El-Hagin)
    Re: strip html tags from string $text <james@NOSPAM.demon.co.uk>
    Re: strip html tags from string $text <joe+usenet@sunstarsys.com>
        suggestions for sorting data skoch71@my-deja.com
    Re: Win32::OLE excel.application struax_58@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 09 Nov 2000 15:51:43 GMT
From: mgrabens@popd.isinet.com
To: chronofish@my-deja.com
Subject: Re: CGI slow, command line fast ?
Message-Id: <8ueh6b$ub1$1@nnrp1.deja.com>

	Thanks for the message, but I tried that and it had a little impact. At
first my timestamps were recorded and then not printed out until the
entire page was ready... The time stamps take place in the parsing
function and do not have any I/O associated with them.

	When I printed out the place and time to see if the there was something
I was hanging on... That was only for a test, and I was not using that
as the times mentioned, though the times do not change by much.

Thanks,
  Mike

In article <8tutt5$l0o$1@nnrp1.deja.com>,
  chronofish@my-deja.com wrote:
> The difference that you see is probably because when going through the
> CGI you are making a message request, which takes time, forking off a
> process, which takes time, gathering processes output, which takes
> time, and sending a messag back to the browser, which takes time.
>
> I'll go out on a limb here and suggest that if you were to concatenate
> to a buffer rather than printing out as you parse, and print the
buffer
> after your processing was complete, your time stamps would show a huge
> improvement (though I can not quarentee that the response time to the
> user will be any better).
>
> Good luck!
> - Christopher
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> www.chronofish.com
>
> In article <8tpj7j$6jg$1@nnrp1.deja.com>,
>   mgrabens@popd.isinet.com wrote:
> > I am having a odd problem. I wrote a simple little subroutine that
> uses
> > regular expressions to parse a file. When I hit a particularly large
> > file it takes the CGI 15-20 seconds to parse it. To look into the
> > performance issues, I wrote a command line script that uses the
> library
> > and parses the same file. The command line version takes between 1.5
> and
> > 2 seconds (used Time::HiRes).
> >
> > I have tested the CGI on both apache and Netscape server, same basic
> > time results.
> >
> > Both the CGI and command line are using the same Perl. Run times
were
> > taking one right after another, so system load may have changed, but
> not
> > that drastically. Plus the time differences are consistently off by
> > roughly the same amount. (ie. 1.5 seconds from the command line, CGI
> 15
> > seconds, 1.9 seconds from the command line, CGI 19 seconds).
> >
> > It is definately not a decimal problem (though it appears like
that).
> >
> > I have printed out the information as I parse it with a time stamp
and
> > it shows a natural progression through the file. IOW: the regular
> > expressions are not getting into some strange loop. (no visible
jumps
> in
> > seconds between any part of the file, nice and consistant.)
> >
> > Does the priority level cause this much of a difference ?
> >
> > Any other ideas ?
> >
> > I am stumped...
> >
> > Thanks,
> >   Mike
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: Thu, 09 Nov 2000 14:52:43 GMT
From: bowman@news.montana.com (bowman)
Subject: Re: fileevent not working in Perl Tk for NT
Message-Id: <slrn90lf29.l28.bowman@localhost.localdomain>

Ian Mackenzie <ian_mackenzie@agilent.com> wrote:

!I have a PerlTk program that uses sockets with the fileevent
!set to call the callback sub when the socket filehandle is readable,
!this works fine in unix but in WINNT the filevent calls ths callback
!sub even when there is no connection to the socket filehandle, has ANYONE
!found a fix to this dammed problem

Install Linux? I only played with the problem briefly, but afaik, sockets
are NOT files on Windows, and do not function the same. 





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

Date: Thu, 09 Nov 2000 14:21:54 GMT
From: j_f9@my-deja.com
Subject: Help needed with dereferencing in multihash
Message-Id: <8uebtq$pak$1@nnrp1.deja.com>

Here goes.  I'm trying to store multiple values in a multihash, well
just one for now, but they will pile up later on.

use File::stat;
 ...
foreach $key (sort keys %{$hashFtp{'LISTEFIC'}}) {
   $sb = stat($key);
   $tempo = $sb->mode & 07777;
    push( @{$hList{$key}}, $tempo);

    # printing here is just for display
    printf "File is %s, size is %s, perm %04o, mtime %s\n",
        $key, $sb->size, $sb->mode & 07777,
        scalar localtime $sb->mtime;
   }

Perms for a set of given files, for example, are 0555 and 0664, which
is just OK.

The problem seems to be here.  Every way I dereference the value, file
perms differ from the ones previously displayed.

foreach $key (sort keys %hList) {
   print "@{$hList{$key}}\n";
}

Now perms displayed, for the same set of files, are 365 and 436. (???)

I badly need some enlightment with this one.

[perl version 5.005_03 built for aix]

Greetings,
FT


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


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

Date: Thu, 09 Nov 2000 15:20:00 GMT
From: jschauma@www.netmeister.org (Jan Schaumann)
Subject: Re: help on improving code (pine2mutt-script ca 130 lines)
Message-Id: <slrn90lg9a.2og.jschauma@www.netmeister.org>

Tad McClellan wrote:
>On Wed, 8 Nov 2000 19:27:33 -0500, I myself wrote:
>
>>Never ever use the dollar-digit variables unless you have
>>first tested to see if the match succeeded:
>
>[snip]
>
>>Probably best, would be to use a pattern match in list context:
>>
>>   ($nick, $name, $tmp) = /([^\t]*)\t([^\t]*)\t(.*)$/;
>
>
>But you of course need to see if _that_ match succeeded too:
>
>   die "line $. did not have 2 tab chars\n" 
>      unless ($nick, $name, $tmp) = /([^\t]*)\t([^\t]*)\t(.*)$/;

Hmmm... maybe I'm not getting it, but shouldn't it be "if" instead of "unless"?
If it's "unless", then doesn't that mean "if $nick,$name,$tmp have NOT been
properly assigned"?

Or does the fact that there is no unless-body after the unless do something I
don't understand?

-Jan

-- 
Jan Schaumann <http://www.netmeister.org>

"Lightspeed briefs: style and comfort for the discriminating crotch."
-announcer 


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

Date: Thu, 09 Nov 2000 14:14:43 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: I do not Understand Perl Formats
Message-Id: <3A0AB474.86018627@home.com>


Bart Lateur wrote:
> 
> The only bonus you get with formats, is that it can do line wrapping for
> you. But it ain't much of a bonus, because you must specify, in the
> format, how many lines you want.

Only if you want something less than everything.

> format =
> ^<<<<<<<<<<<<<
> $x
> ^<<<<<<<<<<<<<
> $x
> ^<<<<<<<<<<<<<
> $x
> ^<<<<<<<<<<<<<
> $x
> ^<<<<<<<<<<<<<
> $x
> ^<<<<<<<<<<<<<
> $x
> ^<<<<<<<<<<<<<
> $x
> .
> 
> $x = "The only bonus you get with formats, is that it can do line " .
> "wrapping for you.";
> write;

    format =
    ^<<<<<<<<<<<<<~~
    $x
    .

And there's always formline.  I agree that the biggest advantage of
formats is line wrapping but they do a better job of it than Text::Wrap
or any of the other modules out there.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 09 Nov 2000 08:14:29 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: I do not Understand Perl Formats
Message-Id: <3A0AB145.DA5A7BA1@home.com>

Bart Lateur wrote:
> 
> The only bonus you get with formats, is that it can do line wrapping
> for you. But it ain't much of a bonus, because you must specify, in 
> the format, how many lines you want.

Actually, you don't. After our illustrious Mr. Christiansen went on a
crusade about using formats instead of Text::Wrap recently, I forced
myself to finally play with them enough to learn them (a little). At
first, I thought this was the case too, and thus thought that formats
were pretty useless. After a closer reading of perlform, I uncovered the
'~~' option:

format = 
^<<<<<<<<<<<<<~~
$x
 .

$x = "The only bonus you get with formats, is that it can do line " .
"wrapping for you.";

write;

This gives the same result as your example, without all the extra lines
of code:

> The only bonus
> you get with
> formats, is
> that it can do
> line wrapping
> for you.

Another thing is that you can create multi-column reports (kind of like
a newspaper layout). There's an example of this in perlform. I've never
had a use for it myself, but I thought it was kind of cool.

I still haven't found formats useful for anything I do, but now that I
know a little about them, I might in the future.

-mjc


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

Date: Thu, 9 Nov 2000 10:07:34 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: I do not Understand Perl Formats
Message-Id: <Pine.GSO.4.21.0011091005480.25361-100000@crusoe.crusoe.net>

On Nov 9, Michael Carman said:

>Bart Lateur wrote:
>> 
>> The only bonus you get with formats, is that it can do line wrapping
>> for you. But it ain't much of a bonus, because you must specify, in 
>> the format, how many lines you want.
>
>Actually, you don't. After our illustrious Mr. Christiansen went on a
>crusade about using formats instead of Text::Wrap recently, I forced

*shock*  I did multiple rants on that before tchrist did. ;)

One of them even involved Go*****a.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/



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

Date: Thu, 09 Nov 2000 14:19:40 GMT
From: Daniel Berger <djberg96@my-deja.com>
Subject: Inline.pm newbie question
Message-Id: <8uebpk$p88$1@nnrp1.deja.com>

Hi all,

Just read the latest TPJ article on Inline.pm.  Very nice.

My question is, how do I "use" a C header file that isn't part of
stdio.h (such as a custom header file)?  All of the examples I've found
either had the C code included in the module or used functions out of
stdio.h.

Thanks in advance for any help.

Regards,

Dan

--
In the immortal words of Socrates, "I drank what?"


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


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

Date: Thu, 9 Nov 2000 14:08:59 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Last 128 bytes of xxx files?
Message-Id: <slrn90lbu0.2jm.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 09 Nov 2000 14:48:16 +0100, Damir Boraska <damir.boraska@hrt.hr>
wrote:
>
>... what is the most EFFICIENT way, how to read dozens
>of files (which are binaries, mp3's - more precisely)
>...but just last 128 bytes of eacf file? (ID3 tag), without 
>the need to scan through the whole file? 

I believe the 'read' function can help here.

perldoc -f read

Cheers,
Bernard
--
perl -le '$#="Just Another Perl Hacker"; print \Bernard'


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

Date: Thu, 09 Nov 2000 09:34:29 -0500
From: Stephen Kloder <stephen.kloder@gtri.gatech.edu>
Subject: Re: Last 128 bytes of xxx files?
Message-Id: <3A0AB5F5.8BC01121@gtri.gatech.edu>


Damir Boraska wrote:

> ... what is the most EFFICIENT way, how to read dozens
> of files (which are binaries, mp3's - more precisely)
> ...but just last 128 bytes of eacf file? (ID3 tag), without
> the need to scan through the whole file?
>
> Thanx for aqny help, I'd appreciate also being put in Cc :-)

perldoc -f seek



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

Date: Thu, 9 Nov 2000 10:41:46 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Last 128 bytes of xxx files?
Message-Id: <Pine.GSO.4.21.0011091019540.25361-100000@crusoe.crusoe.net>

[posted & mailed]

On Nov 9, Damir Boraska said:

>... what is the most EFFICIENT way, how to read dozens
>of files (which are binaries, mp3's - more precisely)
>...but just last 128 bytes of eacf file? (ID3 tag), without 
>the need to scan through the whole file? 

While seek() and read() are the solution, you might want to look for an
MP3 module on CPAN.  I know there's one that exists that reads the ID3 tag
for you.  Perhaps in the Audio:: hierarchy... http://search.cpan.org/

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/



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

Date: Thu, 09 Nov 2000 15:54:11 +0100
From: Bertrand =?iso-8859-1?Q?Vall=E9?= <bertrand.valle@travelprice.com>
Subject: mail & MIME
Message-Id: <3A0ABA92.B039A1B8@travelprice.com>

hi all

i really need your help, i don't know how to encode a .html file into
MIME format in order to send it vie mail after ..

Can anybody help me ??
THX



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

Date: Thu, 9 Nov 2000 15:35:49 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: mail & MIME
Message-Id: <ant0915490b0fNdQ@oakseed.demon.co.uk>

In article <3A0ABA92.B039A1B8@travelprice.com>, Bertrand Vallé
<URL:mailto:bertrand.valle@travelprice.com> wrote:
> 
> i really need your help, i don't know how to encode a .html file into
> MIME format in order to send it vie mail after ..

There was a thread about this recently with subject "Emailing formatted".
I suggested MIME::Lite and Peter Sundstrom added the suggestion of
using MIME::Lite::HTML.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: 9 Nov 2000 15:48:22 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: mail & MIME
Message-Id: <slrn90knd8.a9e.trammell@nitz.hep.umn.edu>

On Thu, 09 Nov 2000 15:54:11 +0100, Bertrand Vallé
<bertrand.valle@travelprice.com> was all like:
>i really need your help, i don't know how to encode a .html file into
>MIME format in order to send it vie mail after ..

You might want to look at the MIME::Lite module.

-- 
John J. Trammell
johntrammell@yahoo.com


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

Date: Thu, 09 Nov 2000 16:51:28 +0100
From: Bertrand =?iso-8859-1?Q?Vall=E9?= <bertrand.valle@travelprice.com>
Subject: Re: mail & MIME
Message-Id: <3A0AC800.17CF6209@travelprice.com>

thx

but where i can find some informations about this class ?
is it in originally package of perl ?

Bertrand.

James Taylor wrote:

> In article <3A0ABA92.B039A1B8@travelprice.com>, Bertrand Vallé
> <URL:mailto:bertrand.valle@travelprice.com> wrote:
> >
> > i really need your help, i don't know how to encode a .html file into
> > MIME format in order to send it vie mail after ..
>
> There was a thread about this recently with subject "Emailing formatted".
> I suggested MIME::Lite and Peter Sundstrom added the suggestion of
> using MIME::Lite::HTML.
>
> --
> James Taylor <james (at) oakseed demon co uk>
> PGP key available ID: 3FBE1BF9
> Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Wed, 8 Nov 2000 15:47:01 +0100
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Mail mapping from "ÄÜÖ ?1" -> "ÿso-8859-1Q?C4DCD6?"
Message-Id: <8ubp2c$ll71@intranews.bank.dresdner.net>

    Hi Dirk,

Harms Dirk schrieb in Nachricht <3A091ED6.4ABE5F5B@nokia.com>...

>some emails (Outlook :-( have a subject e.g.:
>=?iso-8859-1?Q?=C4=DC=D6_=3F1
>which was:
>ÄÜÖ
>
>Does anybody konws a module (CPAN) which allows me
>to convert "=?iso-8859-1?Q?=C4=DC=D6_=3F1" back to "ÄÜÖ"?

    partial solution:
    The MIME::QuotedPrint module offers a method decode_qp()
    which lets you turn '=C4=DC=D6' back to the German
    umlauts 'ÄÜÖ'.
    Hope that helps.

    Regards,

        Peter Dintelmann





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

Date: Thu, 9 Nov 2000 07:45:26 -0700
From: "Bill Border" <bill_border@agilent.com>
Subject: Re: NT4 - How do I display the current userid?
Message-Id: <8uedaf$lf7$1@nonews.col.hp.com>

Thanks! That worked (using LoginName). Cool!

Now, here's a toughie: is there a way to change to
another ID (my process runs as SYSTEM). In Unix
there are commands like sys or su where you can
change the userid of the running session. Does
such a utility exist in NT?  I'm trying to connect to
an Oracle database using OS authentication (ODBC)
so the SYSTEM userid that this runs as is unfortunate.

Thanks!
Bill

Philip Garrett wrote in message
<_DqO5.9699$I8.1590792@typhoon.southeast.rr.com>...
>Bill Border <bill_border@agilent.com> wrote in message
>news:8uchnf$f7k$1@nonews.col.hp.com...
>> Hi All,
>>
>> I am running a Perl pgm that is invoked from a unix server (with
>> the resource kit rsh nt daemon) and in order to get an ODBC
>> Oracle application to work, I need to know what USERID it my
>> task is running under.
>>
>> The $> variable returns 0.     ??????
>
>From perldoc win32:
>
> Win32::LoginName()
>     [CORE] Returns the username of the owner of the current perl
>     process.
>
>For some reason, the Win32 module documentation isn't in the toc frame of
my
>ActiveState documentation, but I knew I had seen it before somewhere else.
>Anyway, just "use Win32;", and then Win32::LoginName() will be what you're
>looking for.
>
>good luck,
>p
>
>




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

Date: Thu, 09 Nov 2000 14:16:13 GMT
From: Quantum Mechanic <quantum_mechanic@my-deja.com>
Subject: Re: OOP and information hiding
Message-Id: <8uebj7$p5v$1@nnrp1.deja.com>

In article <slrn90h57a.na9.abigail@tsathoggua.rlyeh.net>,
  abigail@foad.org wrote:
> On Tue, 07 Nov 2000 18:27:22 GMT, Chris Fedde
(cfedde@fedde.littleton.co.us) wrote in comp.lang.perl.misc <URL:
news:<eQXN5.226$Bf7.189811200@news.frii.net>>:
> ++ In article <slrn90fvml.ctp.abigail@tsathoggua.rlyeh.net>,
> ++ Abigail <abigail@foad.org> wrote:
> ++ >
> ++ >Perls way of implementing OO is actually anti-OO, as it gives the
> ++ >user of the class (that is, the inheriting class) all the baggage
> ++ >of the implementation. Precisely what OO is *NOT* supposed to do.
> ++ >"Stick to the interface" should all that's needed to succesfully
> ++ >use objects. But in Perl, it's "stick to the implementation".
> ++ >
> ++
> ++ OK, I'll accept that hash as instance variable was short sighted.
> ++ What is the fix?  Is it even possible to fix things now?  Or will
> ++ fixing it break backward compatibility? Most of the CPAN classes
> ++ use this convention because that is what is recommended in the
> ++ documentation.   Can we simply re-write perltoot and perlbot to
> ++ encourage a safer technique?  Maybe we should adopt object as
> ++ closure as the recommended convention.
>
> I don't think it's "fixable", for two reasons:
>    -  It would break just too much code out there.
>    -  People *like* the current mess; perhaps because it gives them
>       a sensation of 'freedom'. Maybe for the same reason people
>       like the lack of a string datatype in C: it gives them more
>       freedom of implementing strings themselves.
>
> Abigail
>

So it's not fixable? OK, let's take that as an assumption.

Abigail, what should it have been? What should it be? Your answers may
take idealistic and/or practical tacks, as you see fit. Damian seems to
have a practical approach working (I don't like to say "finished" -
programmers never finish), which perhaps could be refined or broadened
to meet a wider need.

Actually, I got the (faint) impression that Abigail is in a complaining
mood (maybe recently depressed by the state of the machine). Damian says
"Try this", Abigail says "That still has problems, and the problems are
unfixable."

This is an important thread here. Can we up the ante and have some real
impact? Or is this the Rabbi and the Priest having a good game at our
expense?

I hope I don't see this subject line anytime soon:

    Perl Eventually Reached Limit

-QM
--
Quantum Mechanics: The dreams stuff is made of.


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


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

Date: Thu, 09 Nov 2000 15:21:27 GMT
From: kdolan@my-deja.com
Subject: Passing Cookes Problem
Message-Id: <8uefdd$sko$1@nnrp1.deja.com>

I don't know if I've got sort of a unique problem, but after
researching everything I can find on Perl and Cookies and looking at
numerous examples, I have still not been able to piece together a
script that will do what I need.  Any help will be greatly appreciated.

I have a COM object in a web browser that makes a call to a Perl script
on a server.  I need this Perl script to call an ASP (on the same
server running under Microsoft's IIS) to retrieve some information and
then pass it back to the COM object.  I HAVE THIS WORKING...so what's
the problem?

The web app running under IIS is not stateless and depends on cookies
(the SessionID assigned to it by IIS) to identify which client is
requesting information so it can forward the request for information to
the approprate web app instance.  As a result, the ASP needs to know
from which client the request for information has come.  This should be
simple.  One thought was to have the Perl script get the cookies
belonging to the client and then just pass them with the call to the
ASP.  Another thought was to have the Perl script get the cookes
belonging to the client, find the value associated with the SessionID
cookie and then just pass that value with the call to the ASP.

After spending a week on this, getting close at times but never really
achieving my goal, I find myself frustrated.  One last thing...my
initial solution was to have the Perl script redirect the client to the
ASP.  While this works if you enter the name of the Perl script in the
browser (and the ASP returns the correct state information), the COM
object, which I have no control over, does not handle redirection.
Thus, my need for requiring the Perl script to retrieve the correct
data.

Thanks!

- Kelly


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


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

Date: Thu, 9 Nov 2000 23:39:08 +0900
From: "OJA" <naoto21@cronos.ocn.ne.jp>
Subject: Please teach how to read binary data in Perl language.
Message-Id: <8uecua$16u$1@nn-tk106.ocn.ad.jp>

Please teach how to read binary data in Perl language.
Will you please point out any mistakes to me in this program.

I want to read image data in Perl,but I don't achieve my purpose.
My program can read a part of binary data and can not all of them.
The Z of black character in the binary data prevents the program from
reading binary data.

System environment: Active Perl 522
                             MS/DOS

The following is my program.
#!C:/Perl/bin/perl

binmode FH;
binmode FH2;
open FH,"<test.jpg";
@stat = stat FH;
read FH,$data,$stat[7];
open FH2,">test2.jpg";
printf FH2 "$data";



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

Date: Tue, 7 Nov 2000 11:11:20 +0100
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Problem reading a binary file
Message-Id: <8u8kh8$me71@intranews.bank.dresdner.net>

    Hi,

>$thebin= "genvoto.exe";
>open(thebin);
>sysread(thebin, $binoutput, 19968);
>
>
>The problem is that the variable $binoutput only gets 1600 bytes
instead
>of 19968. The 1600 bytes it gets are Ok

    try binmode() on your handle.

    Regards,

        Peter Dintelmann





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

Date: 08 Nov 2000 20:29:02 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: Pushing a hash on to a stack...
Message-Id: <m366lxlvyp.fsf@dhcp11-177.support.tivoli.com>

craznar@hotmail.com (Christopher Burke) writes:

> To clarify - the 'push line can use references until the cows come home' 
> however the code that puts the elements into the hash CANNOT, and neither 
> can the code that extracts the elements at the end.
> 
> i.e.
> 
> %hash{x} = 3;  # this line is fixed
> %hash{y} = 4;  # as is this

Actually, these two lines are syntax errors.  I'll assume you mean for
those "%"s to be "$"s.

> push @fulldata, ???(%hash)???  # whatever references you want
> print $fulldata[0]{x};    # this line is fixed - prints 3
> print $fulldata[0]{y};    # this line is fixed - prints 4

And these two lines use references.  $fulldata[0] holds a reference to
a hash.  $fulldata[0]{x} is just a shorthand for $fulldata[0]->{x},
which is, itself, a shorthand for ${$fulldata[0]}{x}.

There be references here....

Assuming you're OK with the fact that these are references, then the
push line can simply be:

  push @fulldata, { %hash };  # which creates a new hash explicitly

or, if %hash is a lexical that will go out of scope every time:

  push @fulldata, \%hash;     # but do not reuse the same %hash

Does that work for you?

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 9 Nov 2000 14:06:15 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: strip html tags from string $text
Message-Id: <slrn90lboq.2jm.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 09 Nov 2000 14:38:53 +0100, Damir Boraska <damir.boraska@hrt.hr>
wrote:
>
>Instead of writing useless sentences such as 
>"go and read the FAQ", you people could have
>just written this:
>
> $text =~ s/<.*?>//g;
>
>and actually HELP someone.
>Was that such an effort????

Not much of an effort for not much of a solution. Had you read the FAQ
yourself you'd have realised why your solution is inadequate at best.

Cheers,
Bernard
--
perl -le '$#="Just Another Perl Hacker"; print \Bernard'


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

Date: Thu, 9 Nov 2000 15:40:16 +0000
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: strip html tags from string $text
Message-Id: <ant0915161cbfNdQ@oakseed.demon.co.uk>

In article <slrn90lboq.2jm.bernard.el-hagin@gdndev25.lido-tech>,
Bernard El-Hagin <URL:mailto:bernard.el-hagin@lido-tech.net> wrote:
>
> On Thu, 09 Nov 2000 14:38:53 +0100,
> Damir Boraska <damir.boraska@hrt.hr> wrote:
> >
> > Instead of writing useless sentences such as 
> > "go and read the FAQ", you people could have
> > just written this:
> >
> > $text =~ s/<.*?>//g;
> >
> > and actually HELP someone.
> > Was that such an effort????
> 
> Not much of an effort for not much of a solution. Had you read the FAQ
> yourself you'd have realised why your solution is inadequate at best.

Do you have a particular case in mind where Damir's regex would fail
to strip HTML tags from $text?

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: 09 Nov 2000 10:48:57 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: strip html tags from string $text
Message-Id: <m3zoj9du3a.fsf@mumonkan.sunstarsys.com>

James Taylor <james@NOSPAM.demon.co.uk> writes:

> > > $text =~ s/<.*?>//g;

> > Not much of an effort for not much of a solution. Had you read the FAQ
> > yourself you'd have realised why your solution is inadequate at best.
> 
> Do you have a particular case in mind where Damir's regex would fail
> to strip HTML tags from $text?
> 

<html><head><title>Hi</title></head>
<body><a href='http://www.perl.com'
target='ext' onClick='alert( "1 > 2");'>
Something's wrong with the regexp</a>
</body>
</html>

-- 
Joe Schaefer



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

Date: Thu, 09 Nov 2000 14:57:28 GMT
From: skoch71@my-deja.com
Subject: suggestions for sorting data
Message-Id: <8uee0j$rc5$1@nnrp1.deja.com>

I'm working on a perl script to parse through Squid logs.  I know
there's a bunch of other stuff already out there to do that kind of
stuff, but I'm doing this for me as a learning experience.  Here's two
lines from a squid access.log file so you can see where I'm coming from:

973772776.732    333 host1.mydomain TCP_MISS/200 800 GET
http://www.bellsouth.com/estore/images/g_images/clr_gui_11.gif -
DIRECT/www.bellsouth.com image/gif
973772776.850    405 host1.mydomain TCP_MISS/200 877 GET
http://www.bellsouth.com/estore/images/g_images/clr_gui_12.gif -
DIRECT/www.bellsouth.com image/gif

Here's what I've got so far:

print "Enter input file: ";
$input_file = <STDIN>;
open(INPUT, "<$input_file") || die ("Can't open input file!!\n");

print "Enter output file: ";
$output_file = <STDIN>;
open(OUTPUT, ">$output_file") || die ("Can't create output file!!\n");

@file_data = <INPUT>;

foreach $line(@file_data) {
   @fields = split(/\s+/,$line);
   ($rawtime, $bytes, $source, $squidstat, $unknown, $action,
$destination) = @fields;
   ($seconds, $minutes, $hours) = localtime($rawtime);
   write OUTPUT;
#   printf OUTPUT "%02d:%02d:%02d\t%s\t%s\t%s\n", $hours, $minutes,
$seconds, $source, $destination;
}


close(INPUT);
close(OUTPUT);

format OUTPUT =
@##:@##:@##   @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$hours, $minutes, $seconds, $source, $destination
 .

As you can see I've been playing with the output using printf and a
format.  But really what I want to do now is sort my output.  I want to
group all of the source addresses with all of their destination
addresses (by time) rather than simply printing them in the order that I
got them from the log.  I started to think that I needed to build a hash
from my @fields array inside my foreach loop, but I was getting too
confused and am not sure that that's right.  The bottom line is that I'm
looking for an approach on taking $time, $source, and $destination and
then sorting it.  I'd even ultimately like to figure out how to split up
the url (working the regular expression to do that) and maybe not print
duplicates, but hey I gotta do one thing at time.  ;-)  Anyway, if
anyone would mind giving me a tip on an approach for sorting my data,
sorting an array, another hash...?, I'd sure appreciate it.  Thanks.

Steve


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


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

Date: Thu, 09 Nov 2000 15:47:24 GMT
From: struax_58@my-deja.com
Subject: Re: Win32::OLE excel.application
Message-Id: <8uegu9$u5k$1@nnrp1.deja.com>

In article <r3YN5.57386$Z2.807558@nnrp1.uunet.ca>,
  "pd" <pd@psps.com> wrote:
> Hi
> First off let me say that I am not experienced in the use of
Win32::OLE, or
> with Objects in Perl
>
> What I am trying to create is an automation script to convert a comma
> seperated variable file (*.csv) into a MS Excel 97 Workbook (*.xls)
>
> I have searched the web and all of the reference material I can find,
but
> this seems to be undocumented territory.  everything I have found is
either
> outdated (excel 95) or doesn't cover file formats
>
> here is a code snippit
>
> use Win32::OLE;
> $excel = new Win32::OLE('Excel.Application')
>             || die "Excel did not start $! \n";
>
> $excel->{'Visible'}=1;
>
> my $Workbook = $excel->Workbooks->Open("$csvfile") || print" file not
found
> \n";
>
> my $Worksheet = $Workbook->Worksheets(1);
>
> #select the worksheet and autofit the columns
> $Worksheet->Cells->Select();
> $Worksheet->Cells->EntireColumn->AutoFit();
>
> $Worksheet->SaveAs("$path$xlfile") || print "didnt save the
$path$xlfile
> file $!\n";
>
> ____ end snippit ______
>
> this does load the .csv file, and saves it as a .xls file, but it
does not
> save in the .xls file format
>
> any suggestions as to how to set the file format attribute before or
during
> the save?
>
> pd - Think that I have a solution.  As I understand it you cannot use
the file format constants as specified in the documentation for Excel
VBA directly.  There are integer equivalents for the different file
types (which is the second attribute in the SaveAs function.  Using the
VBA browser in Excel (Excel 97), I was able to determine that the
constant for normal files -4143, text files is -4158 and csv files is 3.

I changed your script to the following:

#!/usr/bin/perl
use warnings;   #5.6
use strict;
my $excel;
my $name;
my $file_out = "csv_out";
my $file_type = -4143;     #Constant equivalent for a normal workbook
use Win32::OLE;
$excel = new Win32::OLE('Excel.Application')
            || die "Excel did not start $! \n";

$excel->{'Visible'}=1;

my $Workbook = $excel->Workbooks->Open("csv_test.csv") || print" file
not found \n";
my $Worksheet = $Workbook->Worksheets(1);

#select the worksheet and autofit the columns
$Worksheet->Cells->Select();
$Worksheet->Cells->EntireColumn->AutoFit();

$Workbook->SaveAs({FileName => $file_out, FileFormat => $file_type})
	|| print "didnt save the  file $!\n";

This worked on my machine and produced a normal workbook with the
manipulations in excel.

Hope this helps.

ST


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


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

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 4855
**************************************


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