Re: converting MS access DB to mysql

2001-06-19 Thread Jon Farmer

> i have an Ms Access DB and need to use it on a linux web server !! 
> 
> does anyone know how i can go about converting it to Mysql or suchlike
> ?? as it is quite large. !!

Save the tables out from Access as CSV and import them into MySQL. If you 
want to use the Access frontend with MySQL get the ODBC driver and link the 
tables.

Regards


Jon Farmer
Entanet International Ltd www.enta.net
Tel 01952 428969
Mob 07050 603720
PGP Key Available




Getting Started

2001-06-19 Thread Charles Aye-Darko

Hi, Can anyone tell me how I can get started in programming with Perl. I am
new to computers and am using the windows millenium software on my pc.
Do I need to program in Dos to write and run code or something else? Please
help as I am desperate to get started.

Regards,

Charles




POSIX::termios

2001-06-19 Thread Nigel Wetters

I'm playing around with terminal programming on Linux, and wondered whether the 
POSIX::termios package was the correct method to make my code cross-platform 
compatible.

--nigel




This e-mail and any files transmitted with it are confidential 
and solely for the use of the intended recipient. 
ONdigital plc, 346 Queenstown Road, London SW8 4DG. Reg No: 3302715. 



Re: Quick Perl Question

2001-06-19 Thread Nigel Wetters

1.

$filename = 'foo.txt';
open(FH,"<$filename") or die "couldn't open $filename - $!";
while ($line = ){
print "$line matches\n" if ($line =~ /^USD /);
}

2.

while ($line=){
chomp $line;
next unless $line;
next if ($line =~ /^-+?$/);
next if ($line =~ /^=+?$/);
# only good lines get this far
}

>>> Jack Lauman <[EMAIL PROTECTED]> 06/19/01 05:05am >>>
1. I want to read in a text file and match any line that begins with
three capital letters followed by a space.  i.e. "USD "

How do you do that?

2. I need to ignore any blank lines, lines containing all "---", lines
containing all "===".

Again, how?

Thanks in advance,

Jack



This e-mail and any files transmitted with it are confidential 
and solely for the use of the intended recipient. 
ONdigital plc, 346 Queenstown Road, London SW8 4DG. Reg No: 3302715. 



Re: more class stuff

2001-06-19 Thread Jos Boumans

What probably is going wrong here, is that you're using 'strict' and not
declaring the @Next array

so what you'd need to do is say:

my @Next; on the op of your module

probably tho, you'll have that array filled with something if you're
adding it to your constructor, and
probably, you have a function filling it... if my assumption is true,
then you'd want something like this:

sub new {


my @Next = function();
my $self = {


@Next,
@_,
}

}

hope this helps,

Jos Boumans

PS, if you want to read more about namespaces etc, take a look at mjd's
tutorial about it here:
 http://perl.plover.com/FAQs/Namespaces.html


Nick Transier wrote:

> given this new function which acts as a constructor
>
> sub new {
>
> my $invocant = shift;
> my $class = ref($invocant) || $invocant;
> my $self = {
> Level => 999,
> Value => 999,
> Key => 999,
> @Next,
> @_,
> };
> return bless $self,$class;
>
> }
>
> I am getting the following error:
> "Global symbol @Next requires explicit package name at c:\"
>
> What does this mean?
>
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com




Re: $hash{$_}++

2001-06-19 Thread Martin van-Eerde

The value of the hash is being incremented.

This kind of thing happens either because the programmer wants to 
count the number of that particular key value in a loop, or  is only 
concerned with storing the key, but you cannot have a hash key 
without a value, so they are just using a number for the value.

> I am having trouble understanding just what the following does,
> and how to you use it:
> 
>  $hash{$_}++
> 
>  i.e. are we increment the value or the key?
> 
>  I would appreciate any guidance here! 
> 
>  Thanks,
> 
>  Dave G.
> 
> 
> 





Martin van-Eerde Dip. Comp. (Open)
Senior Analyst Programmer
==



Re: Sub Calls

2001-06-19 Thread Martin van-Eerde

You could also just have one method that is both a getter and setter

sub level {
my $self = shift;

if ( @_ ) { $self->{ Level } = shift;

return $self->{ Level };
}

What we are doing is checking if any other arguments are passed, 
apart from the reference to the object it's self, if there are we just 
grab the next one.

> On Mon, 18 Jun 2001, Nick Transier wrote:
> 
> > Assuming I am defining an object which has as its only property a
> > level associated with it, would these be the correct simple
> > subroutines to retrieve and set that property. Also, is this the
> > correct usage of the @_ array such that the level value would be 999
> > unless I called new(Level => something else)
> >
> >
> > sub new {
> >
> > my $invocant = shift;
> > my $class = ref($invocant) || $invocant;
> > my $self = {
> > Level => 999,
> > @_,
> > };
> > return bless $self,$class;
> >
> > }
> >
> > sub getlevel {
> > return $$self{Level};
> > }
> 
> You need to remember to grab the $self argument passed to each
> argument:
> 
> sub getlevel {
>  my $self = shift;
>  return $self->{Level};
> }
> 
> > sub setlevel {
> > $$self{Level} = shift(@_);
> > }
> 
> sub setlevel {
>  my $self = shift;
>  $self->{Level} = shift;
> }
> 
> -- Brett
> 
>http://www.chapelperilous.net/btfwk/
> --
> -- To err is human, but when the eraser wears out before the pencil,
> you're overdoing it a little.
> 
> 





Martin van-Eerde Dip. Comp. (Open)
Senior Analyst Programmer
==



comments and memory

2001-06-19 Thread Stephan Bulheller

Hello,

someone told me that comments are loaded in the memory while the script is 
running.

Is this true?

--Stephan



Re: Perl Security

2001-06-19 Thread Jos Boumans

depending on what you want, you could use rot13 (or twice ;-) or actually go about 
hard core and md5 them

you might want to take a look at the modules that come with the Digest bundle...
(search.cpan.org to look for them)

hope this helps,

Jos Boumans

jonathan wrote:

> Hi,
>
> I am insterested in creating a reusable module that allows my scripts to have 
>pretty good security. I just don't know how i would go about encrypting passwords. 
>Please help
>
> Thanks




Use of File::Copy

2001-06-19 Thread Fabien JACQUET

Hi all,

I'm trying to use copy($name,$folder.$name), but it doesn't work!
Yet, I've put  "use File::copy" in my program.
I tried with $name = "essai0.flr" and $folder="archive\\" on Win NT4

need some help...

--
Fabien Jacquet






RE: Use of File::Copy

2001-06-19 Thread John Edwards

Try

use File::Copy;

$name = "essai0.flr";
$folder="c:\\archive";

copy($name,"$folder\\$name");

Note that you define the full path to the folder.

John

-Original Message-
From: Fabien JACQUET [mailto:[EMAIL PROTECTED]]
Sent: 19 June 2001 10:05
To: [EMAIL PROTECTED]
Subject: Use of File::Copy


Hi all,

I'm trying to use copy($name,$folder.$name), but it doesn't work!
Yet, I've put  "use File::copy" in my program.
I tried with $name = "essai0.flr" and $folder="archive\\" on Win NT4

need some help...

--
Fabien Jacquet




--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.





Re: Use of File::Copy

2001-06-19 Thread Tony Cook

On Tue, 19 Jun 2001, Fabien JACQUET wrote:

> Hi all,
> 
> I'm trying to use copy($name,$folder.$name), but it doesn't work!
> Yet, I've put  "use File::copy" in my program.

Perl is case-sensitive.  You want:

  use File::Copy;

With:

  use File::copy;

under Win32, perl finds the file OK, but then tries to call the import()
function in the File::copy package, which doesn't exist.

Tony




STDERR Question

2001-06-19 Thread Conrad, Bill (ThomasTech)

Hi All

Does PERL write compile errors and warnings to STDERR and if so is
there any easy way to have them written to a file rather then to the
console?

Thanks

Bill Conrad



Re: STDERR Question

2001-06-19 Thread n6tadam

Hi,

I think this is possible

while (<>) {
open(STDERR > /file)
close(STDERR)

}

I think thats right (I'm rather new to perl).

HTH,

Thomas Adam
- Original Message - 
From: Conrad, Bill (ThomasTech) <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 19, 2001 12:41 PM
Subject: STDERR Question


> Hi All
> 
> Does PERL write compile errors and warnings to STDERR and if so is
> there any easy way to have them written to a file rather then to the
> console?
> 
> Thanks
> 
> Bill Conrad
> 
> 


Please note that the content of this message is confidential between the original 
sender and the intended recipient(s) of the message. If you are not an intended 
recipient and/or have received this message in error, kindly disregard the content of 
the message and return it to the original sender.

If you have any complaints about this message please reply to:
   [EMAIL PROTECTED]

The Purbeck School E-Mail server running:
   users.purbeck.dorset.sch.uk




Re: comments and memory

2001-06-19 Thread Karthik Krishnamurthy

from what little i know of parsers, most lexical analyzers (the part 
that recognizes tokens and such) are designed to ignore comments (just 
speculation). the whole file is read into the OS buffer cache, comments and 
all, when the perl interpreter/compiler starts to read the file. but that 
should be the case even when you are editing the file. so i wouldnt worry
unduly about comments having an effect on performance.
/kk

On Tue, Jun 19, 2001 at 11:27:56AM +0200, Stephan Bulheller wrote:
> Hello,
> 
> someone told me that comments are loaded in the memory while the script is 
> running.
> 
> Is this true?
> 
> --Stephan



RE: Getting Started

2001-06-19 Thread Gary L. Armstrong


It's not too late, we can save you, use UNIX... come to the Dark Side,
Luke...

I'm only sort of kidding but hey, I use a PC as well. Dang Microsoft. I
started trying to learn Java a few years ago having no prior coding
experience (except of course BASIC, but that was pretty unhelpful in
translation), and I found it pretty frustrating.  My only advice at this
point is that you should be persistent, and it really helps to have a
purpose behind learning it, otherwise like me you may be discouraged. I'm
still waiting for my perl books to arrive, but from what I've seen it's
pretty nifty.

For tactical tools, I use the ViM text editor (www.ViM.org) which definitely
can be intimidating to a DOS user, but since you seem intent on learning to
code from the ground up, you may as well learn some good habits now. If you
have a Linux machine you already have ViM (hopefully).

Good luck,
-=GLA=-

-Original Message-
From: Charles Aye-Darko [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 4:39 AM
To: [EMAIL PROTECTED]
Subject: Getting Started


Hi, Can anyone tell me how I can get started in programming with Perl. I am
new to computers and am using the windows millenium software on my pc.
Do I need to program in Dos to write and run code or something else? Please
help as I am desperate to get started.

Regards,

Charles





xml problem

2001-06-19 Thread Morgan

Hi

I'm newbee perl developer and a rookie of xml :(

Is there anyone who can give me some hints or help me out with a problem
I have?

Here is the problem.
I will recive newsarticles three times a day in xml format and I need to
automaticly publish those articels on a web page, on the first page it
should only show the tags down to 
tag and a link to the whole page.

Here is a sample of the xml format.


anbud
2001-06-14
14-06-01
DAGENS INDUSTRI
Dragkamp om förlusttåg
Here is the indroduction about the article and when the word
anbud comes up it is enclosed in anbud tags.
This is the word we use as criteria on the articels we should recive.


Here comes the rest of the document, thats the whole article.
The article ends with




Raven



Re: xml problem

2001-06-19 Thread Nigel Wetters

I think I can give you some clues. Here's some code out of the Perl Cookbook (6.8 
Extracting a Range of Lines), which I've adapted for you. You should be able to nest 
such structures to get what you want.

my $extracted_lines = '';
while (<>) {
if (/BEGIN PATTERN/ .. /END PATTERN/) {
# line falls between BEGIN and END in the
# text, inclusive
$extracted_lines .= $_;
} else {
# now, we're outside the pattern
process($extracted_lines) if $extracted_lines;
$extracted_lines = '';
}
}
sub process
{
# do stuff with the extracted lines
# maybe performing more regex's
}

>>> Morgan <[EMAIL PROTECTED]> 06/19/01 01:12pm >>>
Hi

I'm newbee perl developer and a rookie of xml :(

Is there anyone who can give me some hints or help me out with a problem
I have?

Here is the problem.
I will recive newsarticles three times a day in xml format and I need to
automaticly publish those articels on a web page, on the first page it
should only show the tags down to 
tag and a link to the whole page.

Here is a sample of the xml format.


anbud
2001-06-14
14-06-01
DAGENS INDUSTRI
Dragkamp om förlusttåg
Here is the indroduction about the article and when the word
anbud comes up it is enclosed in anbud tags.
This is the word we use as criteria on the articels we should recive.


Here comes the rest of the document, thats the whole article.
The article ends with




Raven



This e-mail and any files transmitted with it are confidential 
and solely for the use of the intended recipient. 
ONdigital plc, 346 Queenstown Road, London SW8 4DG. Reg No: 3302715. 



Learning Perl chpt.13 problem

2001-06-19 Thread patroclus_1

I don't understand the regex s#.*/##s

(given as part of the solution to problems 2 and 3)

more specifically, I don't know what the last 's' does
to the regex.

__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/



Re: Learning Perl chpt.13 problem

2001-06-19 Thread Brett W. McCoy

On Tue, 19 Jun 2001 [EMAIL PROTECTED] wrote:

> I don't understand the regex s#.*/##s
>
> (given as part of the solution to problems 2 and 3)
>
> more specifically, I don't know what the last 's' does
> to the regex.

It lets . match a newline (\n).  It also will make the match ignore $*
-- which you shouldn't be using anyway :-)

-- Brett
   http://www.chapelperilous.net/btfwk/

The best prophet of the future is the past.




Re: Learning Perl chpt.13 problem

2001-06-19 Thread n6tadam

Hi,

s/#.*/##

The above is used either to indicate a substitution of a string. The "s"
indicates substitute. The rule is, that whatever you specifiy after the "s",
is the regex that you are looking for (this in the above case "#.*"). This
is then separated by a "/". Anything after is the replace parameter, ended
by a "/".

There are other switches that can be placed after the last "/", usually:

g   (indicates a global search/replace)
d   (delete the line)

HTH,

Thomas Adam



Please note that the content of this message is confidential between the original 
sender and the intended recipient(s) of the message. If you are not an intended 
recipient and/or have received this message in error, kindly disregard the content of 
the message and return it to the original sender.

If you have any complaints about this message please reply to:
   [EMAIL PROTECTED]

The Purbeck School E-Mail server running:
   users.purbeck.dorset.sch.uk




Re: Learning Perl chpt.13 problem

2001-06-19 Thread Nigel Wetters

>From perldoc perlre:

   s   Treat string as single line.  That is, change "." to
   match any character whatsoever, even a newline, which
   normally it would not match.

>>> <[EMAIL PROTECTED]> 06/19/01 01:40pm >>>
I don't understand the regex s#.*/##s

(given as part of the solution to problems 2 and 3)

more specifically, I don't know what the last 's' does
to the regex.

__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/



This e-mail and any files transmitted with it are confidential 
and solely for the use of the intended recipient. 
ONdigital plc, 346 Queenstown Road, London SW8 4DG. Reg No: 3302715. 



beginners

2001-06-19 Thread Bobby Shea

unsubscribe



open() for IPC isn't dying ?

2001-06-19 Thread Evgeny Goldin (aka Genie)


  Hi,

I've just noticed that open() used for IPC isn't dying when forking an
illegal (non-existing) process :

>perl -w
my $command = "a 2>&1 |";
( my $pid   = open ( FOUT, $command )) or die "Failed to open [$command] : $! \a\n";
print "[$command][$pid]\n";

^Z
Name "main::FOUT" used only once: possible typo at - line 2.
[a 2>&1 |][1160]

>

As you see, it returns the legal PID as everything went Ok and not
dying ! ( of course, I have no program called "a" )

My perl is ActivePerl b626.

Any ideas ? Thank you !




Subject Prefix

2001-06-19 Thread Eduard Grinvald

Hello, this probably goes to the list admins ;)
Is it possible to insert some sort of subject heading, like [beginners-perl]
or something to make the email screening easier?

thank you

edward




Re: ICQ Trouble

2001-06-19 Thread Markus Peter

On Sun, 3 Jun 2001 [EMAIL PROTECTED] wrote:

> Hi  everyone,
> i'm having this problem and i would like help please:
> When i send an e-mail message using MIME::Lite to an ICQ number lets say mine 
>[EMAIL PROTECTED] i fill the sender with something the from with someone the 
>subject with something the type with Type=>"text",and Data=>"some text i  wanna 
>send", well the message arrives ok but completely blank !!! i am misssing something 
>really foolish but cannot figure out what is can anyone help me ( a brazilian) please?

It probably should work that way - maybe ICQ filters the text out due to
some other missing header? Did you try setting Type to a more exact
MIME type like e.g. text/plain; charset=iso-8859-1; yet?

Can you tell us the _exact_ code you use to send the message?

-- 
Markus Peter - SPiN AG
[EMAIL PROTECTED]





Re: Subject Prefix

2001-06-19 Thread Brett W. McCoy

On Tue, 19 Jun 2001, Eduard Grinvald wrote:

> Hello, this probably goes to the list admins ;)
> Is it possible to insert some sort of subject heading, like [beginners-perl]
> or something to make the email screening easier?

