[15822] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3235 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 2 11:05:28 2000

Date: Fri, 2 Jun 2000 08:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959958310-v9-i3235@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 2 Jun 2000     Volume: 9 Number: 3235

Today's topics:
    Re: Can not expire cookies !! <methos495@earthlink.net>
    Re: Case-Insensitive String Comparison <tina@streetmail.com>
    Re: file dates being reported incorrectly..... scumjr@my-deja.com
    Re: Globbing with ActivePerl (jason)
    Re: How to find out height and width of a PNG graphic (jason)
    Re: my Foo $self = shift; <abe@ztreet.demon.nl>
    Re: my Foo $self = shift; (Kai Henningsen)
    Re: mysql insertid (jason)
        Perl and notepad aren't playing nice. <randythefirstNOraSPAM@hotmail.com.invalid>
    Re: Perl and notepad aren't playing nice. <bill@billcampbell.com>
    Re: Perl and notepad aren't playing nice. (Rasputin)
    Re: Perl and notepad aren't playing nice. <randythefirstNOraSPAM@hotmail.com.invalid>
    Re: Perl and notepad aren't playing nice. <randythefirstNOraSPAM@hotmail.com.invalid>
    Re: Perl and notepad aren't playing nice. (Daniel Winsor - HESE)
    Re: perl-5.6.0 and UTF8 character weirdness sendrate@my-deja.com
    Re: perl-5.6.0 and UTF8 character weirdness (Bart Lateur)
    Re: perl-5.6.0 and UTF8 character weirdness (Ilya Zakharevich)
        Printing on a Remote Printer <bopeaslee@rcn.org>
    Re: problem with perl garbage collecting (Ilya Zakharevich)
        Speed newbie@db-networks.com
        TCP IPC and Perl <methos495@earthlink.net>
    Re: the end of perl? <gellyfish@gellyfish.com>
    Re: the end of perl? <gellyfish@gellyfish.com>
    Re: Trouble with Arrays of Hashes <tlanierNOtlSPAM@atmel.com.invalid>
    Re: University graduate seeking for IT positions <andersen+@rchland.ibm.com>
    Re: University graduate seeking for IT positions <tomp@sharpcom.com>
    Re: Using awk in perl? <apietro@my-deja.com>
    Re: Web-based email solutions (jason)
    Re: Web-based email solutions <apietro@my-deja.com>
    Re: Win32::Eventlog <elynt@exchange.ml.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 02 Jun 2000 14:35:33 GMT
From: methos <methos495@earthlink.net>
Subject: Re: Can not expire cookies !!
Message-Id: <3937C70C.CECE95F9@earthlink.net>

I know this may not be an acceptable suggestion,
but try writing to the cookie without using cgi.pm

Do it straight.
I haven't done cookies in 4 years, so my syntax may be way off, but if you
do something like this:

print "Content-type: text/html\n";
print "Set-Cookie: expires=Monday, 19-Feb-96 00:01:00 CST\n";
print "\n";

--
- Methos -
"What a Wicked Game you play, That you don't feel this way
What a Wicked thing to do, make me dream of you"
      - Chris Isaak -

jbrzezi@my-deja.com wrote:

> I am using CGI::Cookie module.
> I can read cookies but I have problem with expiring them:
>
> I tried:
>
> @content_cookie=();
> %cookies = fetch CGI::Cookie;
> foreach(keys %cookies)  #get existing cookies
>   {
>     $current_cookie    = $cookies{$_};
>     $current_cookie->expires('-1d');
>     push(@content_cookie, $current_cookie);
>   }
> print header(-cookie=>\@content_cookie);
>
> according to documentation all the cookies with passed expiration date
> should not exist anymore.
> However when I read cookies again they are there !
> Any suggestions ?
>
> Thanks,
> Jerzy (jerzy@nandoDOTcom)
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.






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

Date: 2 Jun 2000 14:02:42 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Case-Insensitive String Comparison
Message-Id: <8h8eq1$2k6ek$2@fu-berlin.de>

hi,

Herr Stumpfenstiel <herr_stumpfenstiel@lycosmail.com> wrote:
> "Courtney Tompos" <cdt9@cornell.edu> schrieb im Newsbeitrag
> news:8h6ufm$o2p$1@news01.cit.cornell.edu...
>>
>> That said, I want to compare two strings to check whether one ($var2) is a
>> substring of the other ($var1). Thus the first thing I did was $var1 =~
>> $var2. Now here's my question! How can I alter the code so that its not
>> case-sensitive?
>>
>> $var1 = "Thesaurus";
>> $var2 = "THE";