You can get the same effect by sorting on the From: field.

-- Brett
   http://www.chapelperilous.net/btfwk/

You lived with a man who wore white belts?  Laura, I'm disappointed in you.
-- Remington Steele




Re[2]: Getting Started

2001-06-19 Thread Tim Musson

Hey Gary,

Tuesday, June 19, 2001, 8:03:23 AM, you wrote:

GLA> It's not too late, we can save you, use UNIX... come to the Dark
GLA> Side, Luke...
Dark side? I thought that was M$ - you know BORG, Dark Side, etc 

GLA> I'm only sort of kidding but hey, I use a PC as well. Dang
GLA> Microsoft.
8<--snip
GLA> For tactical tools, I use the ViM text editor (www.ViM.org) which
GLA> definitely can be intimidating to a DOS user, but since you seem
GLA> intent on learning to code from the ground up, you may as well
GLA> learn some good habits now. If you have a Linux machine you
GLA> already have ViM (hopefully).
8<--snip
CAD> Hi, Can anyone tell me how I can get started in programming with
CAD> Perl. I am new to computers and am using the windows millenium
CAD> software on my pc. Do I need to program in Dos to write and run
CAD> code or something else? Please help as I am desperate to get
CAD> started.

I would suggest "Learning Perl on Win32 Systems" - "The Llama book"
(3rd edition is out soon). Check www.oreily.com

I agree on the unix OS, but it is not always possible.  I currently
only run M$ :-(.

ViM - I love it (and recommend it). Not sure you want to learn VI and
Perl at one go... A good windows based text editor that I use as much
as ViM is www.TextPad.com (and yes there are others).

-- 
[EMAIL PROTECTED]
Using The Bat! eMail v1.53bis
Windows NT 5.0.2195 (Service Pack 1)
The software said it required Windows 3.1 or better so I installed Linux.




Re: Subject Prefix

2001-06-19 Thread Brett W. McCoy

On Tue, 19 Jun 2001, Brett W. McCoy wrote:

> > Hello, this probably goes to the list admins ;)
> > Is it possible to insert some sort of subject heading, like [beginners-perl]
> > or something to make the email screening easier?
>
> You can get the same effect by sorting on the From: field.

Err, I mean To: field. :-)

-- Brett
   http://www.chapelperilous.net/btfwk/

QOTD:
"I thought I saw a unicorn on the way over, but it was just a
horse with one of the horns broken off."




Re[2]: open() for IPC isn't dying ?

2001-06-19 Thread Evgeny Goldin (aka Genie)


NW> The open function lets you write or read from another program, but not both.
NW> Use the standard IPC::Open2 or IPC::Open3 modules.

But I'm only reading from it.




Re: Use of File::Copy

2001-06-19 Thread Tim Musson

Hey Fabien,

Tuesday, June 19, 2001, 5:05:19 AM, you wrote:

FJ> I'm trying to use copy($name,$folder.$name), but it doesn't work!
FJ> Yet, I've put  "use File::copy" in my program.
FJ> I tried with $name = "essai0.flr" and $folder="archive\\" on Win NT4

>From this list I have found that a great thing to do when writing code
is start your code with:
#!perl -w
use strict;
use diagnostics;

All 3 things work together to give you output about your code -
especially if things are not correct (like "use File::copy;" instead of
"use File::Copy;")

Also, I have found that you can use / as a directory delimiter in your
Win32 Perl code.  It is easier than escaping the \ with \\.  Doesn't
affect the code as far as I can tell, but it is one less change you
would need to make to run on UNIX.

-- 
[EMAIL PROTECTED]
Using The Bat! eMail v1.53bis
Windows NT 5.0.2195 (Service Pack 1)
If you drink, don't park.  Accidents cause people.




Re: PERL DB Question

2001-06-19 Thread Vrunda Prabhu



On Tue, 19 Jun 2001 [EMAIL PROTECTED] wrote:

> > 1) unless you have previously populated the db file, it will start off
> > as
> > empty.
> >
> > I guess, this is my most basic and pressing question.  A file by the name
> > mockalias exists which already has the usernames and e-mail addresses
> > separated by :
> > When I use the tie command, am I not pulling up all the existing information
> > in that file, into a hash?
> >
> 
>   ... so you mean this mockalias is actually a text file contain records one
> entry per line with the symbol ":" as the delimitor?


Yes, it is. DB_file is not the best option, is it, in such a case?


> 
> Tor.
> 
> 




RE: Subject Prefix

2001-06-19 Thread Brett W. McCoy

On Tue, 19 Jun 2001, Pieter Heydenrych wrote:

> Actually the CC: field, which you can't create a rule for in Exchange AFAIK.

Argh... let's not start another thread about mailers!

-- Brett
   http://www.chapelperilous.net/btfwk/

Those who have some means think that the most important thing in the
world is love.  The poor know that it is money.
-- Gerald Brenan




Re: xml problem

2001-06-19 Thread Markus Peter

On Tue, 19 Jun 2001, Morgan wrote:

> Here is the problem.
> I will recive newsarticles three times a day in xml format and I need to
> automaticly publish those articels on a web page, on the first page it
> should only show the tags down to 
> tag and a link to the whole page.

Well - as mentioned before, you can either try to create a dumb parser
using regexpes, or you use a proper XML Parser (recommended).

You could e.g. try the module XML::Simple - this will parse your XML Text
and convert it into a perl hash:

use XML::Simple;

my $parser= new XML::Simple();

my $hash= $parser->XMLin($text);

and then you will have something similar to the following in your hash:

{
   'ord' => 'anbud',
   'lev' => '2001-06-14',
   'dat' => '14-06-01',
   ...
}

Please note that XML::Simple is a bit picky about XML syntax, so your
input file should rather be valid XML, and not just text with some tags
somewhere.

-- 
Markus Peter - SPiN AG
[EMAIL PROTECTED]




RE: Outlook Rules (was Subject Prefix)

2001-06-19 Thread John Edwards

You can set a rule in Outlook to look for [EMAIL PROTECTED] in the message
header, then move the message to a new folder.

You don't have to worry about the address being in the To: or CC: field.
Outlook will scan the whole header.

John

-Original Message-
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: 19 June 2001 14:31
To: [EMAIL PROTECTED]
Subject: RE: Subject Prefix


On Tue, 19 Jun 2001, Pieter Heydenrych wrote:

> Actually the CC: field, which you can't create a rule for in Exchange
AFAIK.

Argh... let's not start another thread about mailers!

-- Brett
   http://www.chapelperilous.net/btfwk/

Those who have some means think that the most important thing in the
world is love.  The poor know that it is money.
-- Gerald Brenan


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.





RE: Subject Prefix

2001-06-19 Thread mark crowe (JIC)

Not necessarily true, at least in my case. For example, Eduard's initial
mail came through as 
From: Eduard Grinvald To: beginners 
while Brett's reply was 
From: Brett W. McCoy To: Eduard Grinvald cc: beginners

Cheers

Mark C

On Tue, 19 Jun 2001, Eduard Grinvald wrote:

> Hello, this probably goes to the list admins ;)
> Is it possible to insert some sort of subject heading, like
[beginners-perl]
> or something to make the email screening easier?

You can get the same effect by sorting on the From: field.

Err, I mean To: field. :-)

-- Brett



Re: Re[2]: open() for IPC isn't dying ?

2001-06-19 Thread Nigel Wetters

Sorry, got the wrong end of the stick for a moment. Here's your problem (rom perldoc 
perlipc):

If you're writing to a pipe, you should also trap
   SIGPIPE.  Otherwise, think of what happens when you start
   up a pipe to a command that doesn't exist: the open() will
   in all likelihood succeed (it only reflects the fork()'s
   success), but then your output will fail--spectacularly.
   Perl can't know whether the command worked because your
   command is actually running in a separate process whose
   exec() might have failed.  Therefore, while readers of
   bogus commands return just a quick end of file, writers to
   bogus command will trigger a signal they'd better be
   prepared to handle.

>>> [EMAIL PROTECTED] 06/19/01 03:26pm >>>

NW> The open function lets you write or read from another program, but not both.
NW> Use the standard IPC::Open2 or IPC::Open3 modules.

But I'm only reading from it.




This e-mail and any files transmitted with it are confidential 
and solely for the use of the intended recipient. 
ONdigital plc, 346 Queenstown Road, London SW8 4DG. Reg No: 3302715. 



Reading to a hash

2001-06-19 Thread mark crowe (JIC)

I wonder if anyone can help me with a question based more on curosity than a
desperate need to know. Say I have a data file with one key/value pair on
each line, which I want to read into a hash. I've been doing it in one of
two ways:

  while (<>) {
($key, $value) = split;
$hash{$key} = $value;
  }

or 

  push @array, split while <>;
  %hash = @array;

What I'm wondering is if there is anything like:
  push %hash, split while <>; # which doesn't work, or
  %hash = split while <>; # but that overwrites all but the last pair.

Thanks

Mark C
-- 

Dr Mark Crowe   John Innes Centre
Norwich Research Park
Tel/Fax: +44 (1603) 450012  Colney  
mailto:[EMAIL PROTECTED]   Norwich
NR4 7UH




RE: Re[2]: Getting Started

2001-06-19 Thread JHuddle

I found the Learning Perl on Win32 to be a difficult book to start with.  I
had no prior programming experience and found that the book assumes lots of
prior knowledge.  Although in typical O'Reilly fashion the book is well
written and edited, it is just not written for the non-programmer types.
All is not lost.

Two free sources I have found to be very helpful and free.  Great news for
someone trying to get their feet wet.  

First Robert's PERL tutorial for Win32 novices.
http://www.netcat.co.uk/rob/perl/win32perltut.html

Second from www.Perl.com .
http://www.perl.com/pub/2000/10/begperl1.html

These two sources plus a download from ActiveState and you are on your way
learning Perl on Win32 for free.  If you like perl and programming after
that there are plenty of good resource to pay for.  

-Original Message-
From: Tim Musson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 9:20 AM
To: [EMAIL PROTECTED]
Subject: Re[2]: Getting Started


Hey Gary,

Tuesday, June 19, 2001, 8:03:23 AM, you wrote:

GLA> It's not too late, we can save you, use UNIX... come to the Dark
GLA> Side, Luke...
Dark side? I thought that was M$ - you know BORG, Dark Side, etc 

GLA> I'm only sort of kidding but hey, I use a PC as well. Dang
GLA> Microsoft.
8<--snip
GLA> For tactical tools, I use the ViM text editor (www.ViM.org) which
GLA> definitely can be intimidating to a DOS user, but since you seem
GLA> intent on learning to code from the ground up, you may as well
GLA> learn some good habits now. If you have a Linux machine you
GLA> already have ViM (hopefully).
8<--snip
CAD> Hi, Can anyone tell me how I can get started in programming with
CAD> Perl. I am new to computers and am using the windows millenium
CAD> software on my pc. Do I need to program in Dos to write and run
CAD> code or something else? Please help as I am desperate to get
CAD> started.

I would suggest "Learning Perl on Win32 Systems" - "The Llama book"
(3rd edition is out soon). Check www.oreily.com

I agree on the unix OS, but it is not always possible.  I currently
only run M$ :-(.

ViM - I love it (and recommend it). Not sure you want to learn VI and
Perl at one go... A good windows based text editor that I use as much
as ViM is www.TextPad.com (and yes there are others).

-- 
[EMAIL PROTECTED]
Using The Bat! eMail v1.53bis
Windows NT 5.0.2195 (Service Pack 1)
The software said it required Windows 3.1 or better so I installed Linux.




pass CGI variables to an HTML form via URL

2001-06-19 Thread Chris Rutledge

Does anyone know how to or know of a site with information on passing CGI
variables to an HTML form via URL.
I can get CGI to pass the variable (ie http:/test.com/test.html?user=test )
but i can't get the receiving html page 
to input it into the form. This is a hidden data feild within the form.


Thanks in advance,
Chris



Re: PERL DB Question

2001-06-19 Thread victor

> > > 1) unless you have previously populated the db file, it will start off
> > > as
> > > empty.
> > >
> > > I guess, this is my most basic and pressing question.  A file by the name
> > > mockalias exists which already has the usernames and e-mail addresses
> > > separated by :
> > > When I use the tie command, am I not pulling up all the existing information
> > > in that file, into a hash?
> > >
> >
> >   ... so you mean this mockalias is actually a text file contain records one
> > entry per line with the symbol ":" as the delimitor?
>
> Yes, it is. DB_file is not the best option, is it, in such a case?
>

  I'm sorry I've over looked your question, my apology.

  no, actually Berkely DB is an excellent choice, it gives you all the features
(delete, search, add, update) you wanted while consuming very little resources.

  But since your data is in a text file, you will have to first convert them into a
Berkely DB first before you can use it.  The following code should the job.

my ($key, $values);
open Fin, "mockalias";
while ()
{
  ($key, $value) = split(/:/, $_)
  $ALIAS{$key} = $value;
}
close Fin;


put this loop between the tie and untie statement and it will load the vlaues from
the mockalias file and convert it into a hash and at the same time storing the
change into the BerkelyDB file.

Remember to pick a different name for your berkely db file, .. mockalias.db should
be a good choice. (^_^)

Tor.




Re: Reading to a hash

2001-06-19 Thread Jeff 'japhy' Pinyan

On Jun 19, mark crowe (JIC) said:

>I wonder if anyone can help me with a question based more on curosity than a
>desperate need to know. Say I have a data file with one key/value pair on
>each line, which I want to read into a hash. I've been doing it in one of
>two ways:
>
>  while (<>) {
>($key, $value) = split;
>$hash{$key} = $value;
>  }
>
>or 
>
>  push @array, split while <>;
>  %hash = @array;

It's better for memory if you do it one-at-a-time, but if you'd really
like a one-liner, I'd use:

  %hash = map split, <>;

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




RE: ICQ Trouble

2001-06-19 Thread IT Dept - Terry Honeyford

not sure about this, but you could try using a semi colon as the delimiter
between the "To; CC; Subject; Message;" fields in the mail header

terry

...-Original Message-
...From: Markus Peter [mailto:[EMAIL PROTECTED]]
...Sent: Tuesday, June 19, 2001 2:23 PM
...To: [EMAIL PROTECTED]
...Cc: [EMAIL PROTECTED]
...Subject: Re: ICQ Trouble
...
...
...On Sun, 3 Jun 2001 [EMAIL PROTECTED] wrote:
...
...> Hi  everyone,
...> i'm having this problem and i would like help please:
...> When i send an e-mail message using MIME::Lite to an ICQ 
...number lets say mine [EMAIL PROTECTED] i fill the 
...sender with something the from with someone the subject with 
...something the type with Type=>"text",and Data=>"some text i  
...wanna send", well the message arrives ok but completely 
...blank !!! i am misssing something really foolish but cannot 
...figure out what is can anyone help me ( a brazilian) please?
...
...It probably should work that way - maybe ICQ filters the 
...text out due to
...some other missing header? Did you try setting Type to a more exact
...MIME type like e.g. text/plain; charset=iso-8859-1; yet?
...
...Can you tell us the _exact_ code you use to send the message?
...
...-- 
...Markus Peter - SPiN AG
[EMAIL PROTECTED]
...
...
...



array help

2001-06-19 Thread Yacketta, Ronald

Folks,

Can someone shed some light on this little blunder of mine?

opendir DIR, "../logs/set1" or die "Can't open ../logs/set1: $!";
@allFiles = readdir DIR;
closedir DIR;

foreach (@allFiles) {
if( ($count % 3) == 0 ) {
push(@logFiles1,$_);
} else {
if ( ($count % 2 ) == 0 ) {
push(@logFiles2,$_);
} else {
push(@logFiles3,$_);
}
}
$count++;
}

@CMD = ( "egrep -c ", "egrep -c ", "egrep -c " );
@LOGS = ( \@logFiles1, \@logFiles2, \@logFiles3 );
print "Totals: " . @logFiles1 . " " .  @logFiles2 . " " . @logFiles3 . "\n";
print "@${LOGS[0]}";
exit;

the output is not what I expected, I thought the last print would actualy
access the referenced array and
spew for the files but it prints nada!

regards,
Ron



Re: PERL DB Question

2001-06-19 Thread Vrunda Prabhu

PERFECT!! Works like magic.  Thank you very much Victor.

On Tue, 19 Jun 2001 [EMAIL PROTECTED] wrote:

> > > > 1) unless you have previously populated the db file, it will start off
> > > > as
> > > > empty.
> > > >
> > > > I guess, this is my most basic and pressing question.  A file by the name
> > > > mockalias exists which already has the usernames and e-mail addresses
> > > > separated by :
> > > > When I use the tie command, am I not pulling up all the existing information
> > > > in that file, into a hash?
> > > >
> > >
> > >   ... so you mean this mockalias is actually a text file contain records one
> > > entry per line with the symbol ":" as the delimitor?
> >
> > Yes, it is. DB_file is not the best option, is it, in such a case?
> >
> 
>   I'm sorry I've over looked your question, my apology.
> 
>   no, actually Berkely DB is an excellent choice, it gives you all the features
> (delete, search, add, update) you wanted while consuming very little resources.
> 
>   But since your data is in a text file, you will have to first convert them into a
> Berkely DB first before you can use it.  The following code should the job.
> 
> my ($key, $values);
> open Fin, "mockalias";
> while ()
> {
>   ($key, $value) = split(/:/, $_)
>   $ALIAS{$key} = $value;
> }
> close Fin;
> 
> 
> put this loop between the tie and untie statement and it will load the vlaues from
> the mockalias file and convert it into a hash and at the same time storing the
> change into the BerkelyDB file.
> 
> Remember to pick a different name for your berkely db file, .. mockalias.db should
> be a good choice. (^_^)
> 
> Tor.
> 




CGI methods

2001-06-19 Thread D T Bedford

I've looked at http://stein.cshl.org/WWW/software/CGI/cgi_docs.html and
http://www.perldoc.com/perl5.6/pod/cgi.html but I've yet to find a list of
the CGI methods and how they're called. Would someone please point me to
such documentation?

Gracias,

-don





___
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/





Re: Perl/Linnux/unix question

2001-06-19 Thread Dave Young