> You shouldn't use regular expressions unless you can be sure that there
> aren't any wildcards like [*+.] in $var2. ($var2 = "THE+" would match THE,
> THEE, THEEE, ...)

> You *could* use (If there aren't any wildcards)
> $var1 =~ /$var2/i;
> to match case insensitive (see perlre)

why not use regex? let' say 
$a = "99";
$s = q($a.*);
$t = q(abc456$a.*);
print "s: $s\nt: $t\n";
print "ok $s\n" if $t =~ m/\Q$s\E/;'

would print:

s: $a.*
t: abc456$a.*
ok

(remove the .* from $t, and will not print "ok")

so just use \Q and \E for saying
somthing is not a pattern, and use
the right quotes to avoid interpolating.

perldoc perlre

tina



-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Fri, 02 Jun 2000 14:34:26 GMT
From: scumjr@my-deja.com
Subject: Re: file dates being reported incorrectly.....
Message-Id: <8h8glh$ncq$1@nnrp1.deja.com>


> You should check the success of your call to stat() and print the
value
> of $! on failure as this will give you some indication of what is
going
> on - I am fairly certain that it is the stat that is failing rather
than
> the date simply being wrong.  Can you perform other operations on
these
> files ?
>

It is stat that is failing.  It cannot read the file/directories, it
gives me the error "No such file or directory".  I thought I could
perform other operations on the files, but it turns out that I can't.
I guess Perl just doesn't care for these special characters.

Thanks,

SJ


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


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

Date: Fri, 02 Jun 2000 13:43:00 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Globbing with ActivePerl
Message-Id: <MPG.13a25706ce823dc0989704@news>

Bernard Delmée writes ..
>I noticed a while ago that wildcard expansion on the command
>line seems to have changed with AP. Let's take a simple example:
>
>C:\>    perl -e "print @ARGV;" *.*
>
>On Win32, I know this works at least with perl4 and perl5.003
>(build 315). It doesn't anymore as of build 520+, nor does 5.6.
>
>Does someone know the trick?

  perl -e "print qq/$_\n/ while <*>;"

note that *.* is dropped in 5.6 in favour of * because in 5.6 the 
globbing is no longer passed to the shell - but is done internally by 
File::Glob (a POSIX glob())

but I have to add that

  dir /b

is pretty damn tempting too

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Fri, 02 Jun 2000 14:41:22 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: How to find out height and width of a PNG graphic
Message-Id: <MPG.13a264ac4eed607e989705@news>

Mösl Roland writes ..
>I am far far away from being perfect in Perl,
>but I am using Perl as my standard programing
>language now.
>
>I extracted from other scripts how to find out
>height and width of a GIF or a JPG graphic,
>but I did not find it until now for a PNG.
>
>But I want to change all my sites to PNG
>because of this idiotic patent threat with GIF

I'm not quite sure what your question is .. but the answer is 
undoubtedly

  >ppm install Image-Size

and then

  sub get_graphic_size
  {
    my($filename) = @_;

    use Image::Size;

    return 1, Image::Size::imgsize($filename);
  }

it does

  GIF, JPG, XBM, XPM, PPM family (PPM/PGM/PBM), PNG, TIF and BMP

and will tell you what it's done if you want to capture the third 
element of the output from imgsize()

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Fri, 02 Jun 2000 16:22:11 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: my Foo $self = shift;
Message-Id: <3bdfjsgvbhvaien31r6t2b7k9u8g94vmp4@4ax.com>

On 02 Jun 2000 14:22:00 +0200, kaih=7f50wpZmw-B@khms.westfalen.de (Kai
Henningsen) wrote:

> kaih@khms.westfalen.de (Kai Henningsen)  wrote on 02.06.00 in <7f4wXLC1w-B@khms.westfalen.de>:
> 
> > Sure looks to me like someone invented a new feature and neglected to
> > write the documentation for it.
> 
> Someone directed me to an older thread on this, and I see people getting  
> directed to all manner of places that don't document this (duh!).
> 
> But the high point surely is Randal claiming man fields documents it.  
> (Nope, it doesn't.)
Yep, it does, and Sam Holden already quoted it.

DESCRIPTION
    The `fields' pragma enables compile-time verified class fields.
 .... (see Sam's post)

To set this up:
- your class-package must use the fields pragma to 'declare' class
fields
	package Foo;
	use fields qw(foo bar);

- every instance of the class should be a typed lexical:
	my Foo $obj = Foo->constructor();
or indeed
	my Foo $self = shift;

- now class fields for instances of Foo will be verified at compile-time

	$obj->{foo} = 42; #ok
	$obj->{baz} = 42; #compile-time error

> What *is* it with this collective blindness?
I don't understand, are there more people with you looking at the fields
manpage?


-- 
Good luck,
Abe


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

Date: 02 Jun 2000 15:31:00 +0200
From: kaih=7f57vov1w-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: my Foo $self = shift;
Message-Id: <7f57vov1w-B@khms.westfalen.de>

kaih@khms.westfalen.de (Kai Henningsen)  wrote on 02.06.00 in <7f50wpZmw-B@khms.westfalen.de>:

> But the high point surely is Randal claiming man fields documents it.
> (Nope, it doesn't.) Followed by Jonathan claiming it's really discussed in
> attributes. (It's not even mentioned there, except in the context of
> (duh!) attributes - which are notably absent here.)

But see here:


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]


Re: typed vars (via my Foo $bar)



      From: Jeff Pinyan <jeffp@crusoe.net>
      Reply-To: japhy@pobox.com
      To: japhy@pobox.com
      cc: perl5-porters@perl.org
      Date: Sun, 7 May 2000 12:17:57 -0400 (EDT)
      Message-ID: <Pine.GSO.4.21.0005071216330.26700-200000@crusoe.crusoe.net>



On May 6, Jeff Pinyan said:

>Is ``Some::Package $var'' an EXPR?  Or is it a special case for my() in
>which the lexical is typed?  Should a patch be made?

Well, given the current focus on Damian's module (which I like, partly
because I was thinking of the same thing) and moderation discussion, I'll
just silently toss this patch up here, in case anyone wants to apply it.

-- 
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/

--- perlfunc.pod.old    Sun May  7 12:13:22 2000
+++ perlfunc.pod        Sun May  7 12:16:04 2000
@@ -2519,12 +2519,19 @@

 =item my EXPR

+=item my CLASS EXPR
+
 =item my EXPR : ATTRIBUTES

+=item my CLASS EXPR : ATTRIBUTES
+
 A C<my> declares the listed variables to be local (lexically) to the
-enclosing block, file, or C<eval>.  If
-more than one value is listed, the list must be placed in parentheses.  See
-L<perlsub/"Private Variables via my()"> for details.
+enclosing block, file, or C<eval>.  If more than one value is listed, the
+list must be placed in parentheses.  See L<perlsub/"Private Variables via
+my()"> for details.
+
+You can also specify a class name before the variable (or list of variables)
+which makes typed variables (see L<fields>).

 =item next LABEL




References to:
      Jeff Pinyan <jeffp@crusoe.net>


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Though that (plus fields) still doesn't really explain it, at least it  
mentiones it in the right place.

Kai
-- 
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
  - Russ Allbery (rra@stanford.edu)


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

Date: Fri, 02 Jun 2000 13:15:08 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: mysql insertid
Message-Id: <MPG.13a25083bef92df8989702@news>

kenny@barmeister.com writes ..
>I am trying to get the insertid of the last insert I did in a MySQL
>table.  The column is auto incremented and the primary key.  I have used
>both:
>
>my $new_id = $dbh->{'mysql_insertid'};
>my $new_id = $sth->{insertid};
>
>However I am not getting any results with these.  Has anyone else run
>into this??  I would appreciate any help anyone could give me on this.

I don't know anything about these special hash elements that you seem to 
be referencing above .. and I don't know where you got them from or if 
you just made them up

_I_ get the value that you're seeking from a MySQL function with

  'SELECT LAST_INSERT_ID()'

in Perl .. this becomes something like

  $id = $dbh->selectrow_array( q/SELECT LAST_INSERT_ID()/);

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Fri, 02 Jun 2000 06:29:41 -0700
From: randythefirst <randythefirstNOraSPAM@hotmail.com.invalid>
Subject: Perl and notepad aren't playing nice.
Message-Id: <0fca2aaa.5f4a6e1f@usw-ex0102-016.remarq.com>

I did subsearch "notepad", read many excellent messages, which
is why I am not asking about "What is a good editor?"(horse has
already been beat to death). But did not get answer to this
question. Help!!!
Taking Perl class, teacher has instructed us to use notepad to
create our program files. How do you save a notepad file with
just a .plx extension without notepad adding the .txt extension
also.
When I try to save as "hello.plx", it saves as "hello.plx.txt",
Perl will run it anyway if you type the whole thing out, but
what a pain.
Thank you in advance
Randy


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Fri, 02 Jun 2000 13:55:27 GMT
From: "Bill" <bill@billcampbell.com>
Subject: Re: Perl and notepad aren't playing nice.
Message-Id: <j1PZ4.141435$55.2971129@news2.rdc1.on.home.com>

> How do you save a notepad file with just a
> .plx extension without notepad adding the .txt extension also


File - Save As

then change the "Save as Type" to "All files"




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

Date: Fri, 02 Jun 2000 14:09:07 GMT
From: rara.rasputin@nospam.virgin.net (Rasputin)
Subject: Re: Perl and notepad aren't playing nice.
Message-Id: <slrn8jffti.9ld.rara.rasputin@cartman.private.ntl.com>

randythefirstNOraSPAM@hotmail.com.invalid <randythefirst> wrote:

>When I try to save as "hello.plx", it saves as "hello.plx.txt",
>Perl will run it anyway if you type the whole thing out, but
>

save as "foo.pl", not foo.pl 
-- 

Rasputin.
Jack of All Trades - Master of Nuns.


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

Date: Fri, 02 Jun 2000 07:32:29 -0700
From: randythefirst <randythefirstNOraSPAM@hotmail.com.invalid>
Subject: Re: Perl and notepad aren't playing nice.
Message-Id: <2cabf4cc.f6b30b5a@usw-ex0101-008.remarq.com>

Bill

That didn't work. I am using Win98, Office 2000. Could it have
any thing to do with Office 2000??? I am asking because notepad
seems to be an acceptable editor.
I can, and have programmed in C++. I say this only to dispel the
suspicion, "Maybe this clown doesn't know all the options in
the "Save As" dialog box. :-)
If you have any other suggestions let me know.
I Thank You for your response.

Randy

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Fri, 02 Jun 2000 07:53:22 -0700
From: randythefirst <randythefirstNOraSPAM@hotmail.com.invalid>
Subject: Re: Perl and notepad aren't playing nice.
Message-Id: <0122a67b.fc2555bb@usw-ex0101-008.remarq.com>

It's me again, one last time.

Randy,

To save a file with the extension you want in Notepad, put
quotes around the entire file name in the dialog box. For
example, enter the following in the File Name box in the
save/save as dialog box (quotes and all):

"hello.plx"

This will make it save the name as you like it.

I tested this and as usual the individual who originated the
post was right.

TTFN
Randy





* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 2 Jun 2000 14:43:40 GMT
From: dwinsor@Eng.Sun.COM (Daniel Winsor - HESE)
Subject: Re: Perl and notepad aren't playing nice.
Message-Id: <8h8h6s$6rn$1@eastnews1.east.sun.com>

In article f6b30b5a@usw-ex0101-008.remarq.com, randythefirst <randythefirstNOraSPAM@hotmail.com.invalid> writes:
>I can, and have programmed in C++. 

If you've used C++ and have access to MFC, make an MFC app.  The demo app
is a text editor (basically notepad).  You can change the forced file extension
to .pl or .html or whatever you like.

---
Dan Winsor



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

Date: Fri, 02 Jun 2000 13:03:00 GMT
From: sendrate@my-deja.com
Subject: Re: perl-5.6.0 and UTF8 character weirdness
Message-Id: <8h8b9r$j85$1@nnrp1.deja.com>

# Unicode value of first letter returns 196, should be 265!
# Am I doing something stupid?
# Any way around the problem?

require 5.6.0;
use utf8;

$i = "\x{109}efa";
@literoj = split //, $i;
foreach $litero (@literoj)
{
	print "UTF8 estas: $litero , Unikodo estas: ".ord($litero)."\n";
}

# Thanks.


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


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

Date: Fri, 02 Jun 2000 13:30:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: perl-5.6.0 and UTF8 character weirdness
Message-Id: <3937b5fc.252105@news.skynet.be>

sendrate@my-deja.com wrote:

># Unicode value of first letter returns 196, should be 265!
># Am I doing something stupid?
># Any way around the problem?
>
>require 5.6.0;
>use utf8;
>
>$i = "\x{109}efa";
>@literoj = split //, $i;
>foreach $litero (@literoj)
>{
>	print "UTF8 estas: $litero , Unikodo estas: ".ord($litero)."\n";
>}

You're not testing the Unicode value for the first character. You're
testing the first byte. That UTF-8 character consists of two bytes, the
first byte being chr(196).

I sincerely have the feeling that UTF-8 support in Perl 5.6.0 is still
in it's very infancy. It may even be evolving in a wrong direction.

Should Perl convert every single string to UTF-8? I think not. Most
definitely not on a non-ISO-Latin-1 platform! The pregrammer should
ALWAYS remain in control! So, no implicit conversions to/from Unicode,
please.

-- 
	Bart.


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

Date: 2 Jun 2000 14:38:22 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: perl-5.6.0 and UTF8 character weirdness
Message-Id: <8h8gsu$1e9$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Bart Lateur
<bart.lateur@skynet.be>],
who wrote in article <3937b5fc.252105@news.skynet.be>:
> Should Perl convert every single string to UTF-8? I think not. Most
> definitely not on a non-ISO-Latin-1 platform! The pregrammer should
> ALWAYS remain in control! So, no implicit conversions to/from Unicode,
> please.

I can assign no meaning to what you wrote.  I think you are confusing
utf8 with Unicode.  These two topics are absolutely perpendicular.

utf8 is just an *internal* way to work with "wide" chars.  It is going
to be transparent, there is going to be no supported way to detect the
internal storage of strings.  Say, C<use utf8> is going to be a NOOP,
and C<use byte> is going to be unsupported (but probably working...).

Strings are just sequences of small integers, for some value of
"small".  Period.

Unicode, in turn, is the way to assign cultural info to an integer,
the cultural info used in, say, uc(), /\d/ etc.  Perl supports using
other "cultural" assignments, but what it ships with is Unicode.
There was a way to switch cultural info by C<use locale>, but it is
going to be deprecated, probably substituted by i/o conversion (see below).

So if you are on "a non-ISO-Latin-1 platform!" you *want* your data to
be converted to "high chars".  This conversion is going to be more or
less transparent and done during input/output (for wide sense of
input/output, say, for open() etc. too).

Ilya


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

Date: Fri, 2 Jun 2000 10:41:49 -0400
From: "Paul \"Bo\" Peaslee" <bopeaslee@rcn.org>
Subject: Printing on a Remote Printer
Message-Id: <8h8h0u$a5i$1@bob.news.rcn.net>

I ran into an interesting problem while writing a simple script to print
formatted Perl scripts on a remote jet-direct printer from my NT4
Workstation. In the attached script, I attempt to open a remote printer as a
file.  It fails to open the printer.  A co-worker swears that he's done this
before.  We do know that it works on a shared, local printer.  Trying it in
binary mode failed, too.  Does anyone
have a clue as to what the problem might be?

{
  use strict;

  my $PrinterName            = "\\\\server\\printer";
  my $PrintFileName          = "prttst.txt";

# Open a connection to the printer as a file.
  open (PRINTER, "> $PrinterName")
    || die "Can't open printer - $PrinterName!: $!\n";

# Stream the print control commands to the printer.
  print PRINTER "Start of Job....\n";

# Stream the contents of each file to the printer.
  @ARGV = ($PrintFileName);
  while (<>)
    {
    print PRINTER $_;
    }

# Stream the printer reset controls to the printer.
  print PRINTER ".....End of Job\n";

# Close the connection to the printer.
  close PRINTER;

  exit;

}

TIA
Bo

Paul "Bo" Peaslee
"Ne illegitimi carbunculi tibi in facie sint"

--
Paul "Bo" Peaslee
"Ne illegitimi carbunculi tibi in facie sint"






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

Date: 2 Jun 2000 14:24:01 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: problem with perl garbage collecting
Message-Id: <8h8g21$15q$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<poppln@my-deja.com>],
who wrote in article <8h856d$evn$1@nnrp1.deja.com>:
> > Even if the debugger is run non-interactively in non-stop mode?
> 
> How do you run the debugger non-interactively?

  perldoc perldebug

> > If yes, try to fiddle with bits of $^P until you can reproduce the
> > change without -d.  Keep in mind that with a Perl so old directly
> > fiddling with a couple of bits of $^P would lead to a segfault.  [But
> > you will find them soon enough. ;-]
> 
> perl-5.00502 is old?

Close to unusable...

> What is the must updated version? ( before 5.6 - I need a perl that
> WORKS! )

I think there were several developer releases which could be better
than 5.6.0.  And no, you do not need the version which "WORKS" if what
you need is debugging strange problems.

Ilya


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

Date: Fri, 02 Jun 2000 14:07:40 GMT
From: newbie@db-networks.com
Subject: Speed
Message-Id: <4mffjs4037altoas3hr36m048g3utemt0d@4ax.com>

I have a real fast computer and it takes 2.5hrs to process a file with
7 million lines.

How can I speed it up? Help will be appreciated.

while(<INFILE>) {
    chomp;
    undef @data;
    push(@data, defined($1) ? $1:$3)
        while m/([^,]+)/g;
    $asked = substr($data[0],5,6);
    $original = $data[1];
    $string1 = uc($data[1]);
    $string1 =~ s/\%([1-F][A-F])+/ /g;
    $string1 =~ s/_/ /g;
    $string1 =~ s/\W/ /g;
    $string1 =~ s/\s+/ /g;
    $string1 =~ s/^\s+//;
    $string1 =~ s/\s+$//;

    undef %seen;
    @tosave = ();
    @words = ();
    @words = split(/ /, uc($string1));

    foreach $item (@noisewords) {
        $seen{$item} = 1
    }

    foreach $item (@words) {
        unless (($seen{$item}) or ($item =~ m/\d/) or length($item) <
3){
            push(@tosave, $item)
        }
    }
    $toprint = join(" ",@tosave);
    if (length($toprint) > 2){
       $firstchar = substr($toprint,0,1);
       if ($firstchar lt 'D') {
           print OUTFILE1 $toprint, "," , $original, "," ,$asked ,
"\n";
       } elsif ($firstchar lt 'G') {
           print OUTFILE2 $toprint, "," , $original, "," ,$asked ,
"\n";
       } elsif ($firstchar lt 'K') {
           print OUTFILE3 $toprint, "," , $original, "," ,$asked ,
"\n";
       } elsif ($firstchar lt 'Q') {
           print OUTFILE4 $toprint, "," , $original, "," ,$asked ,
"\n";
       } elsif ($firstchar lt 'T') {
           print OUTFILE5 $toprint, "," , $original, "," ,$asked ,
"\n";
       } else {
           print OUTFILE6 $toprint, "," , $original, "," ,$asked ,
"\n";
       }
    }
}

Thanks


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

Date: Fri, 02 Jun 2000 14:40:20 GMT
From: methos <methos495@earthlink.net>
Subject: TCP IPC and Perl
Message-Id: <3937C82C.79C39668@earthlink.net>

Hi there,
I've been playing around with Perl InterProcess Communications using TCP

basically I'm trying to get a file listing on one machine from another.

I'd like to be able to have the client program send the server program a

command, which the server interprets and carries out it's own thang so
that it sends back info to the client.

for some reason, however,
the server doesn't seem to read messages from the client.

I've been using an example program in "Programming Perl" by Randall
Schwartz
as a starting point:

here're some code snippets from both programs concerning this reading
and writing.
If someone could point me in the right direction, I would most
appreciate it.

server.pl
-----------------------------------------
bind(Server, sockaddr_in($port, INADDR_ANY)) or die "bind: $!";
listen (Server, SOMAXCONN) or die "listen: $!";

logmsg("server started on $port");

my $paddr;
$SIG{CHLD} = \&REAPER;

for ( ; $paddr = accept(Client, Server); close Client) {
  $paddr = accept(Client, Server);
  my ($port, $iaddr) = sockaddr_in($paddr);
  my $name = gethostbyaddr($iaddr, AF_INET);
  logmsg ("connection from $name [", inet_ntoa($iaddr), "] at port
$port");
  print Client "Hello there, $name, it's now ", scalar localtime, "\n";

  my $lngth = 256;
  my $msg;

  read (Client, $msg, $lngth);
  if (length($msg) > 0) {
    print "$0 $$: $msg\n";
  }
}

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

client.pl
-----------------------------------------
socket(SOCK, PF_INET, SOCK_STREAM, $proto);

# now connect to the server
connect(SOCK, $paddr);

# create a BudcoServer object
#my $bcs = new BudcoServer;

while ($line = <SOCK>) {
  print "$line\n";
}

print SOCK "ls /usr2/prod/web/data";
while ($line = <SOCK>) {
  print "$line\n";
}
close (SOCK) or die "could not close: $!";
exit;
-----------------------------------------

--
- Methos -
"Sometimes it's a runny nose, sometimes itsnot"
      - anonymous -




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

Date: Fri, 02 Jun 2000 13:55:36 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: the end of perl?
Message-Id: <s1PZ4.1788$6T1.374894@news.dircon.co.uk>

On Thu, 01 Jun 2000 15:53:53 -0500, Flounder Wrote:
> What the hell!  I know this is not true I have not seen anything about
> it here or at www.perl.com or anywhere.  But I have seen other places
> people saying Larry declared that they are stopping all development on
> perl.  Is it true because i do not belive it.  I saw some posts on
> comp.lang.ruby and at this url:
> 
> http://www.segfault.org/story.phtml?mode=2&id=3905b40e-05c0a760
> 
> This has to be total bull@%*&
> 

Well, that fact that segfault describes it as 'Fake News' might be some
clue .

/J\


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

Date: Fri, 02 Jun 2000 14:06:33 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: the end of perl?
Message-Id: <JbPZ4.1789$6T1.374894@news.dircon.co.uk>

On Thu, 01 Jun 2000 15:53:53 -0500, Flounder Wrote:
>                                                I saw some posts on
> comp.lang.ruby                 
> 

Yeah, they would say that wouldnt they.


Anyhow <http://www.userfriendly.org/cartoons/archives/99oct/19991007.html>

/J\


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

Date: Fri, 02 Jun 2000 06:48:04 -0700
From: Tony Lanier <tlanierNOtlSPAM@atmel.com.invalid>
Subject: Re: Trouble with Arrays of Hashes
Message-Id: <0ab04d7c.b5d5cfbd@usw-ex0101-007.remarq.com>

Hi everyone,

Well, the problem, as Sam pointed out, was the %library being
called as a global variable. I put  my %library  in the for loop
and now everything works!

However, I'm still puzzled. I can get this same problem to work
using an Array of Arrays, which looks like this:

elsif (/Library:/)
{
    #my %library;
    #$library{$line[1]} = $line[2];
    #push @AoH, {%library};

    @lib = ($line[1], $line[2]);
    push @AoA, [@lib];
}

Notice I don't declare @lib a local variable.

I print the results like this:

for $i (0 .. $#AoA)
{
    $aref = $AoA[$i];	# create reference to @AoA
    $sim_libraries .= "-y $cbic_kit\/$aref->[0]\/$aref->[1] ";
}

This is almost exactly the same thing I did with the AoH, but I
don't get the extra stuff at the end. Can someone fill me in as
to why the AoA works, but the AoH did not?

Tony

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: Fri, 02 Jun 2000 07:50:40 -0500
From: "Paul R. Andersen" <andersen+@rchland.ibm.com>
Subject: Re: University graduate seeking for IT positions
Message-Id: <3937AD9F.49CA519D@rchland.ibm.com>

NgKH wrote:
> 
> To whom that would be interested:
> 
>         Thank you for your time for reading this message.  I am 4th year
> 
> a student in University of Toronto studying in  Acturial Science /
> Statistics /
> Computer Science, and currently in the last term of my study.  I am only
> 
> studying two courses this term, and I will be graduating after the
> summer term.  I am currently looking for challenging IT position that
> enables me further enhance and increase my knowledge of information
> technology, right now I am looking for full time position since my
> courses are only scheduled at night time.
> 
> If you can help me with a job please reply to my email address at
> ngkh@home.com
> 
> sorry for if it has cost you any trouble or taken you any valuable to
> reading this message.  Thanks!
> enclosed is a text version of my resume
> 
> yours truly
> Edgar Ng

Alright, I'm gonna be a bit harsh here but with the intent of helping
you.

It is clear that English is not your first language.  If finding a good
job is really important to you, you should seek out some help with
writing your resume.  I cannot imagine that anyone is going to give
serious consideration to hiring someone when it appears that they cannot
communicate clearly and don't seem to care enough to put in the effort.

AND.... comp.lang.perl.misc (at least) is not the appropriate place to
be posting this sort of stuff anyway.

-- 
Paul Andersen
-- I can please only ONE person per day.
-- Today is NOT your day.
-- Tomorrow isn't looking good either.


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

Date: Fri, 2 Jun 2000 08:10:45 -0500
From: "Tom Pepper" <tomp@sharpcom.com>
Subject: Re: University graduate seeking for IT positions
Message-Id: <e0$MjPJz$GA.169@cppssbbsa05>

And neither is the Front Page newsgroup.

--

Tom Pepper
Grumpy Old Geezer


Paul R. Andersen wrote in message <3937AD9F.49CA519D@rchland.ibm.com>...
>NgKH wrote:
>>
>> To whom that would be interested:
>>
>>         Thank you for your time for reading this message.  I am 4th year
>>
>> a student in University of Toronto studying in  Acturial Science /
>> Statistics /
>> Computer Science, and currently in the last term of my study.  I am only
>>
>> studying two courses this term, and I will be graduating after the
>> summer term.  I am currently looking for challenging IT position that
>> enables me further enhance and increase my knowledge of information
>> technology, right now I am looking for full time position since my
>> courses are only scheduled at night time.
>>
>> If you can help me with a job please reply to my email address at
>> ngkh@home.com
>>
>> sorry for if it has cost you any trouble or taken you any valuable to
>> reading this message.  Thanks!
>> enclosed is a text version of my resume
>>
>> yours truly
>> Edgar Ng
>
>Alright, I'm gonna be a bit harsh here but with the intent of helping
>you.
>
>It is clear that English is not your first language.  If finding a good
>job is really important to you, you should seek out some help with
>writing your resume.  I cannot imagine that anyone is going to give
>serious consideration to hiring someone when it appears that they cannot
>communicate clearly and don't seem to care enough to put in the effort.
>
>AND.... comp.lang.perl.misc (at least) is not the appropriate place to
>be posting this sort of stuff anyway.
>
>--
>Paul Andersen
>-- I can please only ONE person per day.
>-- Today is NOT your day.
>-- Tomorrow isn't looking good either.




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

Date: Fri, 2 Jun 2000 14:09:00 +0100
From: "A Pietro" <apietro@my-deja.com>
Subject: Re: Using awk in perl?
Message-Id: <8h8bls$98p$1@sshuraaa-i-1.production.compuserve.com>

Thanks for your reply. I'll check a2p out...

>You can use a2p to convert your awk stuff into slightly less than idiomatic
Perl.<

It wasn't what I was thinking of, exactly.
I was thinking of temporarily running awk from the shell -- might this be
faster than doing awk stuff in Perl?

AP




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

Date: Fri, 02 Jun 2000 13:16:59 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Web-based email solutions
Message-Id: <MPG.13a250eef35b18fc989703@news>

A Pietro writes ..
>Maybe we could do it using Perl?

answering your only Perl question -> "Yes, maybe you could."

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Fri, 2 Jun 2000 15:35:25 +0100
From: "A Pietro" <apietro@my-deja.com>
Subject: Re: Web-based email solutions
Message-Id: <8h8gns$krk$1@sshuraac-i-1.production.compuserve.com>

>answering your only Perl question -> "Yes, maybe you could." <

Whats this supposed to mean?

AP

















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

Date: Fri, 02 Jun 2000 10:51:12 -0400
From: Eli Mansour <elynt@exchange.ml.com>
To: jason <elephant@squirrelgroup.com>
Subject: Re: Win32::Eventlog
Message-Id: <3937C9E0.B051B077@exchange.ml.com>

Still can't get it straight. My syntax is like yours and here is the error
Message
Barewoord "EVENTLOG_ERROR_TYPE" not allowed while "strict subs"
in use

what in the world am I doing wrong ?

Eli

jason wrote:

> Eli Mansour writes ..
> >Can somebody give me an example of writing an error to
> >to NT eventlog.
> >
> >I can' seem to get the syntax straight.
>
> the following code will work with my EventLog.pm .. but from memory I
> had to change a couple of things in the Report method because they were
> set up more for reading from the event log rather than writing to it
> (from memory the Source element of the hash was incorrectly implemented)
>
> let me know how the following code goes because I'd be surprised if
> EventLog wasn't fixed up - the code below certainly works with (what I'm
> fairly sure is) a fresh installation of v5.6
>
> #!/usr/bin/perl -w
> use strict;
>
> use Win32::EventLog;
>
> my $ref = new Win32::EventLog( 'my app', 'fire');
>
> Win32::EventLog::Report( { Computer => $ENV{COMPUTERNAME}
>                , Source => 'my application'
>                , EventType => EVENTLOG_WARNING_TYPE
>                , EventCategory => 0
>                , EventID => 0
>                , Data => ''
>                , Strings => 'Something new here'
>                }
>              );
>
> __END__
>
> --
>  jason - elephant@squirrelgroup.com -



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

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


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