It all has to do with your shell. modern shells shouldn't kill your
processes on logout. Do  & to run it in the background
(which also "disconnects" it from the current tty.


if all else fails, man  and look for nohup




Hope that helps.



Dave



...On Mon, 4 Jun
2001
[EMAIL PROTECTED] wrote:

> Which linux command i use to run a perl script that will stay running in my server 
>even when i logout via telnet?
> Thanks
>
>






Executing commands, getting both STDOUT and STDERR from command

2001-06-19 Thread Craig Moynes/Markham/IBM

Hi,
 I am running several commands within my perl script (on AIX 4.3.3).
These commands include find, chmod, etc.
What I am wondering is if anyone has a sample script kicking around where
they execute the command and check the return code, grabbing any output
(stderr or stdout) and printing it in the error message.

My problem right now is I am executing the commands and piping the output
within the open command:
open( INPUT, "$findCMD|" )

If the find command fails then i loose the error message ( and the return
code), but I can read the stdout into perl very easily.

I'm looking for an small elegant solution (as the script is fairly small).
But I will use suggestions involving the redirecting of output to seperate
files if I have to.

Thanks all :)

-
Craig Moynes
Internship Student
netCC Development
IBM Global Services, Canada
Tel: (905) 316-3486
[EMAIL PROTECTED]





Re: Perl/Linnux/unix question

2001-06-19 Thread victor

put a nohup in front and a & at the end.

This will make your script immune to handup and run in background.

Tor.

[EMAIL PROTECTED] wrote:

> Which linux command i use to run a perl script that will stay running in my server 
>even when i logout via telnet?
> Thanks




Data format ( time zones )

2001-06-19 Thread Ela Jarecka

Hi,
I have to check whether a given string ( '-MM-DDTHH:MI:SSTZD' - where
TZD = Z|+HH:MI|-HH:MI ) contains a valid data and then convert to
'-MM-DD HH:MI:SS'. 
I've found a module called Net::ICal::Time, but it doesn't seem to be
working properly.. Writing a regex to divide the given string is not a
problem, but it would be nice if I had a function that would adjust the time
accordingly, given a time zone.

Thanks in advance for any suggestions,
Ela




Re: Perl/Linnux/unix question

2001-06-19 Thread Alejandro PAYDON

If you need to run your script very often, try to put it into the  cron file

Alex

[EMAIL PROTECTED] wrote:

> put a nohup in front and a & at the end.
>
> This will make your script immune to handup and run in background.
>
> Tor.
>
> [EMAIL PROTECTED] wrote:
>
> > Which linux command i use to run a perl script that will stay running in my server 
>even when i logout via telnet?
> > Thanks

--
Alejandro Paydón Juárez
R. A. S. Project Leader
e-mail: [EMAIL PROTECTED]
phone number: (52) 5 345-2000 ext. 2623




RE: Selection Mask - 2nd Attemp

2001-06-19 Thread Wagner-David

If the code is actually as you state, then you are using [ twice which
would make the mask incorrect.
The lines 54/56 show the vairable as being encased in [] and in line 76 you
show [$mask] which would equate to /^[[2,A-Z]]/ which is not really what you
want.
 
Wags ;)

-Original Message-
From: Gary Luther [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 07:52
To: [EMAIL PROTECTED]
Subject: Selection Mask - 2nd Attemp


Since I didn't get a response yesterday I hope someone can help this
morning.
 
I have a statement that I am using to mask from the user some file names
that I am displaying (print) to him for a y or n decision.
There are many files and so I am trying to give him the option of specifying
the first letter of the filename and then mask whether he
gets to see the file based on the mask that he inputs. (For any ladies on
the list he/him is generic for user :-) whe!!)
 
This works just fine and is how I get the "mask" into the program.
First the reading of the mask from the command line:
 
 53 if ($ARGV[1]) {
 54 $mask = "[$ARGV[1]]";
 55 } else {
 56 $mask ='[2,A-Z]';  #default mask
 57 }
 
Here is the problem code. I can't seem to get $mask to work in the code
below.
If I substitute the following statement for 76 it works as I want.
 
if ($file =~ /^[2,A-Z]/) {
 
Now the code that seems to totally ignore it:
 
 75 foreach $file (@files) {
 76 if ($file =~ /^[$mask]/) {
 77 chomp($file);
 78 ($size, $name) = split(" ", $file);
 79 print "PRINT ([y],n,q): $file\n";
 80 $input=;

Why does it not resolve $mask?  Is there a different way around the problem?
... or have I just made a beginners mistake?
 
TIA
 
--
-
"They that can give up essential liberty 
   to obtain a little temporary safety 
   deserve neither liberty  nor safety."  
 
-- Benjamin Franklin 
-
RGary Luther
RR  RR   SAF
RR  RR UTABEGAS  2500 Broadway
RR RRHelena, MT 59602
 [EMAIL PROTECTED]  
RR RR  ULE !!
RR  RR   Visit our website at
RR   RR  http://www.safmt.org  





getting memory info from system

2001-06-19 Thread Chris Hedemark

Howdy,

I'm tearing through my O'Reilly books and the CPAN search trying to find a
module or built-in function call that will let me get statistics back from
the system regarding memory.  I'm trying to find:

1) real memory bytes total
2) real memory bytes used
3) real memory bytes free

As a secondary interest I'd like to do the same stats but for the swap
file(s).

Can anyone here point me in the right direction please?

Thanks.

Chris Hedemark - Hillsborough, NC
http://yonderway.com





Re: getting memory info from system

2001-06-19 Thread perl

yeah just type : 'free'

Ryan

On Tue, 19 Jun 2001, Chris Hedemark wrote:

> Howdy,
>
> I'm tearing through my O'Reilly books and the CPAN search trying to find a
> module or built-in function call that will let me get statistics back from
> the system regarding memory.  I'm trying to find:
>
> 1) real memory bytes total
> 2) real memory bytes used
> 3) real memory bytes free
>
> As a secondary interest I'd like to do the same stats but for the swap
> file(s).
>
> Can anyone here point me in the right direction please?
>
> Thanks.
>
> Chris Hedemark - Hillsborough, NC
> http://yonderway.com
>
>




mailing list for C?

2001-06-19 Thread Roy Peters

hi,

Sorry to bother everyone. But I am learning a lot from this daily Perl
mailing list. Can someone recommend a good mailing list to subscribe
for C programming?

Thanks.




Re: getting memory info from system

2001-06-19 Thread Chas Owens

I think this is going to wind up being machine dependant.

Solaris
Solaris::Procfs -- reads the /proc filesystem

Linux
GTop -- interfaces with libgtop (which reads the /proc filesystem)

windows
Win32::SystemInfo

There are almost certainly others.  Most Unix boxen store this info in
the /proc filesystem (however, they do so in completely different ways),
so look for modules that read the /proc for your system.

On 19 Jun 2001 11:45:09 -0400, Chris Hedemark wrote:
> Howdy,
> 
> I'm tearing through my O'Reilly books and the CPAN search trying to find a
> module or built-in function call that will let me get statistics back from
> the system regarding memory.  I'm trying to find:
> 
> 1) real memory bytes total
> 2) real memory bytes used
> 3) real memory bytes free
> 
> As a secondary interest I'd like to do the same stats but for the swap
> file(s).
> 
> Can anyone here point me in the right direction please?
> 
> Thanks.
> 
> Chris Hedemark - Hillsborough, NC
> http://yonderway.com
> 
> 
> 
--
Today is Setting Orange, the 24th day of Confusion in the YOLD 3167
Grudnuk demand sustenance!





Re: Learning Perl chpt.13 problem

2001-06-19 Thread Randal L. Schwartz

> "You" ==   <[EMAIL PROTECTED]> writes:

You> I don't understand the regex s#.*/##s
You> (given as part of the solution to problems 2 and 3)

You> more specifically, I don't know what the last 's' does
You> to the regex.

As others have said, the trailing "s" allows newline to be matched:
otherwise, we'd have a potential security hole with a false assumption
that we've stripped the pathname down to the base filename, since Unix
paths can contain newline.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Subject Prefix

2001-06-19 Thread Chas Owens

Actually you need to sort on TO: or CC: containing [EMAIL PROTECTED]
(also known as RECIPIENTS: in some filter programs).  By default most
email clients shove the person who wrote the email you are replying to
into TO: and [EMAIL PROTECTED] in the CC:.  Most good list citezens
then delete the TO: line and change to CC: line to TO.  In the case of
this email hitting reply-all put "Brett W. McCoy
<[EMAIL PROTECTED]>" in the TO: and "Eduard Grinvald
<[EMAIL PROTECTED]>, [EMAIL PROTECTED]" in the CC:.  But I deleted the
other two addresses before hitting send.

On 19 Jun 2001 09:22:38 -0400, Brett W. McCoy wrote:
> On Tue, 19 Jun 2001, Brett W. McCoy wrote:
> 
> > > Hello, this probably goes to the list admins ;)
> > > Is it possible to insert some sort of subject heading, like [beginners-perl]
> > > or something to make the email screening easier?
> >
> > You can get the same effect by sorting on the From: field.
> 
> Err, I mean To: field. :-)
> 
> -- Brett
>  http://www.chapelperilous.net/btfwk/
> 
> QOTD:
>   "I thought I saw a unicorn on the way over, but it was just a
>   horse with one of the horns broken off."
> 
> 
--
Today is Setting Orange, the 24th day of Confusion in the YOLD 3167
Hail Eris, Hack Linux!





Re: getting memory info from system

2001-06-19 Thread Chris Hedemark

Doesn't work on OpenBSD.

- Original Message -
From: <[EMAIL PROTECTED]>
To: "Chris Hedemark" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 20, 2001 12:05 AM
Subject: Re: getting memory info from system


> yeah just type : 'free'
>
> Ryan
>
> On Tue, 19 Jun 2001, Chris Hedemark wrote:
>
> > Howdy,
> >
> > I'm tearing through my O'Reilly books and the CPAN search trying to find
a
> > module or built-in function call that will let me get statistics back
from
> > the system regarding memory.  I'm trying to find:
> >
> > 1) real memory bytes total
> > 2) real memory bytes used
> > 3) real memory bytes free
> >
> > As a secondary interest I'd like to do the same stats but for the swap
> > file(s).
> >
> > Can anyone here point me in the right direction please?
> >
> > Thanks.
> >
> > Chris Hedemark - Hillsborough, NC
> > http://yonderway.com
> >
> >
>





Re: Subject Prefix

2001-06-19 Thread Chi-Tai yang


Most mailing lists I subscribe to have [mailinglistname] prefix. It
requires only listkeeper to modify config file and rid out all these
to/cc/bcc exchange/sendmail/procmail receipient change.  Wouldn't this be
easier and nicer, esteem listmaster? 


Chris C.T. Yang [EMAIL PROTECTED]

On 19 Jun 2001, Chas Owens wrote:

> Actually you need to sort on TO: or CC: containing [EMAIL PROTECTED]
> (also known as RECIPIENTS: in some filter programs).  By default most
> email clients shove the person who wrote the email you are replying to
> into TO: and [EMAIL PROTECTED] in the CC:.  Most good list citezens
> then delete the TO: line and change to CC: line to TO.  In the case of
> this email hitting reply-all put "Brett W. McCoy
> <[EMAIL PROTECTED]>" in the TO: and "Eduard Grinvald
> <[EMAIL PROTECTED]>, [EMAIL PROTECTED]" in the CC:.  But I deleted the
> other two addresses before hitting send.




Which command...?

2001-06-19 Thread Paul Burkett

I now understand how to open a device in perl, but how
do I send a command to it, I thought it was 'print'
but that didn't seem to work. Is there any other
commands? Thanks.

=
- Paul Burkett

__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/



populating an array with unique integers.

2001-06-19 Thread Scott Taylor

I want to create an array, and populate it with random numbers, they should
be unique and sorted (I can sort at the output).  I'm stuck at the unique part:

generate a random number;
check if the number exists in the array,
 if it exists generate a new one,
 check again until a unique number is found.

once unique add too next place in array.

I think the perldocs are confusing me.

Thanks.

Scott.




Re: Subject Prefix

2001-06-19 Thread Brett W. McCoy

On Tue, 19 Jun 2001, Chi-Tai yang wrote:

> Most mailing lists I subscribe to have [mailinglistname] prefix. It
> requires only listkeeper to modify config file and rid out all these
> to/cc/bcc exchange/sendmail/procmail receipient change.  Wouldn't this be
> easier and nicer, esteem listmaster?

*sigh* We went through all of this last week.  Please check the list
archives -- the thread has been officially closed.

-- Brett
   http://www.chapelperilous.net/btfwk/

Behind every great man, there is a woman -- urging him on.
-- Harry Mudd, "I, Mudd", stardate 4513.3




Re: Which command...?

2001-06-19 Thread Brett W. McCoy

On Tue, 19 Jun 2001, Paul Burkett wrote:

> I now understand how to open a device in perl, but how
> do I send a command to it, I thought it was 'print'
> but that didn't seem to work. Is there any other
> commands? Thanks.

How did you open it?  You should also set $| to 1 so output gets flushed
immediately.

-- Brett
   http://www.chapelperilous.net/btfwk/

Behind every great man, there is a woman -- urging him on.
-- Harry Mudd, "I, Mudd", stardate 4513.3




RE: populating an array with unique integers.

2001-06-19 Thread Wagner-David

Use a hash vs array, use the number as a hash key.  If key exists,
then get the next number until you have the number of unique numbers
desired.

next if ( exists $Unique{$RandomNumber} );
$Unique{$RandomNumber} = 1;


for printing:
foreach my $MyKey (sort keys %RandomNumber ) {
 # print goes here
 }

Wags ;)
-Original Message-
From: Scott Taylor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 09:51
To: [EMAIL PROTECTED]
Subject: populating an array with unique integers.


I want to create an array, and populate it with random numbers, they should
be unique and sorted (I can sort at the output).  I'm stuck at the unique
part:

generate a random number;
check if the number exists in the array,
 if it exists generate a new one,
 check again until a unique number is found.

once unique add too next place in array.

I think the perldocs are confusing me.

Thanks.

Scott.



RE: populating an array with unique integers.

2001-06-19 Thread Wagner-David

Sorry but foreach should be:

foreach my $MyKey (sort keys %Unique ) {
 

Wags ;)
-Original Message-
From: Wagner-David 
Sent: Tuesday, June 19, 2001 09:57
To: [EMAIL PROTECTED]
Subject: RE: populating an array with unique integers.


Use a hash vs array, use the number as a hash key.  If key exists,
then get the next number until you have the number of unique numbers
desired.

next if ( exists $Unique{$RandomNumber} );
$Unique{$RandomNumber} = 1;


for printing:
foreach my $MyKey (sort keys %RandomNumber ) {
 # print goes here
 }

Wags ;)
-Original Message-
From: Scott Taylor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 09:51
To: [EMAIL PROTECTED]
Subject: populating an array with unique integers.


I want to create an array, and populate it with random numbers, they should
be unique and sorted (I can sort at the output).  I'm stuck at the unique
part:

generate a random number;
check if the number exists in the array,
 if it exists generate a new one,
 check again until a unique number is found.

once unique add too next place in array.

I think the perldocs are confusing me.

Thanks.

Scott.



Re: open() for IPC isn't dying ?

2001-06-19 Thread Evgeny Goldin (aka Genie)


perlipc :

> If you're *writing* to a pipe, you should also trap SIGPIPE
> Otherwise, think of what happens when you start up a pipe to a command
> that doesn't exist: the open() will in all likelihood succeed (it only
> reflects the fork()'s  success)

Hmm .. Although perlipc is talking about *writing* to pipe and I'm only
*reading* from it - it still looks like the same problem. I'll give it a try ..
Thank you !




Re: combining lines in a tagged text file

2001-06-19 Thread Aaron Craig

Try this.

* warning * assumes all your input files will look like your example -- ie 
a bunch of text to copy directly over to the output file followed by a 
chunk of 's followed by more stuff to copy

__start code__

 open(IN, "in.txt") || die("Could not open file $!");
 open(OUT, "out.txt") || die("Could not open file $!");
 my $sBefore = "";
 my $sAfter = "";
 my $rhLnks = {};
 while()
 {
 chomp($_);
 if($_ !~ /([^<]+)]+)>([^<]+)/)
 {
 $sBefore .= "$_\n" if(scalar(keys %{ $rhLnks }) < 1);
 $sAfter .= "$_\n" if(scalar(keys %{ $rhLnks }) < 1);
 next;
 }
 my $by = $1;
 my $param = $2;
 my $content = $3;
 $by =~ s/\s+by\s+//;
 print "content: $content\n";
 if(exists $rhLnks->{$content})
 {
 $rhLnks->{$content}->{by} .= " and $by";
 }
 else
 {
 $rhLnks->{$content} =
 {
 by  => "$by",
 param   => "$param",
 };
 }
 }
 print OUT $sBefore;
 print OUT "$rhLnks->{$_}->{by} by 
{$_}->{param}>$_\n" foreach (keys %{ $rhLnks });
 print OUT $sAfter;
 close IN;
 close OUT;

__end code__

At 08:40 18.06.2001 -0400, [EMAIL PROTECTED] wrote:
>Input example:
>
>!EC
>1999 TNT 230-4
>!CU
>Administrative Rulings
>!CU
>Administrative Rulings
>!CS
>IRS Revenue Rulings
>!DN
>Doc 1999-37669 (3 original original pages)
>!TS  #each of the following pairs should be combined because the strings match
>Modified by Rev. Rul. 2000-4
>Amplified by Rev. Rul. 2000-4
>Superseded by Rev. Rul. 2000-56
>Supplemented by Rev. Rul. 2000-56
>!GI
>United States
>!IA
>Internal Revenue Service
>!DP
>30 Nov 1999
>!PD
>01 Dec 1999
>. . .
>=
>
>Output example:
>
>!EC
>1999 TNT 230-4
>!CU
>Administrative Rulings
>!CU
>Administrative Rulings
>!CS
>IRS Revenue Rulings
>!DN
>Doc 1999-37669 (3 original original pages)
>!TS  #notice that the first of the two lines remain, and the second is 
>properly
>removed
>  #the lines are also combined as I want them. The 'old' and 'new' 
> tags are
>for my viewing
>old Modified by Rev. Rul. 2000-4
>new Modified and Amplified by Rev. Rul. 2000-4
>old Superseded by Rev. Rul. 2000-56
>new Superseded and Supplemented by Rev. Rul.
>2000-56
>!GI
>United States
>!IA
>Internal Revenue Service
>!DP
>30 Nov 1999
>!PD
>01 Dec 1999
>. . .

Aaron Craig
Programming
iSoftitler.com




Re: combining lines in a tagged text file

2001-06-19 Thread Aaron Craig

Try this.

* warning * assumes all your input files will look like your example -- ie 
a bunch of text to copy directly over to the output file followed by a 
chunk of 's followed by more stuff to copy

__start code__

 open(IN, "in.txt") || die("Could not open file $!");
 open(OUT, "out.txt") || die("Could not open file $!");
 my $sBefore = "";
 my $sAfter = "";
 my $rhLnks = {};
 while()
 {
 chomp($_);
 if($_ !~ /([^<]+)]+)>([^<]+)/)
 {
 $sBefore .= "$_\n" if(scalar(keys %{ $rhLnks }) < 1);
 $sAfter .= "$_\n" if(scalar(keys %{ $rhLnks }) < 1);
 next;
 }
 my $by = $1;
 my $param = $2;
 my $content = $3;
 $by =~ s/\s+by\s+//;
 print "content: $content\n";
 if(exists $rhLnks->{$content})
 {
 $rhLnks->{$content}->{by} .= " and $by";
 }
 else
 {
 $rhLnks->{$content} =
 {
 by  => "$by",
 param   => "$param",
 };
 }
 }
 print OUT $sBefore;
 print OUT "$rhLnks->{$_}->{by} by 
{$_}->{param}>$_\n" foreach (keys %{ $rhLnks });
 print OUT $sAfter;
 close IN;
 close OUT;

__end code__

At 08:40 18.06.2001 -0400, [EMAIL PROTECTED] wrote:
>Input example:
>
>!EC
>1999 TNT 230-4
>!CU
>Administrative Rulings
>!CU
>Administrative Rulings
>!CS
>IRS Revenue Rulings
>!DN
>Doc 1999-37669 (3 original original pages)
>!TS  #each of the following pairs should be combined because the strings match
>Modified by Rev. Rul. 2000-4
>Amplified by Rev. Rul. 2000-4
>Superseded by Rev. Rul. 2000-56
>Supplemented by Rev. Rul. 2000-56
>!GI
>United States
>!IA
>Internal Revenue Service
>!DP
>30 Nov 1999
>!PD
>01 Dec 1999
>. . .
>=
>
>Output example:
>
>!EC
>1999 TNT 230-4
>!CU
>Administrative Rulings
>!CU
>Administrative Rulings
>!CS
>IRS Revenue Rulings
>!DN
>Doc 1999-37669 (3 original original pages)
>!TS  #notice that the first of the two lines remain, and the second is 
>properly
>removed
>  #the lines are also combined as I want them. The 'old' and 'new' 
> tags are
>for my viewing
>old Modified by Rev. Rul. 2000-4
>new Modified and Amplified by Rev. Rul. 2000-4
>old Superseded by Rev. Rul. 2000-56
>new Superseded and Supplemented by Rev. Rul.
>2000-56
>!GI
>United States
>!IA
>Internal Revenue Service
>!DP
>30 Nov 1999
>!PD
>01 Dec 1999
>. . .

Aaron Craig
Programming
iSoftitler.com




Re: populating an array with unique integers.

2001-06-19 Thread Jeff 'japhy' Pinyan

On Jun 19, Scott Taylor said:

>I want to create an array, and populate it with random numbers, they
>should be unique and sorted (I can sort at the output).  I'm stuck at
>the unique part:

Whenever you hear "unique", you should think "I should be using a hash."

The same goes for "in" and "duplicate" and "is this the first time I've
seen an element".

That said, use a hash, and stop when the number of keys is the preferred
number.

  $limit = 10;  # we want 10 random numbers
  $random{random_number()} = 1 until keys %random == $limit;

That loop, if it's too concise for you, is:

  until (keys(%random) == $limit) {
my $r = random_number();
$random{$r} = 1;
  }

Then you extract the keys() of %random.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




Re: Executing commands, getting both STDOUT and STDERR from command

2001-06-19 Thread Michael Fowler

On Tue, Jun 19, 2001 at 11:09:26AM -0400, Craig Moynes/Markham/IBM wrote:
> Hi,
>  I am running several commands within my perl script (on AIX 4.3.3).
> These commands include find, chmod, etc.
> What I am wondering is if anyone has a sample script kicking around where
> they execute the command and check the return code, grabbing any output
> (stderr or stdout) and printing it in the error message.
> 
> My problem right now is I am executing the commands and piping the output
> within the open command:
> open( INPUT, "$findCMD|" )
> 
> If the find command fails then i loose the error message ( and the return
> code), but I can read the stdout into perl very easily.
> 
> I'm looking for an small elegant solution (as the script is fairly small).
> But I will use suggestions involving the redirecting of output to seperate
> files if I have to.

As an alternative to the redirection solution posted by Gary Stainburn, you
can also use IPC::Open3 to open handles on each set of output.

By way of example:

use IPC::Open3 qw(open3);
use strict;

open3(
\*IN, \*OUT, \*ERR,
'perl', '-wle', 'print STDERR "error"; print STDOUT "output"'
);

print "program output: $_" while ;
print "program error:  $_" while ;

It's not as pretty, nor as elegant, as redirection, but it does allow you to
seperate the two sets of output.

There is also the IPC::Run module found on CPAN.  I've never used it, but
from the examples I've seen of its use, it would very likely solve your
problem as well.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--



compiling _statically linked_ perl

2001-06-19 Thread Pozsar Balazs


Hi folks,

First of all i don't know if this is the list i should write to, but i
could find any better.

So my big question is: how can i compile a statically linked perl.
I've tried lots of combinations of config.sh and Makefile, but none of
them gave me a perl binary which could pass the 'make test' and wouldn't
require the /lib/ld-linux.so.2

Can anyone tell me exactly how to do it? I couldn't find any info though i
read lots of faqs and digged up the net with google... :(

thanks
Balazs Pozsar.
-- 





RE: populating an array with unique integers.

2001-06-19 Thread blowther

Just a different spin on this one would be to create an array containing
sequential numbers, then shuffling them.  This meets your criteria that they
be unique.  However it adds an unspecified condition that all numbers in a
range are represented.  

A good shuffle algorithm (fisher-yates shuffle) for perl located in the perl
cookbook: 4.17 pg 121.



-Original Message-
From: Scott Taylor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 10:51 AM
To: [EMAIL PROTECTED]
Subject: populating an array with unique integers.


I want to create an array, and populate it with random numbers, they should
be unique and sorted (I can sort at the output).  I'm stuck at the unique
part:

generate a random number;
check if the number exists in the array,
 if it exists generate a new one,
 check again until a unique number is found.

once unique add too next place in array.

I think the perldocs are confusing me.

Thanks.

Scott.



Re: getting memory info from system

2001-06-19 Thread Chris Hedemark

Clarification:  I'm doing this on OpenBSD.  If there is a portable function
that will work across *NIX flavors that is preferable but if not I guess I
need something BSD specific.  Thanks.

Chris Hedemark - Hillsborough, NC
http://yonderway.com
 Original Message -
From: "Chris Hedemark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 19, 2001 11:45 AM
Subject: getting memory info from system


> Howdy,
>
> I'm tearing through my O'Reilly books and the CPAN search trying to find a
> module or built-in function call that will let me get statistics back from
> the system regarding memory.  I'm trying to find:
>
> 1) real memory bytes total
> 2) real memory bytes used
> 3) real memory bytes free
>
> As a secondary interest I'd like to do the same stats but for the swap
> file(s).
>
> Can anyone here point me in the right direction please?
>
> Thanks.
>
> Chris Hedemark - Hillsborough, NC
> http://yonderway.com
>
>





pathname won't be recognized in open-command

2001-06-19 Thread Heiko Kundlacz
Title: pathname won't be recognized in open-command






Hi all,


I assigned the path d:/skyva/jre to $config{jdk.bin} !


I want to do the following:


$java = open (GSM, "$config{'jdk.bin')/bin/java"|);


This should start a java-programm. But


print ;


says: d:/skyva241a/jre is not recognized as an internal or external command ...


$java = open (GSM, "d:/skyva/jre/bin/java |";


works find.


Why?


Heiko





Re: pathname won't be recognized in open-command

2001-06-19 Thread John Fox

Heiko,

> $java = open (GSM, "$config{'jdk.bin')/bin/java"|);

You've got a typo here.  Specifically, a '|' that is outside
the double-quotes.  Note that in your working example
below, the '|' is within the double-quotes.

> $java = open (GSM, "d:/skyva/jre/bin/java |";

You see?

Little mistakes like this are *soo* easy to make! 

HTH,

John
-- 
   John Fox <[EMAIL PROTECTED]>
System Administrator, InfoStructure, Ashland OR USA
  -
"What is loved endures.  And Babylon 5 ... Babylon 5 endures."
  --Delenn, "Rising Stars", Babylon 5



Re: Perl/Linnux/unix question

2001-06-19 Thread Karthik Krishnamurthy

On Tue, Jun 19, 2001 at 08:07:45AM -0700, Dave Young wrote:
> (which also "disconnects" it from the current tty.

dont know what shell you are talking about. no shell that i have seen bash,ksh
or csh works that way. commands are just put in their own process groups. 
putting a & in front just makes the process group a backgroup proc group for
that terminal. nohup is the way to go. one other way is to make sure that
the backgroup process group does not attempt to write to the terminal by
redirecting its STDOUT, STDERR. this is because when it tries to do so (write),
it is stopped. now as it is an orphaned process group, when it is stopped,
it is posted a SIGHUP as prescribed by POSIX. 
/kk


> It all has to do with your shell. modern shells shouldn't kill your
> processes on logout. Do  & to run it in the background
> 
> 
> if all else fails, man  and look for nohup
> 
> 
> 
> 
> Hope that helps.
> 
> 
> 
> Dave
> 
> 
> 
> ...On Mon, 4 Jun
> 2001
> [EMAIL PROTECTED] wrote:
> 
> > Which linux command i use to run a perl script that will stay running in my server 
>even when i logout via telnet?
> > Thanks
> >
> >
> 
> 



Re: getting started

2001-06-19 Thread Michael McKee


Hi all.
As another true programming beginner, I have to say that the O'Reilly 
books can be a bit intimidating. I worked with Beginning Perl from Wrox 
for a couple of months before Learning Perl started making any sense to 
me. Don't know about the Win 32 book. Sometimes the pros at this can 
forget how intimidating learning to think like a programmer can be, 
especially when learning everything else at the same time. O"Reilly 
produces wonderful books for programmers who already know how to think 
like programmers. For us mere mortals, the Wrox book or Sam's Teach 
Yourself Perl in 24 Hours can get you to a point where the O'Reilly 
books are a bit more accessible.

As for editors, I recently found a Java based editor, Jext (Jext.org) 
that allows me to use the same editor on a M$ machine at work and my Mac 
OS X at home. Nice syntax coloring for both Perl and HTML and it offers 
a terminal  interface for the BSD Unix core of the OS X so I can do 
command line too.

michael



Re: populating an array with unique integers.

2001-06-19 Thread Scott Taylor

At 10:30 AM 06/19/01, Jeff 'japhy' Pinyan wrote:
>On Jun 19, Scott Taylor said:
>
> >I want to create an array, and populate it with random numbers, they
> >should be unique and sorted (I can sort at the output).  I'm stuck at
> >the unique part:
>
>   $limit = 10;  # we want 10 random numbers
>   $random{random_number()} = 1 until keys %random == $limit;


>That loop, if it's too concise for you, is:

A bit, yup.

>   until (keys(%random) == $limit) {
> my $r = random_number();
> $random{$r} = 1;
>   }

That makes sense to me, and it works great, thanks.

Now I need to clear that hash so I can do it again; I'm trying to build a 
table of sets of numbers.

This is what I have so far, but it's wrong.

until (keys(%MyTable) == $num_sets) {
 until (keys(%Random) == $per_set) {
 my $r = $thenum = int(rand() * $newmax ) + $min;
 $Random{$r} = 1;
 }

 foreach my $MyKey (sort keys %Random) {
 $theset = $theset ." ". $MyKey;
 }

 $MyTable{$theset} = 1;
#$theset = "";
#delete @Random;  How do I clear the entire @Random table, so I can 
start again?
 }




RE: populating an array with unique integers.

2001-06-19 Thread Wagner-David

   undef %Random; or
   %Random = ();

 Wags ;)

-Original Message-
From: Scott Taylor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 11:52
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: populating an array with unique integers.


At 10:30 AM 06/19/01, Jeff 'japhy' Pinyan wrote:
>On Jun 19, Scott Taylor said:
>
> >I want to create an array, and populate it with random numbers, they
> >should be unique and sorted (I can sort at the output).  I'm stuck at
> >the unique part:
>
>   $limit = 10;  # we want 10 random numbers
>   $random{random_number()} = 1 until keys %random == $limit;


>That loop, if it's too concise for you, is:

A bit, yup.

>   until (keys(%random) == $limit) {
> my $r = random_number();
> $random{$r} = 1;
>   }

That makes sense to me, and it works great, thanks.

Now I need to clear that hash so I can do it again; I'm trying to build a 
table of sets of numbers.

This is what I have so far, but it's wrong.

until (keys(%MyTable) == $num_sets) {
 until (keys(%Random) == $per_set) {
 my $r = $thenum = int(rand() * $newmax ) + $min;
 $Random{$r} = 1;
 }

 foreach my $MyKey (sort keys %Random) {
 $theset = $theset ." ". $MyKey;
 }

 $MyTable{$theset} = 1;
#$theset = "";
#delete @Random;  How do I clear the entire @Random table, so I can 
start again?
 }



Re: populating an array with unique integers.

2001-06-19 Thread Jeff 'japhy' Pinyan

On Jun 19, Jeff 'japhy' Pinyan said:

>  until (keys(%table) == $num_sets) {
>my %random;
>
># until we have the proper number of random numbers
>until (keys(%random) == $per_set) {
>  # put a random number in the hash
>  $random{ $min + int rand $newmax } = 1;
>}
>
>$table{ join " ", sort keys %random } = 1;
>  }

We can eliminate the inner until loop by making it a for loop, and
pregenerating the list of random numbers (not a good idea if it's going to
be very large, though).

  until (keys(%table) == $num_sets) {
my @random = ($min .. $min + $newmax - 1);
my @set =
  sort
  map { splice @random, rand @random, 1 }
  1 .. $per_set;
$table{"@set"} = 1;
  }

This might be less good, though, since splice() can be ugly.  What this is
doing is removing one random number at a time, $per_set times, and then
sorting them.  Because they get removed from @random, they won't repeat.

But maybe that hash idea was better. ;)

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




variable losing it's value

2001-06-19 Thread Bob Mangold

I may have a bug somewhere in my code, but I can't find it. Before I look again
though please answer this for me.

If I execute:


my ($line) = "hello";
foreach $line (<>){
 . whatever
}
print $line;


Should it print the last line in <> or 'hello'? 

-Bob

__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/



Re: variable losing it's value

2001-06-19 Thread perl


When you do : foreach $line (<>){

that will print the last line in <>
rename $line in the foreach statement to something different,

RYan



On Tue, 19 Jun 2001, Bob Mangold wrote:

> I may have a bug somewhere in my code, but I can't find it. Before I look again
> though please answer this for me.
>
> If I execute:
>
>
> my ($line) = "hello";
> foreach $line (<>){
>  . whatever
> }
> print $line;
>
>
> Should it print the last line in <> or 'hello'?
>
> -Bob
>
> __
> Do You Yahoo!?
> Spot the hottest trends in music, movies, and more.
> http://buzz.yahoo.com/
>




RE: variable losing it's value

2001-06-19 Thread Wagner-David

You are overlaying $line each time you read a line from <>. SO it will be
the last line from whatever files if any were passed.

Wags ;)

-Original Message-
From: Bob Mangold [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 13:25
To: [EMAIL PROTECTED]
Subject: variable losing it's value


I may have a bug somewhere in my code, but I can't find it. Before I look
again
though please answer this for me.

If I execute:


my ($line) = "hello";
foreach $line (<>){
 . whatever
}
print $line;


Should it print the last line in <> or 'hello'? 

-Bob

__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/



Win32::SetupSup

2001-06-19 Thread Elliott, Don (Police)

Can anyone point me to where I may be able to get the latest version of
Win32::SetupSup. I have read good things about it, but have been unable to
download a version that works. I am using Activestate build 623.

What I want to be able to do is to force a window to have focus and be
displayed on top of all other windows. Does anyone have example code of how
to do this?

I am also interested in being able to check if an application is running
before I launch another copy of the same perl application (without using
lock files).


Thanks in advance. This is a great list, Very helpful


Don Elliott,
Programmer
SPS



Re: variable losing it's value

2001-06-19 Thread Jeff 'japhy' Pinyan

On Jun 19, Bob Mangold said:

>I may have a bug somewhere in my code, but I can't find it. Before I
>look again though please answer this for me.

>my ($line) = "hello";
>foreach $line (<>){
> . whatever
>}
>print $line;
>
>Should it print the last line in <> or 'hello'? 

I don't think the other responders tested their code.  If they had, they'd
see that $line would retain its value.

  my $line = 1;
  for $line (1 .. 10) { ; }
  print $line;  # 1

This is because the looping variable is implicitly localized to the loop
itself.  This is not a bug.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




Re: Anyone know how to pass in parameters to .pl files?

2001-06-19 Thread Chas Owens

On 18 Jun 2001 21:22:56 -0500, Me wrote:

> 
> (I've given up trying to find that last reference,
> having spent far longer looking for it than I have
> on the rest of this email. Maybe someone else
> knows where perldoc for <> is?)
> 
> 

There is more information there, but this is enough to get the picture.


   The null filehandle <> is special: it can be used to
   emulate the behavior of sed and awk.  Input from <> comes
   either from standard input, or from each file listed on
   the command line.  Here's how it works: the first time <>
   is evaluated, the @ARGV array is checked, and if it is
   empty, "$ARGV[0]" is set to "-", which when opened gives
   you standard input.  The @ARGV array is then processed as
   a list of filenames.  The loop

   while (<>) {
   ... # code for each line
   }

   is equivalent to the following Perl-like pseudo code:

   unshift(@ARGV, '-') unless @ARGV;
   while ($ARGV = shift) {
   open(ARGV, $ARGV);
   while () {
   ... # code for each line
   }
   }

   except that it isn't so cumbersome to say, and will
   actually work.  It really does shift the @ARGV array and
   put the current filename into the $ARGV variable.  It also
   uses filehandle ARGV internally--<> is just a synonym for
   , which is magical.  (The pseudo code above doesn't
   work because it treats  as non-magical.)



Self Def

2001-06-19 Thread Nick Transier

Given that I am trying to define an object attribute which is an array of 
references to other object of the same type, how do I define this in the 
$self portion of my sub new constructor? This is what I have, will this 
work? Next is meant to hold an array of pointers or references.

sub new {

my $invocant = shift;
my $class = ref($invocant) || $invocant;
my $self = {
Next,
@_,
};
return bless $self,$class;

}

thanks,
-Nick
_
Get your FREE download of MSN Explorer at http://explorer.msn.com




Re: xml problem

2001-06-19 Thread Chas Owens

Please, please, please, do not try to parse XML with regexps.  They only
work in the simplest cases.  There are perfectly good XML modules
designed to parse XML for you and they are not that hard to use.

The following code parses an XML file similar to the one you described,
but has an additional tag () since XML must have
one and only one root tag.  I added this tag because I thought you have
more than one article per file.  If this is true then the XML you
described is not well formed.  However it would be a simple process to
wrap this tag around the file before attempting to parse it.  If there
is in fact only one article per file then remove the outer foreach and
replace $articles->children with $xmlobj->children.


#!/usr/bin/perl -w

use strict;
use XML::Parser;   #parse XML into an internal format
use XML::SimpleObject; #easy to use forntend to XML::Parse

if (@ARGV != 2) { die "Usage: $0 news.xml index.html" }

my $parser = new XML::Parser (ErrorContext => 2, Style => "Tree");
my $xmlobj = new XML::SimpleObject ($parser->parsefile($ARGV[0]));

open HTML, ">$ARGV[1]" or die "Could not open $ARGV[1]:$!";
select HTML;

print "



News Articles for " . localtime() .  "



";

foreach my $articles ($xmlobj->children) { #get the top tag
   foreach my $article ($articles->children) { #get all articles
  my $file = $article->child('PUB')->value . '-' . 
 $article->child('RUB')->value . '-' .
 $article->child('LEV')->value . '-' .
 $article->child('DAT')->value;
  $file =~ s/[^\w.-]//g; #remove anything not alphanumeric, _, -, or
. 
  open FH, ">$file" or die "Could not open $file:$!";
  print FH $article->child('BRO')->value;
  close FH;
  print 
"", $article->child('ORD')->value, "\n",
"", $article->child('LEV')->value, "\n",
"", $article->child('DAT')->value, "\n",
"", $article->child('PUB')->value, "\n",
"", $article->child('RUB')->value,
"\n","", $article->child('INL')->value,
"\n",
"";
   }
}

print "


";

close HTML;


On 19 Jun 2001 13:34:03 +0100, Nigel Wetters wrote:
> I think I can give you some clues. Here's some code out of the Perl Cookbook (6.8 
>Extracting a Range of Lines), which I've adapted for you. You should be able to nest 
>such structures to get what you want.
> 
> my $extracted_lines = '';
> while (<>) {
> if (/BEGIN PATTERN/ .. /END PATTERN/) {
> # line falls between BEGIN and END in the
> # text, inclusive
> $extracted_lines .= $_;
> } else {
> # now, we're outside the pattern
> process($extracted_lines) if $extracted_lines;
> $extracted_lines = '';
> }
> }
> sub process
> {
> # do stuff with the extracted lines
> # maybe performing more regex's
> }
> 
> >>> Morgan <[EMAIL PROTECTED]> 06/19/01 01:12pm >>>
> Hi
> 
> I'm newbee perl developer and a rookie of xml :(
> 
> Is there anyone who can give me some hints or help me out with a problem
> I have?
> 
> Here is the problem.
> I will recive newsarticles three times a day in xml format and I need to
> automaticly publish those articels on a web page, on the first page it
> should only show the tags down to 
> tag and a link to the whole page.
> 
> Here is a sample of the xml format.
> 
> 
> anbud
> 2001-06-14
> 14-06-01
> DAGENS INDUSTRI
> Dragkamp om förlusttåg
> Here is the indroduction about the article and when the word
> anbud comes up it is enclosed in anbud tags.
> This is the word we use as criteria on the articels we should recive.
> 
> 
> Here comes the rest of the document, thats the whole article.
> The article ends with
> 
> 
> 
> 
> Raven
> 
> 
> 
> This e-mail and any files transmitted with it are confidential 
> and solely for the use of the intended recipient. 
> ONdigital plc, 346 Queenstown Road, London SW8 4DG. Reg No: 3302715. 
> 
--
Today is Setting Orange, the 24th day of Confusion in the YOLD 3167
Wibble.





Please tell your people to stop sending E-mail to me.

2001-06-19 Thread richard kirby

I have unsubscribed to all your supposed E-mail
subscriptions. You you PLEASE pass the word to your 
subscribers to stop sending e-mail to me concerning
Perl. Your subscribers are flooding me e-mail
90+ e-mail a day. I original subscribed to your server
to get some insight into using Perl. I am very sorry
I did so. Once more PLEASE pass the word to the 
people that are connected to your server to QUIT
flooding me with there e-mails, I do not want to here
from them. PLEASE get the word out.

  



__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/



Re: Self Def

2001-06-19 Thread Randal L. Schwartz

> "Nick" == Nick Transier <[EMAIL PROTECTED]> writes:

Nick> Given that I am trying to define an object attribute which is an array
Nick> of references to other object of the same type, how do I define this
Nick> in the $self portion of my sub new constructor? This is what I have,
Nick> will this work? Next is meant to hold an array of pointers or
Nick> references.

Nick> sub new {

Nick>   my $invocant = shift;
Nick>   my $class = ref($invocant) || $invocant;
Nick>   my $self = {
Nick>   Next,
Nick>   @_,
Nick>   };
Nick>   return bless $self,$class;

Nick> }

You need an array ref there, not an array.  Simplest would be a
shallow copy of the invocation list.

sub new {
  my $class = shift; # do NOT use the ref() garbage, please
  my $self = { Next => [@_] };
  bless $self, $class;
}

You might be able to get away with \@_ in place of [@_], but I know
this is safer. :)

See "perldoc perlboot" for more details.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Quick Perl Question

2001-06-19 Thread Jack Lauman



Me wrote:
> 
> Analysis of the code you attached.
> 
> $quote_date = substr($_,0,79);
> 
> The above line is pointless.
> 
---> Agreed.


> The next couple lines are great:
> 
> ($year, $month, $mday, $hour, $minute, $second, $timezone) =
> $quote_date = /^Rates as of (\d+).(\d+).(\d+) (\d+):(\d+):(\d+)
> (\w+) (.*)$/;
> 
> Although as I indicated, you could omit $quote_date and just do:
> 
> ($year, $month, $mday, $hour, $minute, $second, $timezone) =
> /^Rates as of (\d+).(\d+).(\d+) (\d+):(\d+):(\d+) (\w+) (.*)$/;
> 
> The following code is pointless:
> 
> $year   = $1;
> $month  = $2;
> $mday   = $3;
> $hour   = $4;
> $minute = $5;
> $second = $6;
> $timezone   = $7;
> 
> ---
> 
> Then you end the while loop!

---> Disagree, The code is very relavent and allows the manipulation of
the date, time and timezone using Date::Manip before it is written to
the file.

> 
> Everything that follows is working on the last line
> from the file. That makes no sense.
> 
> ---
> 
> Ignoring that, you code makes no sense anyway.
> 
> Your code has statements like this:
> 
>  /^[A-Z]{3} /;
> 
> These do absolutely nothing.
> 

---> Agreed.
> ---
> 
> Try the following and see if it works. Post to the list if there are any
> problems with it.
> 
> while () {
> 
> ($year, $month, $mday, $hour, $minute, $second, $timezone) =
> /^Rates as of (\d+).(\d+).(\d+) (\d+):(\d+):(\d+) (\w+) (.*)$/;
> 
> $year and last; # if we've matched the date line, then bail out.
> 
> eof and print STDERR "Didn't find date line";
> }
> 
> print OUTFILE "$month/$year...";
> 

---> Returns empty strings.

> # Now have date info and we're part way through file
> 
> while () {
> 
> ($cur_sym, $cur_desc, $usd_unit, $units_usd) =
> /^([A-Z]{3})( [A-Za-z]+)+\s+(\d+\.\d+)\s+(\d+\.\d+)\s*$/;
> 

--> Truncates $cur_desc after first word.  Looses the date values.

> # if we've matched a currency line, note that we've started:
> $cur_sym and $started++;
> 
> # if we have not matched a currency line, and we've started,
> # well, then we've ended, and if we haven't started, we need
> # to move on to the next line:
> not $cur_sym and ($started and last) or next;
> 
> # Now we have a matching line. Process variables as required.
> 
> # One variable has one bit of space we don't want:
> substr($cur_desc, 0, 1) = ''; # get rid of leading space.
> }



Re: Self Def

2001-06-19 Thread Nick Transier

The thing is, I want to set the array reference later and not when the 
object is being created.


>From: [EMAIL PROTECTED] (Randal L. Schwartz)
>To: "Nick Transier" <[EMAIL PROTECTED]>
>CC: [EMAIL PROTECTED]
>Subject: Re: Self Def
>Date: 19 Jun 2001 14:12:13 -0700
>
> > "Nick" == Nick Transier <[EMAIL PROTECTED]> writes:
>
>Nick> Given that I am trying to define an object attribute which is an 
>array
>Nick> of references to other object of the same type, how do I define this
>Nick> in the $self portion of my sub new constructor? This is what I have,
>Nick> will this work? Next is meant to hold an array of pointers or
>Nick> references.
>
>Nick> sub new {
>
>Nick>  my $invocant = shift;
>Nick>  my $class = ref($invocant) || $invocant;
>Nick>  my $self = {
>Nick>  Next,
>Nick>  @_,
>Nick>  };
>Nick>  return bless $self,$class;
>
>Nick> }
>
>You need an array ref there, not an array.  Simplest would be a
>shallow copy of the invocation list.
>
> sub new {
>   my $class = shift; # do NOT use the ref() garbage, please
>   my $self = { Next => [@_] };
>   bless $self, $class;
> }
>
>You might be able to get away with \@_ in place of [@_], but I know
>this is safer. :)
>
>See "perldoc perlboot" for more details.
>
>--
>Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
><[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
>Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
>See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl 
>training!

_
Get your FREE download of MSN Explorer at http://explorer.msn.com




Re: variable losing it's value

2001-06-19 Thread Bob Mangold

Thanks, that's what I thought was happening, but now I have another question.
If I 'use strict' (and who doesn't), I am forced to declare $line before the
foreach loop, except I can't just type 'foreach my($line) (<>)'. I have to type
it on a preceeding line. If this is the case then why does perl localize it
anyway. If i'm declaring it before that loop shouldn't its scope carry through
the loop?

-Bob



--- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote:
> On Jun 19, Bob Mangold said:
> 
> >I may have a bug somewhere in my code, but I can't find it. Before I
> >look again though please answer this for me.
> 
> >my ($line) = "hello";
> >foreach $line (<>){
> > . whatever
> >}
> >print $line;
> >
> >Should it print the last line in <> or 'hello'? 
> 
> I don't think the other responders tested their code.  If they had, they'd
> see that $line would retain its value.
> 
>   my $line = 1;
>   for $line (1 .. 10) { ; }
>   print $line;  # 1
> 
> This is because the looping variable is implicitly localized to the loop
> itself.  This is not a bug.
> 
> -- 
> Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
> I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
> Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
> Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
> Acacia Fraternity, Rensselaer Chapter. Brother #734
> **  Manning Publications, Co, is publishing my Perl Regex book  **
> 


__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/



Fwd: Please tell your people to stop sending E-mail to me.

2001-06-19 Thread Rochel Kraus


 I agree!! I've been getting 160+ emails a day and I can't get off this list and it's 
driving me crazy.  If this doesn't stop soon, I am going to have to open up a new 
e-mail account for myself!!! Please unsubscribe me
  richard kirby <[EMAIL PROTECTED]> wrote: Date: Tue, 19 Jun 2001 14:11:43 -0700 (PDT)
From: richard kirby 
Subject: Please tell your people to stop sending E-mail to me.
To: [EMAIL PROTECTED]

I have unsubscribed to all your supposed E-mail
subscriptions. You you PLEASE pass the word to your 
subscribers to stop sending e-mail to me concerning
Perl. Your subscribers are flooding me e-mail
90+ e-mail a day. I original subscribed to your server
to get some insight into using Perl. I am very sorry
I did so. Once more PLEASE pass the word to the 
people that are connected to your server to QUIT
flooding me with there e-mails, I do not want to here
from them. PLEASE get the word out.





__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/


-
Do You Yahoo!?
Yahoo! Buzz Index - Spot the hottest trends in music, movies,and more.


Re: Sorting

2001-06-19 Thread Me

> Could someone tell me how to sort these files?
>
> As you can see they are already sorted in perl, but the problem is .7
is
> suppose to be before 10.
>
> to get this sort i used
> @list_of_files=sort @list_of_files;
>
> sorted EMX-1.15.0.17.37-EMX-1.15.0.17.36.dlcwrap
> sorted EMX-1.15.1.42.10-EMX-1.15.1.42.11.dlcwrap
> sorted EMX-1.15.1.42.10-EMX-1.15.1.42.9.dlcwrap
> sorted EMX-1.15.1.42.23-EMX-1.15.1.42.24.dlcwrap
> sorted EMX-1.15.1.42.24-EMX-1.15.1.42.25.dlcwrap
> sorted EMX-1.15.1.42.25-EMX-1.15.1.42.26.dlcwrap
> sorted EMX-1.15.1.42.7-EMX-1.15.1.42.8.dlcwrap
> sorted EMX-1.15.1.42.9-EMX-1.15.1.42.8.dlcwrap

A plain sort is equivalent to this:

sub stdsort { $a cmp $b };
@sorted = sort stdsort @unsorted;

$a and $b get set to array elements to be compared.
The sort code must return -1 if $a < $b, 0 if they are
the same, or 1 if $a > $b.

You need to do a custom sort procedure:

sub mysort { # compare $a and $b };
@sorted = sort mysort @unsorted;

For more general sort details, see

perldoc -f sort

In your specific case, you might want to separate
the text and numeric bits of $a/$b with a split on
'-' or maybe a regex, then breaking the numeric
down even further by splitting on '.', and then
separately comparing the bits like so:

$abit1 cmp $ bbit1 or
$abit2 <=> $bbit2 or
$abit3 <=> $bbit3 or ...

hth.




Re: Self Def

2001-06-19 Thread Chas Owens

On 19 Jun 2001 16:02:43 -0500, Nick Transier wrote:
> Given that I am trying to define an object attribute which is an array of 
> references to other object of the same type, how do I define this in the 
> $self portion of my sub new constructor? This is what I have, will this 
> work? Next is meant to hold an array of pointers or references.
> 
> sub new {
> 
>   my $invocant = shift;
>   my $class = ref($invocant) || $invocant;
>   my $self = {
>   Next,
>   @_,
>   };
>   return bless $self,$class;
> 
> }
> 
> thanks,
> -Nick


Here is a fairly complete example of a class that uses references to
other objects of the same class (or objects that us its class as a
base).  The attribute '_friends' is a reference to an array.  It can be
accessed in many ways:

#print the first friend's name
print $self->{'_friends'}[0]->name, "\n"

#print all friend's wifes 
foreach $friend ($self->{'_friends'}) {
print $friend->wife, "\n";
}

#print all friend's friend's names
foreach $friend ($self->{'_friends'}) {
foreach $friends_friend ($friend->{_friends}) {
print $friends_friend->name;
}
}

NOTE: The deconstructor (DESTROY) is of utmost importance for classes
that refer to other objects.  In this case $fred points to $barney and
$barney points to $fred.  When $fred goes out of scope the number of
references to it in the garbage collector goes down by one; normally
this would be enough to mark it's memory space for freeing, but $barney
still has a vaild reference to it so the number of references for $fred
goes from 2 to 1 instead of 1 to 0 like it normaly would have.  When
$barney goes out of scope the same thing happens so both $fred's and
$barney's memory spaces will not be freed for use by other objects.
This is known as a "leak" or "memory leak" and having too many off them
can cause your application to crash (look at windows).



#!/usr/bin/perl

use strict;

my $fred   = Cartoon->new;
my $barney = Cartoon->new;

$fred->name('Fred');   #these are attributes they belong
$barney->name('Barney'); #to the objects that hold them

$fred->spouse('Wilma'); #so are these
$barney->spouse('Betty');

$fred->addfriend($barney); #so are these
$barney->addfriend($fred);

Cartoon->town('Bedrock'); #this, however, belongs to both $fred and
$barney

$fred->print_info;
$barney->print_info;

package Cartoon;

{ #class variables and methods
my $town;
sub town { return ($town =  $_[1] || $town);
}
}

sub new {
my $class = shift;
$class= ref($class) || $class;
my $self  =  {
'_name'=> '',
'_spouse'  => '',
'_friends' => [] #empty list constructor
};

return bless $self, $class;
}

sub name {
my ($self, $name) = @_;
return ($self->{_name} = $name || $self->{_name});
}

sub spouse {
my ($self, $spouse) = @_;
return ($self->{_spouse} = $spouse || $self->{_spouse});
}

sub addfriend {
my ($self, $friend) = @_;

#since self->{'_friends'} is a refernece to and array
#we must dereference it with @{} to treat it like an
#array
push @{$self->{'_friends'}}, $friend;
}

sub print_info { 
my $self = shift;

my $name= $self->name;
my $spouse  = $self->spouse;
my $town= ref($self)->town;
my $num_friends = @{$self->{'_friends'}};
my @friends = @{$self->{'_friends'}};
my $friends;

foreach my $friend (@friends) {
#$friend is now a Cartoon object
$friends .=  $friend->name;
}

print "$name lives in $town with $spouse, ",
  "and has $num_friends friends.\n";
print "Their names are: $friends\n" if ($num_friends);
}

sub DESTROY {
my $self = shift;

#IMPORTANT: references to other objects MUST be
#undefined before object goes out of scope otherwise
#it is possible to have a memory leak (ie objects that
#never get garbage collected because they still have
#at least on vaild reference)
undef($self->{'_friends'});
}


--
Today is Setting Orange, the 24th day of Confusion in the YOLD 3167
Fnord.





Re: variable losing it's value

2001-06-19 Thread Chas Owens

The standard idiom is:

foreach my $item (@items) {
}

On 19 Jun 2001 14:41:40 -0700, Bob Mangold wrote:
> Thanks, that's what I thought was happening, but now I have another question.
> If I 'use strict' (and who doesn't), I am forced to declare $line before the
> foreach loop, except I can't just type 'foreach my($line) (<>)'. I have to type
> it on a preceeding line. If this is the case then why does perl localize it
> anyway. If i'm declaring it before that loop shouldn't its scope carry through
> the loop?
> 
> -Bob
> 
> 
> 
> --- Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote:
> > On Jun 19, Bob Mangold said:
> > 
> > >I may have a bug somewhere in my code, but I can't find it. Before I
> > >look again though please answer this for me.
> > 
> > >my ($line) = "hello";
> > >foreach $line (<>){
> > > . whatever
> > >}
> > >print $line;
> > >
> > >Should it print the last line in <> or 'hello'? 
> > 
> > I don't think the other responders tested their code.  If they had, they'd
> > see that $line would retain its value.
> > 
> >   my $line = 1;
> >   for $line (1 .. 10) { ; }
> >   print $line;  # 1
> > 
> > This is because the looping variable is implicitly localized to the loop
> > itself.  This is not a bug.
> > 
> > -- 
> > Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
> > I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
> > Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
> > Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
> > Acacia Fraternity, Rensselaer Chapter. Brother #734
> > **  Manning Publications, Co, is publishing my Perl Regex book  **
> > 
> 
> 
> __
> Do You Yahoo!?
> Spot the hottest trends in music, movies, and more.
> http://buzz.yahoo.com/
> 
--
Today is Setting Orange, the 24th day of Confusion in the YOLD 3167
Frink!





RE: Please tell your people to stop sending E-mail to me.

2001-06-19 Thread Myrian Hernandez

Please, unsubscribe me too.
I can not stand the email flooding anymore.

-Mensaje original-
De: Rochel Kraus [mailto:[EMAIL PROTECTED]]
Enviado el: Martes, 19 de Junio de 2001 16:56
Para: [EMAIL PROTECTED]
Asunto: Fwd: Please tell your people to stop sending E-mail to me.



 I agree!! I've been getting 160+ emails a day and I can't get off this list
and it's driving me crazy.  If this doesn't stop soon, I am going to have to
open up a new e-mail account for myself!!! Please unsubscribe me
  richard kirby <[EMAIL PROTECTED]> wrote: Date: Tue, 19 Jun 2001
14:11:43 -0700 (PDT)
From: richard kirby
Subject: Please tell your people to stop sending E-mail to me.
To: [EMAIL PROTECTED]

I have unsubscribed to all your supposed E-mail
subscriptions. You you PLEASE pass the word to your
subscribers to stop sending e-mail to me concerning
Perl. Your subscribers are flooding me e-mail
90+ e-mail a day. I original subscribed to your server
to get some insight into using Perl. I am very sorry
I did so. Once more PLEASE pass the word to the
people that are connected to your server to QUIT
flooding me with there e-mails, I do not want to here
from them. PLEASE get the word out.





__
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/


-
Do You Yahoo!?
Yahoo! Buzz Index - Spot the hottest trends in music, movies,and more.




Re: Self Def

2001-06-19 Thread Randal L. Schwartz

> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes:

Chas> sub new {
Chas> my $class = shift;
Chas> $class= ref($class) || $class;

PLEASE stop doing this.

I know there's a Very Popular Tutorial included with your
documentation that says that's a Right Way of doing it,
but that's not a consensus amongst all people who've been doing
Perl for a long time, and object programming for Even Longer.

See  for my longer
take on this.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



  1   2   >