Re: Adult content filter in perl

2002-09-23 Thread George Schlossnagle

Warning - the following post contains adult language.

Effectively blocking adult content is really really hard.

First there are simple examples

blocking 'cock' blocks 'John Hancock', and 'Sally Babcock'.

Whereas things like

'suc-my-kock'

will pass many a automated filter.

And these are some of the least original things I can come up with.

Also you have the issue of 'adult words' versus 'adult themes'.  You can 
remove common misspellings of the 'seven dirty words', but it's 
nigh-impossible to filter out things like

'I want to do you doggy-style'

which at least to me is much worse than

'i don't like this shit'

I understand your intention, and think you can make some progress by 
making a profanity filter like

sub filter {
my $text = shift;
my @profanity = ('ass', 'shit', 'fuck',);
map { $text =~ s/\b$_\b//ieg } @profanity;
$text;
}

Or something like that.  Hopefully though, the above demonstrates that 
anyone even mildly interested in sending filthy content can do so
easily.  If you question whether people do this stuff or not, I 
encourage you to check out a community site with a young audience.  
You'ld be astounded at the originality invested in being foul.

George

On Monday, September 23, 2002, at 09:31 PM, Steve Gilbert wrote:

> My daughter has decided to put up a web site that
> she'd like people to email her at. She has an aol
> account at her mothers but I did not want her to give
> out that address. So I set up an account were people
> can email her there and then I have a process that is
> to eliminate any message with "adult content" and any
> files that are executable and only pass files that
> she's expecting. If the message contains no
> executables or adult content then my process will
> foward the message to her aol account.
> With a little help from Kevin Meltzer (Thanks Kevin)
> and his suggestion to use MIME::Parser (MIME::Tools)
> I'm half way there, but I'm a little stuck on how to
> create an effective adult content filter. I thought I
> had seen on here a nifty peice of regexp but I can't
> find it. Anyone have any suggestions?
>
> TIA
>
> Steve
>
> __
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
// George Schlossnagle
// Principal Consultant
// OmniTI, Inc  http://www.omniti.com
// (c) 240.460.5234   (e) [EMAIL PROTECTED]
// 1024D/1100A5A0  1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: creating modules

2002-09-23 Thread Christopher Kruslicky

---  Original Message Details ---
Who: Mat Harris 
What: Re: creating modules 
When: Wednesday 18 September 2002 03:43 pm
--- - - - - - - - - - - - - ---

> actually scrap that. if you could just tell me how to pass configs
> and variables to the module for use in a sub, that would be a great
> help


This was the tutorial that I finally wrapped my brain around and got 
some working module prototypes up with:

http://www.cs.cf.ac.uk/Dave/PERL/node117.html

Hope it helps,
Christopher

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Adult content filter in perl

2002-09-23 Thread Joshua Hoblitt


Steve,

You might want to take a look at Mail::Audit and Mail::SpamAssassin.  SpamAssassin 
seems to work reasonable well but there are will always be a few false positives.  On 
the other hand if you want to re-invent the w to learn something you might want to 
think about using just Mail::Audit (mostly a wrapper around Mail::Internet).

Good Luck,

-J

On Mon, 23 Sep 2002, Steve Gilbert wrote:

> My daughter has decided to put up a web site that
> she'd like people to email her at. She has an aol
> account at her mothers but I did not want her to give
> out that address. So I set up an account were people
> can email her there and then I have a process that is
> to eliminate any message with "adult content" and any
> files that are executable and only pass files that
> she's expecting. If the message contains no
> executables or adult content then my process will
> foward the message to her aol account.
> With a little help from Kevin Meltzer (Thanks Kevin)
> and his suggestion to use MIME::Parser (MIME::Tools)
> I'm half way there, but I'm a little stuck on how to
> create an effective adult content filter. I thought I
> had seen on here a nifty peice of regexp but I can't
> find it. Anyone have any suggestions?
>
> TIA
>
> Steve
>
> __
> Do you Yahoo!?
> New DSL Internet Access from SBC & Yahoo!
> http://sbc.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Adult content filter in perl

2002-09-23 Thread Steve Gilbert

My daughter has decided to put up a web site that
she'd like people to email her at. She has an aol
account at her mothers but I did not want her to give
out that address. So I set up an account were people
can email her there and then I have a process that is
to eliminate any message with "adult content" and any
files that are executable and only pass files that
she's expecting. If the message contains no
executables or adult content then my process will
foward the message to her aol account.
With a little help from Kevin Meltzer (Thanks Kevin)
and his suggestion to use MIME::Parser (MIME::Tools)
I'm half way there, but I'm a little stuck on how to
create an effective adult content filter. I thought I
had seen on here a nifty peice of regexp but I can't
find it. Anyone have any suggestions?

TIA 

Steve

__
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl on AIX Coredump (ODBC / Dynaloader )

2002-09-23 Thread Darren Edgerton

Hi All,

i have:-
Perl 5.6.1
AIX 4.3.3
DBI-1.30
DBD::ODBC-0.43


 very simple DBI script 
#!/usr/local/bin/perl

use DBI;
use DBD::ODBC;

my $dbh = DBI->connect('dbi:ODBC:raider','myuserid','mypasswd');
$dbh->disconnect();
-

when i run this script it exits with error message:
"Illegal Instruction(coredump)"

this is occuring AFTER the disconnect statement
i can in fact query the database, return rows etc no problem - but then it
dumps
core at the end of the script


if i try to debug the corefile, i get .

[root@redbrick] /tmp>dbx /usr/local/bin/perl
Type 'help' for help.
reading symbolic information ...
[using memory image in core]

Illegal instruction (reserved addressing fault) in . at 0x0 ($t1)
0x 000a4c43   Invalid opcode.
(dbx) where
warning: could not locate trace table from starting address 0x0
DynaLoader.() at 0x2001c918
exit(??) at 0xd01779a0
main() at 0x10001054
(dbx) q
[root@redbrick] /tmp>


looks like a NULL pointer relating to the DynaLoader.


so if i turn on DL Debugging ( export PERL_DL_DEBUG=1 ), i get:

DynaLoader.pm loaded (/usr/local/lib/perl5/5.6.1/aix
/usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/aix
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .,
/usr/local/lib /lib /usr/lib /usr/ccs/lib)
DynaLoader::bootstrap for DBI (auto/DBI/DBI.so)
DynaLoader::bootstrap for DBD::ODBC (auto/DBD/ODBC/ODBC.so)
Illegal instruction(coredump)


at this point i dont know what to try next ... so here i am 
any clues 

regards
Darren Edgerton

===
Darren Edgerton
IT Operations Manager
Reece Australia Limited
Ph: +613 9274   Fax: +613 9274 0199
Email: [EMAIL PROTECTED]Web: http://www.reece.com.au
===







-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: FILE COPY

2002-09-23 Thread Timothy Johnson


If you're using Win32 systems then you just have to make sure that you have
a writeable share on the target system.  If you can't get it to copy as the
second name, then you can always just copy and then rename the file.

-Original Message-
From: david [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 11:45 AM
To: [EMAIL PROTECTED]
Subject: re: FILE COPY


William Black wrote:

> Does anyone know how to use the file copy module to past files to remote
> servers?
> 
> i.e.
> 
> server 1:x
> server 2:y
> 

if your os is unix/linux. try if you have scp like:

scp :from_file :to_file

Windos might have something similar

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Having trouble with Win32::Service::GetServices Mod

2002-09-23 Thread Federico, Chris

Thanks Jenda ...


I'm not sure ..What is a reference to the Hash mean ?


Thanks

Chris 


-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 4:05 PM
To: '[EMAIL PROTECTED]'
Subject: Re: Having trouble with Win32::Service::GetServices Mod


From: "Federico, Chris" <[EMAIL PROTECTED]>
>  My code is this :
> 
> I'm just trying to capture my Services on my machine . 
> 
> #!/usr/bin/perl - w
> 
> use Win32::Service;
> use diagnostics;

You forgot

use strict;
 
> my $hostname = hpgwcfede2;

Please enclose your string constants in quotes!

my $hostname = 'hpgwcfede2';

> my %hash;
> 
> 
> Win32::Service::GetServices($hostname,%hash);

You have to pass a reference to a hash, not the hash itself:

Win32::Service::GetServices($hostname,\%hash);

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
Visit our Internet site at http://www.reuters.com

Any views expressed in this message are those of  the  individual
sender,  except  where  the sender specifically states them to be
the views of Reuters Ltd.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Having trouble with Win32::Service::GetServices Mod

2002-09-23 Thread Jenda Krynicky

From: "Federico, Chris" <[EMAIL PROTECTED]>
>  My code is this :
> 
> I'm just trying to capture my Services on my machine . 
> 
> #!/usr/bin/perl - w
> 
> use Win32::Service;
> use diagnostics;

You forgot

use strict;
 
> my $hostname = hpgwcfede2;

Please enclose your string constants in quotes!

my $hostname = 'hpgwcfede2';

> my %hash;
> 
> 
> Win32::Service::GetServices($hostname,%hash);

You have to pass a reference to a hash, not the hash itself:

Win32::Service::GetServices($hostname,\%hash);

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Having trouble with Win32::Service::GetServices Mod

2002-09-23 Thread Federico, Chris


Hi List ,


 My code is this :

I'm just trying to capture my Services on my machine . 

#!/usr/bin/perl - w

use Win32::Service;
use diagnostics;

my $hostname = hpgwcfede2;
my %hash;


Win32::Service::GetServices($hostname,%hash);


When I execute the script it says this :


Uncaught exception from user code:
Usage: Win32::Service::GetServices(lpHostName, hv) at
C:\DOCUME~1\-ACHRI
~1.FED\LOCALS~1\Temp\dir75E.tmp\Delete service.pl line 17.
Press any key to continue . . .


Am I doing something wrong ??

It looks as simple as plugging in a machine name but it looks as thought I'm
my usage is wrong ?

I'm not sure 



Thanks
Chris Federico
Dep:AITS
e-mail : [EMAIL PROTECTED]
(631) 233-6647
Systems Engineer



-
Visit our Internet site at http://www.reuters.com

Any views expressed in this message are those of  the  individual
sender,  except  where  the sender specifically states them to be
the views of Reuters Ltd.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: FILE COPY

2002-09-23 Thread Michael Fowler

On Mon, Sep 23, 2002 at 09:31:25AM -0400, William Black wrote:
> Does anyone know how to use the file copy module to past files to remote 
> servers?

File::Copy is for copying and moving files on the local filesystem.  I'm not
sure why you would be trying to apply it to this problem, or why you'd be
asking us how to apply it to this problem.

You'll want some file transfer protocol, and both ends need to support it. 
For example, if the remote end has an FTP server, you can use Net::FTP to
send the file.  There are other protocols, so you should look to see what
your servers support.


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

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: join hashes?

2002-09-23 Thread david

Sean D. Rowe wrote:

> I know it's a reference to a hash.  What I don't know is why it's printing
> out like this.  I have hash values that I need to print out, but not in

you know it's a reference to a hash. good. the HASH(Ox1c6ed80) thingy is the 
memory address of the reference.

> any order, so I put each hash value that I want to print in a join
> statement in

your hash value is hash reference. consider:

#!/usr/bin/perl -w
use strict;

my $hash;
$hash->{a} = { a => 1};
$hash->{b} = { b => 2};

print join("\n",values %{$hash}),"\n";

__END__

see if you can figure out what prints out. if you don't know what will print 
out from the above, you haven't master reference in perl yet.

not only is $hash a reference to hash. its values are also reference to 
hash!

if you still can't figure out your problem, post the portion of code that 
you suspect is wrong so we can check for you.

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




re: FILE COPY

2002-09-23 Thread david

William Black wrote:

> Does anyone know how to use the file copy module to past files to remote
> servers?
> 
> i.e.
> 
> server 1:x
> server 2:y
> 

if your os is unix/linux. try if you have scp like:

scp :from_file :to_file

Windos might have something similar

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: compression/seek/tell

2002-09-23 Thread david

Robert Citek wrote:

> 
> Hello all,
> 
> Questions:
> How can I tell if a file is compressed (gzip or compress)?
> Can I use seek/tell on a pipe or fifo?
> If not, are there work-arounds?
> 

here is a OS-independent way to check if a file is gzip or not:

#!/usr/bin/perl -w
use strict;

if(is_zip('file.whatever')){
print "is gzip\n";
}else{
print "is not gzip\n";
}

sub is_zip{

my $zip_file = shift;
my $id1 = undef;
my $id2 = undef;

open(GZIP,$zip_file) || die("Unable to open $zip_file: $!");

sysread(GZIP,$id1,1);
sysread(GZIP,$id2,1);

close(GZIP);

return unpack("C",$id1) == 31 && unpack("C",$id2) == 139;
}

__END__

the idea is simple, you check for the GZIP magic header. the GZIP header 
happens to be the first 2 bytes of the gzip file and always have the value 
of 31 and 139. every gzip file starts like that. check the GZIP 
specification for more. once you know the GZIP specification, you can do a 
lot more with the GZIP file.

no, you can't really seek/tell pipe or fifo. pipe and fifo are IPC where 
seek/tell makes no sense. you can't seek/tell something you don't know. you 
never know what's happening at the other end.

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl & MySQL

2002-09-23 Thread david

Dan wrote:

> right, i've had a look into sql and everything, and kinda got to grasp
> with how it works, i've written a trial script to see if it works, but it
> keeps spewing an error:
> 
> DBI->connect(mx:localhost:3306) failed: Access denied for user:
> 'dan@localhost' (Using password: YES) at db.pl line 10
> Can't connect to the DB: Access denied for user: 'dan@localhost' (Using
> password: YES)
> 
> here's the script (real password omitted of course) (the password isn't
> 'YES' either)
> 
> __ START __
> #!/usr/bin/perl
> 
> use strict;
> use DBI;
> 
> my $dsn = 'dbi:mysql:mx:localhost:3306';
> my $user = 'dan';
> my $pass = 'mypassword';
> 
> my $dbh = DBI->connect($dsn, $user, $pass)
>  or die "Can't connect to the DB: $DBI::errstr\n";
> __ END __
> 
> what's wrong?

i don't think that's really a Perl question. it looks like your mysql is not 
accepting the user 'dan' with password ''. better check with your 
db admin first to run if the db is actaully up and running. if it's, then 
manually logon with 'dan' and '' to see what happen. if 
everything works fine from your manually logon, try the script above again.

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Sub Name

2002-09-23 Thread Balint, Jess

Sure I could. And if I were smart, I could of thought of that. Thank you.

-Original Message-
From: Tanton Gibbs [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 2:12 PM
To: Balint, Jess; [EMAIL PROTECTED]
Subject: Re: Sub Name


Can you just make the sub function return an array with the first element
being its name and the second being the data?
- Original Message -
From: "Balint, Jess" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 2:09 PM
Subject: RE: Sub Name


> Well, I am running a bunch of queries. The actual query text is returned
> from a subfunction that is somehow descriptive of what the query actually
> is. I wish to have the function name inserted into an e-mail subject line.
> If I had the name of the function, I could just loop through them all.
>
> Thanks again.
>
> -Original Message-
> From: Wagner, David --- Senior Programmer Analyst --- WGO
> [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 1:35 PM
> To: 'Jenda Krynicky'; '[EMAIL PROTECTED]'
> Subject: RE: Sub Name
>
>
> Are you trying to find out who called you or who you are?  Perl has
> caller which gives info about who I am , who called, etc.
>
> What are you trying to do?
> Wags ;)
>
> -Original Message-
> From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 10:32
> To: '[EMAIL PROTECTED]'
> Subject: Re: Sub Name
>
>
> From: "Balint, Jess" <[EMAIL PROTECTED]>
>
> > Hi all. Is there a way to get a subroutine name into a string? Thanks.
> > Jess
> >
> > sub jess{ }
> >
> > sub name{
> >  $subref = shift;
> >  print $subref;
> > }
> >
> > name( \&jess );
>
> Well, yes. You could search through the namespaces.
>
> But it's gonna be slow.
>
> Why do you want that?
>
> Jenda
> === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
> There is a reason for living. There must be. I've seen it somewhere.
> It's just that in the mess on my table ... and in my brain
> I can't find it.
> --- me
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: perl - good programming principles

2002-09-23 Thread david

Rp C987342 wrote:

> In java, I would be careful in choosing a vector vs arraylist.
> In c/...,  arrays have fixed length. In perl, when I say
> my @arr = ;
> I do not (or cannot?) specify the length of the array even when

this's somehow true. you do not control how big your array is internally. 
even if you say stuff like:

my @array;
@array[0..14] = (0..14);

you do not neccessary get an array with 14 element internally. Perl always 
allocates the size of an array to be power of 2. Programmers coming from 
the C world usually wants to squeeze very bit of performance(memory) out of 
Perl by trying to do things like that. This's perfectly ok but i suggest 
that you don't have to worry about things like that too much. if you 
decided to code something in Perl, go with whatever Perl can provide. have 
fun while programming in Perl. :-)

david

> I know it has only 15 elements.
> 
> So, what I want is about such issues in Perl, if any, that I have to
> be aware of when writing programs in perl.
> 
> thanks.
> 
> _
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Sub Name

2002-09-23 Thread Tanton Gibbs

Can you just make the sub function return an array with the first element
being its name and the second being the data?
- Original Message -
From: "Balint, Jess" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 2:09 PM
Subject: RE: Sub Name


> Well, I am running a bunch of queries. The actual query text is returned
> from a subfunction that is somehow descriptive of what the query actually
> is. I wish to have the function name inserted into an e-mail subject line.
> If I had the name of the function, I could just loop through them all.
>
> Thanks again.
>
> -Original Message-
> From: Wagner, David --- Senior Programmer Analyst --- WGO
> [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 1:35 PM
> To: 'Jenda Krynicky'; '[EMAIL PROTECTED]'
> Subject: RE: Sub Name
>
>
> Are you trying to find out who called you or who you are?  Perl has
> caller which gives info about who I am , who called, etc.
>
> What are you trying to do?
> Wags ;)
>
> -Original Message-
> From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 10:32
> To: '[EMAIL PROTECTED]'
> Subject: Re: Sub Name
>
>
> From: "Balint, Jess" <[EMAIL PROTECTED]>
>
> > Hi all. Is there a way to get a subroutine name into a string? Thanks.
> > Jess
> >
> > sub jess{ }
> >
> > sub name{
> >  $subref = shift;
> >  print $subref;
> > }
> >
> > name( \&jess );
>
> Well, yes. You could search through the namespaces.
>
> But it's gonna be slow.
>
> Why do you want that?
>
> Jenda
> === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
> There is a reason for living. There must be. I've seen it somewhere.
> It's just that in the mess on my table ... and in my brain
> I can't find it.
> --- me
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Sub Name

2002-09-23 Thread Balint, Jess

Well, I am running a bunch of queries. The actual query text is returned
from a subfunction that is somehow descriptive of what the query actually
is. I wish to have the function name inserted into an e-mail subject line.
If I had the name of the function, I could just loop through them all.

Thanks again.

-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 1:35 PM
To: 'Jenda Krynicky'; '[EMAIL PROTECTED]'
Subject: RE: Sub Name


 Are you trying to find out who called you or who you are?  Perl has
caller which gives info about who I am , who called, etc.

What are you trying to do?
Wags ;)

-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 10:32
To: '[EMAIL PROTECTED]'
Subject: Re: Sub Name


From: "Balint, Jess" <[EMAIL PROTECTED]>

> Hi all. Is there a way to get a subroutine name into a string? Thanks.
> Jess
> 
> sub jess{ }
> 
> sub name{
>  $subref = shift;
>  print $subref;
> }
> 
> name( \&jess );

Well, yes. You could search through the namespaces.

But it's gonna be slow.

Why do you want that?

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Sub Name

2002-09-23 Thread Tanton Gibbs

Oops...I missed the point here...ignore my comments...sorry for wasting
bandwidth...I was answering a completely different question.
- Original Message -
From: "Balint, Jess" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 1:11 PM
Subject: Sub Name


> Hi all. Is there a way to get a subroutine name into a string? Thanks.
> Jess
>
> sub jess{ }
>
> sub name{
> $subref = shift;
> print $subref;
> }
>
> name( \&jess );
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Sub Name

2002-09-23 Thread Tanton Gibbs

I've actually used it to implement trace debug statements.

sub foo {
  enter();
  #...do something...
  exit();
}

The enter and exit would use caller to get the name of the function and
print a message.

Now, you can use the Aspect module on CPAN, so there is no real reason to do
that anymore.
- Original Message -
From: "Nikola Janceski" <[EMAIL PROTECTED]>
To: "'Balint, Jess'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 1:23 PM
Subject: RE: Sub Name


> why would you want that? 'use Carp' does something like that, but I think
it
> actually crawls up the stack.
>
> > -Original Message-
> > From: Balint, Jess [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 23, 2002 1:11 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: Sub Name
> >
> >
> > Hi all. Is there a way to get a subroutine name into a string? Thanks.
> > Jess
> >
> > sub jess{ }
> >
> > sub name{
> > $subref = shift;
> > print $subref;
> > }
> >
> > name( \&jess );
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> --
--
> 
> The views and opinions expressed in this email message are the sender's
> own, and do not necessarily represent the views and opinions of Summit
> Systems Inc.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Sub Name

2002-09-23 Thread Wagner, David --- Senior Programmer Analyst --- WGO

 Are you trying to find out who called you or who you are?  Perl has
caller which gives info about who I am , who called, etc.

What are you trying to do?
Wags ;)

-Original Message-
From: Jenda Krynicky [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 10:32
To: '[EMAIL PROTECTED]'
Subject: Re: Sub Name


From: "Balint, Jess" <[EMAIL PROTECTED]>

> Hi all. Is there a way to get a subroutine name into a string? Thanks.
> Jess
> 
> sub jess{ }
> 
> sub name{
>  $subref = shift;
>  print $subref;
> }
> 
> name( \&jess );

Well, yes. You could search through the namespaces.

But it's gonna be slow.

Why do you want that?

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


**
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Sub Name

2002-09-23 Thread Tanton Gibbs

perldoc -f caller
- Original Message - 
From: "Balint, Jess" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 1:11 PM
Subject: Sub Name


> Hi all. Is there a way to get a subroutine name into a string? Thanks.
> Jess
> 
> sub jess{ }
> 
> sub name{
> $subref = shift;
> print $subref;
> }
> 
> name( \&jess );
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Sub Name

2002-09-23 Thread Jenda Krynicky

From: "Balint, Jess" <[EMAIL PROTECTED]>

> Hi all. Is there a way to get a subroutine name into a string? Thanks.
> Jess
> 
> sub jess{ }
> 
> sub name{
>  $subref = shift;
>  print $subref;
> }
> 
> name( \&jess );

Well, yes. You could search through the namespaces.

But it's gonna be slow.

Why do you want that?

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: how to find memory leaks?

2002-09-23 Thread david

Steve Grazzini wrote:

> David <[EMAIL PROTECTED]> wrote:
>> the heap will not go away (because Perl does it's own memory
>> management) until the client exit.).
> 
> Actually, the default config uses libc malloc.

you simply can't free() yourself

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Sub Name

2002-09-23 Thread Nikola Janceski

why would you want that? 'use Carp' does something like that, but I think it
actually crawls up the stack.

> -Original Message-
> From: Balint, Jess [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 1:11 PM
> To: '[EMAIL PROTECTED]'
> Subject: Sub Name
> 
> 
> Hi all. Is there a way to get a subroutine name into a string? Thanks.
> Jess
> 
> sub jess{ }
> 
> sub name{
>   $subref = shift;
>   print $subref;
> }
> 
> name( \&jess );
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Sub Name

2002-09-23 Thread Balint, Jess

Hi all. Is there a way to get a subroutine name into a string? Thanks.
Jess

sub jess{ }

sub name{
$subref = shift;
print $subref;
}

name( \&jess );

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Converting to Hex

2002-09-23 Thread John W. Krahn

James Edward Gray II wrote:
> 
> Is there a simple way, like a one liner perhaps, that will give me the
> octal/hex value of a character?  I need to look certain characters up,
> so I would like to be able to give it something like an 'a' or even
> "\n" and have it answer 141 or 012 (assuming UNIX).  Thanks for your
> time.

my $oct = sprintf '%o', $num;
my $hex = sprintf '%x', $num



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: MySql - Perl question

2002-09-23 Thread Felix Geerinckx

on Sun, 22 Sep 2002 17:06:01 GMT, Mariusz wrote:

> I have a "discount" table that carries percentage discounts that
> should be looked up when the customer submits a discount code and
> taken into calculation of the total price. My table looks something
> like this: 
> 
> field names:|senior|student|...
> values:|0.20|0.50|...

This is bad design. What you want is one table with two fields, like e.g. 
(untested):

CREATE TABLE discounts (
discounttype   CHAR(20) NOT NULL PRIMARY KEY,
discountvalue  FLOAT
);

in which you store the following records:

INSERT INTO discounts VALUES ('senior',  0.20);
INSERT INTO discounts VALUES ('student', 0.50);
# ...

Then you say:

  
my ($d) = $sth->selectrow_array(qq{

SELECT 
discountvalue 
FROM discounts 
WHERE 
discounttype = ?

}, undef, $user_supplied_type);

if (defined $d) {
# $user_supplied_type is in database
} else {
# $user_supplied_type is not in database
}

# 

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Converting to Hex

2002-09-23 Thread Nikola Janceski

check out sprintf() and ord()

quickly for you example:
## hex
perl -e 'printf("%x", ord("\n"))'

## oct
perl -e 'printf("%o", ord("\n"))'



> -Original Message-
> From: James Edward Gray II [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 12:49 PM
> To: [EMAIL PROTECTED]
> Subject: Converting to Hex
> 
> 
> Is there a simple way, like a one liner perhaps, that will 
> give me the 
> octal/hex value of a character?  I need to look certain 
> characters up, 
> so I would like to be able to give it something like an 'a' or even 
> "\n" and have it answer 141 or 012 (assuming UNIX).  Thanks for your 
> time.
> 
> James
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Converting to Hex

2002-09-23 Thread James Edward Gray II

Is there a simple way, like a one liner perhaps, that will give me the 
octal/hex value of a character?  I need to look certain characters up, 
so I would like to be able to give it something like an 'a' or even 
"\n" and have it answer 141 or 012 (assuming UNIX).  Thanks for your 
time.

James


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Why is my array still here?

2002-09-23 Thread Jenda Krynicky

From: "Balint, Jess" <[EMAIL PROTECTED]>

> Hi all. As I have known before, "my" declares a variable that is local
> to a function. My question, why don't I get an undefined in the
> following code example? Shouldn't my @wq be erased after the function
> exits? Thanks. Jess
> 
> sub jess{ my @wq = ( 1, 2, 3, 4 ); \@wq; }
> 
> $r = &jess;
> 
> print $r->[0];

No. Keep in mind, this is Perl, not C. Perl does what you need, not 
what was easiest to implement.

The reason is ... my() variables are not alocated on stack, but on 
heap. Therefore they do not have to be destroyed when you leave the 
function, but, just like all other values, live as long as there is a 
reference to them.

Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
--- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl & MySQl query syntax

2002-09-23 Thread Felix Geerinckx

on Sun, 22 Sep 2002 17:53:29 GMT, Wiggins D'Anconia wrote:

> larry lefthook wrote:
>> my $sth = $dbh->prepare('delete from cl_items WHERE date_time < 
>> $exp_time2 ');
>> 
> 
> You are single quoting your statement which means $exp_time2 is taken 
> literally rather than interpolated should be:
> 
> my $sth = $dbh->prepare("delete from cl_items WHERE date_time < 
> $exp_time2 ");
> 
>> $sth->execute();

Or (even better :-), use a placeholder:

my $sth = $dbh->prepare('delete from cl_items WHERE date_time < ?');
$sth->execute($exp_time2);

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Why is my array still here?

2002-09-23 Thread George Schlossnagle

Because you referenced it outised of the function by assigning it on 
return.  It's reference count is not 0, so it's not elligible for 
garbage collection.

Balint, Jess wrote:

>Hi all. As I have known before, "my" declares a variable that is local to a
>function. My question, why don't I get an undefined in the following code
>example? Shouldn't my @wq be erased after the function exits? Thanks.
>Jess
>
>sub jess{ my @wq = ( 1, 2, 3, 4 ); \@wq; }
>
>$r = &jess;
>
>print $r->[0];
>
>




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Weekly posting statistics - 2002/38

2002-09-23 Thread Felix Geerinckx

Weekly posting statistics for perl.beginners - week 38 of 2002.

>From Monday 2002-09-16 to Sunday 2002-09-22 there were 
507 articles posted (23944 lines) by 127 authors, giving an average 
3.99 articles per author, and an average article length of 47 lpa.
The average number of articles per day was 72.

There were 110 (22%) original articles, and 397 (78%) replies
(articles that started with 'RE:' in their subject line).

50 (39%) authors posted only one article.

The authors top-10 by number of articles is as follows:

 All/Ori Lines  lpa  Author

  47/02160   45  [EMAIL PROTECTED] (David)
  20/0 651   32  [EMAIL PROTECTED] (Sudarshan Raghavan)
  16/01343   83  [EMAIL PROTECTED] (John W. Krahn)
  14/0 773   55  [EMAIL PROTECTED] (Dharmender rai)
  13/1 766   58  [EMAIL PROTECTED] (Nikola Janceski)
  12/0 451   37  [EMAIL PROTECTED] (Michael Fowler)
  12/8 387   32  [EMAIL PROTECTED] (Angerstein)
  11/1 716   65  [EMAIL PROTECTED] (Tony)
  11/1 583   53  [EMAIL PROTECTED] (Timothy Johnson)
  11/4 291   26  [EMAIL PROTECTED] (Rp C987342)

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Why is my array still here?

2002-09-23 Thread Balint, Jess

Hi all. As I have known before, "my" declares a variable that is local to a
function. My question, why don't I get an undefined in the following code
example? Shouldn't my @wq be erased after the function exits? Thanks.
Jess

sub jess{ my @wq = ( 1, 2, 3, 4 ); \@wq; }

$r = &jess;

print $r->[0];


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: join hashes?

2002-09-23 Thread nkuipers

>I don't think I completely understand your code.  When you put
>
>   'join( '|', values %hash )'

That line of code is read pretty much the way it looks.  It's like saying "Ok 
Perl, I want you to grab all the values in this hash and glue 'em together 
with a pipe character".  So for example, a statement like that would be 
assigned to a scalar as a string and you would do something with it.  Your 
string in this case would look like "value|value|value|..."  Values is a 
built-in function.  If you wanted to iterate through the values of a hash you 
would say something like

for (values %hash) {

There is a similar built-in called keys.  You can guess what that does.

Cheers,

Nathanael


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




perl and DB connectivities

2002-09-23 Thread loan tran

Howdy,

Does someone know if there is a function in sybperl
(use Sybase::DBlib) which does exactly the same thing 
of: $data = $sth->fetchrow_hashref (use DBI).

In order words,
when using DBI, i can extract data from Sybase using
this
$sql = qq(select name,dbid from sysdatabases);
while(my $data = $sth->fetchrow_hashref){
   print "DBName: $data{name}\n
  DBId:   $data{dbid}";
}

My question is:
Is there $sth->fetchrow_hashref or something similar
in sybperl (use Sybase::DBlib).

Thanks.
Loan

__
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: client-server with socket

2002-09-23 Thread Bob Showalter

> -Original Message-
> From: Mat Harris [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 4:19 AM
> To: [EMAIL PROTECTED]
> Subject: client-server with socket
> 
> 
> i have got the multithreaded server example from perldoc but 
> i need a client
> that will connect, and upon recieving a certain work from the 
> server, send
> some authentication details and the current ip address of the client.
> 
> this is for a dynamic dns solution. I need to have the client send and
> recieve info to and from the server, but there don't seem to 
> be any examples
> of this 2-way conversation.

I'm not sure I understand the question, but DNS client functionality is
typically a part of your standard OS libraries. (see 'man resolver').
Net::DNS provides a Perl interface to this. You shouldn't try to write your
own resolver, IMO.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: join hashes?

2002-09-23 Thread Rowe, Sean D.

I know it's a reference to a hash.  What I don't know is why it's printing
out like this.  I have hash values that I need to print out, but not in any
order, so I put each hash value that I want to print in a join statement in
the order I need them.  The really strange part is that I also have a print
statement to help me debug  my code, and I print out each hash value.  I
commented out each part that printed a hash value to the screen, and only
left the phrase:
print "Printing hash values: \n";

When it printed, it still printed out a hash reference, like this:

From the GetHdrLine function:
HASH(0x1c6ed80)From the GetHdrLine function:
HASH(0x1ab5300)From the GetHdrLine function:
HASH(0x1c6eda4)From the GetHdrLine function:
HASH(0x1ab52d0)From the GetHdrLine function:
HASH(0x1ab5390)From the GetHdrLine function:
HASH(0x1ab5330)From the GetHdrLine function:
HASH(0x1cbe35c)From the GetHdrLine function:

Why would it do that?  Maybe I'm not being clear, so I can post code if it
would be more helpful.

I don't think I completely understand your code.  When you put 

'join( '|', values %hash )'

what exactly do you mean?  Should I put each hash value that I'm wanting to
print, and then the word %hash?  That doesn't seem to make any sense to me.
I checked out perldoc perlref, but didn't see anything that pertains to
joins, but maybe I'm missing something.  I'm really grateful for your help,
but could you be a bit more specific?  I'd appreciate it.  Thanks.

Sean

-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 5:32 AM
To: [EMAIL PROTECTED]
Subject: Re: join hashes?


"Sean D. Rowe" wrote:
> 
> ( this message was accidentally submitted under the subject RE: getpid?
> Sorry )
> 
> I'm having a very strange problem that I'm hoping someone has come across
> before.  I'm using a hash to collect some field values.  I want to write
the
> hash values to file, and I want them delimited by the '|' character, so I
> use
> 
> my $LineToWrite = join('|', hash_var_1, ..., hash_var_n) . "\n";

my $LineToWrite = join( '|', values %hash ) . "\n";


> I use this hash to get several different lines of field values, so this
last
> statement is in a function that gets called several times. The first time
it
> gets called, everything is fine.  However, each time after, I get
something
> like this at the beginning of the $LineToWrite variable:
> 
> HASH(0x1c67fc4)
> 
> I also printed out each individual hash value, and I can't find anything
> like this.  What's going on?  Any help would be appreciated.  Thanks.

This is a reference to a hash.

perldoc perlref



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




re: FILE COPY

2002-09-23 Thread William Black

Does anyone know how to use the file copy module to past files to remote 
servers?

i.e.

server 1:x
server 2:y

I want to copy the file named foobar from x to y.  Can this be done?



William Black



_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: client-server with socket

2002-09-23 Thread NYIMI Jose (BMB)

> excellent but do i have to re-write the server for this to work?
> 
> > > i need a client that will connect, and upon recieving a certain work from the 
>server ...

You said: "... upon receiving a work ..."

So that means your client is also a kind of server.
Otherwise, I don't know how it will be aware about the work without listening ...


José.


 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl & MySQL

2002-09-23 Thread wiggins

MySQL is complaining about the user "dan" not existing in the database. You need to 
add a record to the mysql:users table for each user you wish to connect to the 
database as.  

MySQL stores all of its permissions stuff as database tables so normal INSERT and 
UPDATE statements will work, but you will have to be a user that has privileges to 
update the "mysql" database on that mysql server (root for example).

Troubleshoot this setup stuff with the actual command line client "mysql" and once you 
can connect as "dan" there then your script should run.

http://danconia.org


On Sun, 22 Sep 2002 23:35:19 +0100, "dan" <[EMAIL PROTECTED]> wrote:

> right, i've had a look into sql and everything, and kinda got to grasp with
> how it works, i've written a trial script to see if it works, but it keeps
> spewing an error:
> 
> DBI->connect(mx:localhost:3306) failed: Access denied for user:
> 'dan@localhost' (Using password: YES) at db.pl line 10
> Can't connect to the DB: Access denied for user: 'dan@localhost' (Using
> password: YES)
> 
> here's the script (real password omitted of course) (the password isn't
> 'YES' either)
> 
> __ START __
> #!/usr/bin/perl
> 
> use strict;
> use DBI;
> 
> my $dsn = 'dbi:mysql:mx:localhost:3306';
> my $user = 'dan';
> my $pass = 'mypassword';
> 
> my $dbh = DBI->connect($dsn, $user, $pass)
>  or die "Can't connect to the DB: $DBI::errstr\n";
> __ END __
> 
> what's wrong?
> 
> dan
> 
> "Wiggins D'Anconia" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > First off for those MySQL newbies in the crowd you might find this
> > helpful, I compiled it a while ago but I am pretty sure it is still
> > accurate:
> >
> > http://www.residualselfimage.com/mysql_pkt_ref/
> >
> > Essentially you need to start with the mysql documentation, or a
> > beginners guide on that, then check out
> >
> > perldoc DBI (http://search.cpan.org/author/TIMB/DBI-1.30/DBI.pm)
> >
> > DBI lets you connect to the database and send queries to it.  Queries
> > being just about any SQL (including create and drop tables, selects,
> > updates, inserts, etc.)
> >
> > Once you have a handle (no pun intended) on how DBI works what you can
> > do is pretty much limitless (again no pun intended) (at least within the
> > confines of Perl, which at times appear limitless :-)).
> >
> > I would give it a try and the post specific questions after looking into
> > DBI.
> >
> > http://danconia.org/
> >
> > dan wrote:
> > > I'm in the process of writing IRC Services in Perl. I know most of you
> won't
> > > know anything about IRC in this aspect at least. However what I need
> help
> > > with is being able to store the services' data in a MySQL database. I
> know
> > > absolutely nothing about MySQL. At the moment it's using a flat text
> file
> > > database, and it gets sluggish at points when it starts saving. So I
> thought
> > > it may be easier/faster reading from a MySQL database. Since I know
> nothing
> > > about MySQL, how would I go about:
> > > a) creating the "tables" for the services to read, and how to put
> different
> > > bits of data there, and how to call them back without having to foreach
> > > through a big list?
> > > b) writing the code so perl connects to MySQL and stays connected for
> the
> > > entire time the process is live, so it can read/write data from/to the
> > > database
> > > c) making a web accessible interface to use the same database as the
> > > services, to provide real-time live statistics to the web, to enable
> website
> > > users to view certain portions of the database
> > >
> > > All help muchly appreciated
> > >
> > > Dan
> > >
> > >
> > >
> >
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: client-server with socket

2002-09-23 Thread Mat Harris

excellent but do i have to re-write the server for this to work?

On Mon, Sep 23, 2002 at 12:30:57 +0200, NYIMI Jose (BMB) wrote:
> use a special forking form of open :
> 
> The open function, when passed as its second argument either "-|" or
> "|-" will implicitly pipe and fork. This makes the piping code above
> slightly easier. The child talks to the parent over STDIN or STDOUT,
> depending on whether "-|" or "|-" was used.
> 
> 
> Example ( Not tested ...) :
> 
> #!/usr/bin/perl -w
> # biclient - bidirectional forking client
> 
> use strict;
> use IO::Socket;
> my ($host, $port, $kidpid, $sock, $line, $from_parent, $auth, $ip);
> 
> unless (@ARGV == 2) { die "usage: $0 host port" }
> ($host, $port) = @ARGV;
> 
> # create a tcp connection to the specified host and port
> my $sock = IO::Socket::INET->new(  Proto => "tcp",
> PeerAddr  => $host,
> PeerPort  => $port)
>or die "can't connect to port $port on $host: $!";
> 
> 
> $sock->autoflush(1);  # so output gets there right away
> 
> print STDERR "[Connected to $host:$port]\n";
> 
> # split the program into two processes, identical twins
> $kidpid = open(CHILD, "|-") || die "can't open/fork: $!";
> 
> if ($kidpid) {
>   # run parent code, reading from socket
>   # and writing to child
>   while (defined ($work = <$sock>)) {
> print CHILD $work;
>   }
>   kill("TERM" => $kidpid);# send SIGTERM to child
> }
> else {
>   # otherwise run child code here, reading from parent
>   # and writing to your socket
>   if ($from_parent = ){
>   $auth=&get_auth;
>   $ip=&get_ip;
>   print $sock "ip=$ip";
>   print $sock "auth=$auth";
>   };  
>   exit;
> }
> exit;
> 
> sub get_auth{
>   #write your auth code here
> }
> 
> sub get_ip{
>   #write your code here that return the your ip
> }
> 
> __END__
> 
> 
> > -Original Message-
> > From: Mat Harris [mailto:[EMAIL PROTECTED]] 
> > Sent: Monday, September 23, 2002 10:19 AM
> > To: [EMAIL PROTECTED]
> > Subject: client-server with socket
> > 
> > 
> > i have got the multithreaded server example from perldoc but 
> > i need a client that will connect, and upon recieving a 
> > certain work from the server, send some authentication 
> > details and the current ip address of the client.
> > 
> > this is for a dynamic dns solution. I need to have the client 
> > send and recieve info to and from the server, but there don't 
> > seem to be any examples of this 2-way conversation.
> > 
> > -- 
> > Mat Harris  OpenGPG Public Key ID: C37D57D9
> > [EMAIL PROTECTED]matthewh.genestate.com  
> > 
> 
> 
>  DISCLAIMER 
> 
> "This e-mail and any attachment thereto may contain information which is 
>confidential and/or protected by intellectual property rights and are intended for 
>the sole use of the recipient(s) named above. 
> Any use of the information contained herein (including, but not limited to, total or 
>partial reproduction, communication or distribution in any form) by other persons 
>than the designated recipient(s) is prohibited. 
> If you have received this e-mail in error, please notify the sender either by 
>telephone or by e-mail and delete the material from any computer".
> 
> Thank you for your cooperation.
> 
> For further information about Proximus mobile phone services please see our website 
>at http://www.proximus.be or refer to any Proximus agent.

-- 
Mat Harris  OpenGPG Public Key ID: C37D57D9
[EMAIL PROTECTED]matthewh.genestate.com  



msg30936/pgp0.pgp
Description: PGP signature


Re: RegEx prob.

2002-09-23 Thread Janek Schleicher

Zielinski Daniel wrote at Mon, 23 Sep 2002 13:53:54 +0200:

> Got following problem:
> 
> Want to substitute roman digits (I...) with arabic(1...):
> 
> $corr_line="Vol. I, parte speciale" (example, position of I may
> vary)
> $corr_line=~s/(>| |,|;)I( |,|;|:|\n)/$11$2/;
> 
> I think that I have to interpolate the variables but don't know how.
> Can anybody give me a hint?

If I understand you correctly,
you want to substitite character looking like roman digits
to arabic ones.
The looking like depends also on some character before and
after the digits.

First, let's group the characters surrounding these digits
with character classes:
before are [> ,;] (perhaps it's better to say [>\s,;])
after could be [: ,;\n] (perhaps it's better to say [:\s,;])

That would yield a substituation like
(with the trick of lookahead and lookbehind assertions,
 look perldoc perlre for details):

$corr_line =~ s/(?<=[> ,;])I(?=[:\s,;])/1/;


In a more generalized way,
I would suggest to use existing modules for conversions,
e.g. the CPAN-module roman:

use Roman;
$corr_line =~ s{(?<=[> ,;])([IVXCLM]+)(?=[: ,;\n])}
   {isroman($1) ? arabic($1) : $1}ge;


Best Wishes,
Janek


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: RegEx prob.

2002-09-23 Thread Jeff 'japhy' Pinyan

On Sep 23, Zielinski Daniel (P) said:

>$corr_line=~s/(>| |,|;)I( |,|;|:|\n)/$11$2/;

Perl sees "$11$2" as two variables -- $11 and $2.  You want "${1}1$2",
which makes Perl separate the $1 from the 1.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: s/// in a list <-- How to do it ?

2002-09-23 Thread Steve Grazzini

Sky <[EMAIL PROTECTED]> wrote:
> foreach $keys (keys $listing) {
>   $listing{$keys}=~ s/data\///gi;
> }
> 
> ? :)
> 

s|data/||gi for values %listing;
   ^

-- 
Steve

perldoc -qa.j | perl -lpe '($_)=m("(.*)")'

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RegEx prob.

2002-09-23 Thread Zielinski Daniel (P)

Hi!

Got following problem:

Want to substitute roman digits (I...) with arabic(1...):

$corr_line="Vol. I, parte speciale" (example, position of I may
vary)
$corr_line=~s/(>| |,|;)I( |,|;|:|\n)/$11$2/;

I think that I have to interpolate the variables but don't know how.
Can anybody give me a hint?

Thanks, Daniel





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: client-server with socket

2002-09-23 Thread NYIMI Jose (BMB)

use a special forking form of open :

The open function, when passed as its second argument either "-|" or
"|-" will implicitly pipe and fork. This makes the piping code above
slightly easier. The child talks to the parent over STDIN or STDOUT,
depending on whether "-|" or "|-" was used.


Example ( Not tested ...) :

#!/usr/bin/perl -w
# biclient - bidirectional forking client

use strict;
use IO::Socket;
my ($host, $port, $kidpid, $sock, $line, $from_parent, $auth, $ip);

unless (@ARGV == 2) { die "usage: $0 host port" }
($host, $port) = @ARGV;

# create a tcp connection to the specified host and port
my $sock = IO::Socket::INET->new(  Proto => "tcp",
PeerAddr  => $host,
PeerPort  => $port)
   or die "can't connect to port $port on $host: $!";


$sock->autoflush(1);  # so output gets there right away

print STDERR "[Connected to $host:$port]\n";

# split the program into two processes, identical twins
$kidpid = open(CHILD, "|-") || die "can't open/fork: $!";

if ($kidpid) {
# run parent code, reading from socket
# and writing to child
while (defined ($work = <$sock>)) {
print CHILD $work;
}
kill("TERM" => $kidpid);# send SIGTERM to child
}
else {
# otherwise run child code here, reading from parent
# and writing to your socket
if ($from_parent = ){
$auth=&get_auth;
$ip=&get_ip;
print $sock "ip=$ip";
print $sock "auth=$auth";
};  
exit;
}
exit;

sub get_auth{
#write your auth code here
}

sub get_ip{
#write your code here that return the your ip
}

__END__


> -Original Message-
> From: Mat Harris [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, September 23, 2002 10:19 AM
> To: [EMAIL PROTECTED]
> Subject: client-server with socket
> 
> 
> i have got the multithreaded server example from perldoc but 
> i need a client that will connect, and upon recieving a 
> certain work from the server, send some authentication 
> details and the current ip address of the client.
> 
> this is for a dynamic dns solution. I need to have the client 
> send and recieve info to and from the server, but there don't 
> seem to be any examples of this 2-way conversation.
> 
> -- 
> Mat HarrisOpenGPG Public Key ID: C37D57D9
> [EMAIL PROTECTED]  matthewh.genestate.com  
> 


 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: inputs to my script.

2002-09-23 Thread Robin Cragg

OK.

Now I get it.

How about:

my ($str1, $str2,$lb1,@comment) = @ARGV;

That will accept a multi-word comment as the last arguement. You then have:

if (scalar @comment < 1) {
 usage ();
}


R

At 15:41 23/09/2002 +0530, Javeed SAR wrote:

>Yes exactly,How to check it in script, i don't want  the input to be 
>given  in quotes (that is from command line).
>Script has to accept it without quotes.
>I want to make changes in script.
>
>my script is as follows:
>
>my ($str1, $str2,$lb1,$comment) = @ARGV;
>
>
>-Original Message-
>From: Robin Cragg 
>[mailto:[EMAIL PROTECTED]]
>Sent: Monday, September 23, 2002 3:34 PM
>To: Javeed SAR; [EMAIL PROTECTED]
>Subject: Re: inputs to my script.
>
>If you want multiple words to be treated as one argument, just enclose them
>in quotes...
>
>R
>
>At 15:26 23/09/2002 +0530, Javeed SAR wrote:
> >Hi all,
> >
> >I am giving 4 command line inputs to  my script.
> >I want to give the 4 input($com) which has spaces in it input, eg: Hello 
> how
> >do you do
> >How should i take the bold font as single input??
> >How should i check it in my script?
> >
> >if( scalar(@ARGV) != 4 ) {
> >   print "Enough Arguments are not given.\n";
> >   print "Usage: program (Int View) (Label View) (Label Lock) (Checkin
> >Comments)\n";
> >   exit(0);
> >}
> >
> >
> >j


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: inputs to my script.

2002-09-23 Thread Javeed SAR


Yes exactly,How to check it in script, i don't want  the input to be given
in quotes (that is from command line).
Script has to accept it without quotes.
I want to make changes in script.

my script is as follows:

my ($str1, $str2,$lb1,$comment) = @ARGV;



-Original Message-
From: Robin Cragg [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 3:34 PM
To: Javeed SAR; [EMAIL PROTECTED]
Subject: Re: inputs to my script.


If you want multiple words to be treated as one argument, just enclose them 
in quotes...


R

At 15:26 23/09/2002 +0530, Javeed SAR wrote:
>Hi all,
>
>I am giving 4 command line inputs to  my script.
>I want to give the 4 input($com) which has spaces in it input, eg: Hello
how
>do you do
>How should i take the bold font as single input??
>How should i check it in my script?
>
>if( scalar(@ARGV) != 4 ) {
>   print "Enough Arguments are not given.\n";
>   print "Usage: program (Int View) (Label View) (Label Lock) (Checkin
>Comments)\n";
>   exit(0);
>}
>
>
>j



Re: inputs to my script.

2002-09-23 Thread Robin Cragg

If you want multiple words to be treated as one argument, just enclose them 
in quotes...


R

At 15:26 23/09/2002 +0530, Javeed SAR wrote:
>Hi all,
>
>I am giving 4 command line inputs to  my script.
>I want to give the 4 input($com) which has spaces in it input, eg: Hello how
>do you do
>How should i take the bold font as single input??
>How should i check it in my script?
>
>if( scalar(@ARGV) != 4 ) {
>   print "Enough Arguments are not given.\n";
>   print "Usage: program (Int View) (Label View) (Label Lock) (Checkin
>Comments)\n";
>   exit(0);
>}
>
>
>j


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




inputs to my script.

2002-09-23 Thread Javeed SAR

Hi all,

I am giving 4 command line inputs to  my script.
I want to give the 4 input($com) which has spaces in it input, eg: Hello how
do you do
How should i take the bold font as single input??
How should i check it in my script?

if( scalar(@ARGV) != 4 ) {
  print "Enough Arguments are not given.\n";
  print "Usage: program (Int View) (Label View) (Label Lock) (Checkin
Comments)\n";
  exit(0);
}


j




Re: embed Perl in HTML

2002-09-23 Thread Robert Rendler

On Sun, 22 Sep 2002 23:53:37 -0400
Jim Lundeen <[EMAIL PROTECTED]> wrote:

> I use Dreamweaver and would like to embed Perl code within my HTML, much
> like one would embed PHP code within HTML, and still be able to visually
> manipulate my HTML/Perl file with Dreamweaver.Any suggestions?

>From the top of my head:
HTML::Mason - http://www.masonhq.com
HTML::Embperl - http://perl.apache.org/embperl/
--
vis tecum sit.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: s/// in a list <-- How to do it ?

2002-09-23 Thread Sky

foreach $keys (keys $listing) {
  $listing{$keys}=~ s/data\///gi;
}

? :)



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




embed Perl in HTML

2002-09-23 Thread Jim Lundeen

I use Dreamweaver and would like to embed Perl code within my HTML, much
like one would embed PHP code within HTML, and still be able to visually
manipulate my HTML/Perl file with Dreamweaver.Any suggestions?
Thanks   -Jim



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Perl & MySQL

2002-09-23 Thread dan

right, i've had a look into sql and everything, and kinda got to grasp with
how it works, i've written a trial script to see if it works, but it keeps
spewing an error:

DBI->connect(mx:localhost:3306) failed: Access denied for user:
'dan@localhost' (Using password: YES) at db.pl line 10
Can't connect to the DB: Access denied for user: 'dan@localhost' (Using
password: YES)

here's the script (real password omitted of course) (the password isn't
'YES' either)

__ START __
#!/usr/bin/perl

use strict;
use DBI;

my $dsn = 'dbi:mysql:mx:localhost:3306';
my $user = 'dan';
my $pass = 'mypassword';

my $dbh = DBI->connect($dsn, $user, $pass)
 or die "Can't connect to the DB: $DBI::errstr\n";
__ END __

what's wrong?

dan

"Wiggins D'Anconia" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> First off for those MySQL newbies in the crowd you might find this
> helpful, I compiled it a while ago but I am pretty sure it is still
> accurate:
>
> http://www.residualselfimage.com/mysql_pkt_ref/
>
> Essentially you need to start with the mysql documentation, or a
> beginners guide on that, then check out
>
> perldoc DBI (http://search.cpan.org/author/TIMB/DBI-1.30/DBI.pm)
>
> DBI lets you connect to the database and send queries to it.  Queries
> being just about any SQL (including create and drop tables, selects,
> updates, inserts, etc.)
>
> Once you have a handle (no pun intended) on how DBI works what you can
> do is pretty much limitless (again no pun intended) (at least within the
> confines of Perl, which at times appear limitless :-)).
>
> I would give it a try and the post specific questions after looking into
> DBI.
>
> http://danconia.org/
>
> dan wrote:
> > I'm in the process of writing IRC Services in Perl. I know most of you
won't
> > know anything about IRC in this aspect at least. However what I need
help
> > with is being able to store the services' data in a MySQL database. I
know
> > absolutely nothing about MySQL. At the moment it's using a flat text
file
> > database, and it gets sluggish at points when it starts saving. So I
thought
> > it may be easier/faster reading from a MySQL database. Since I know
nothing
> > about MySQL, how would I go about:
> > a) creating the "tables" for the services to read, and how to put
different
> > bits of data there, and how to call them back without having to foreach
> > through a big list?
> > b) writing the code so perl connects to MySQL and stays connected for
the
> > entire time the process is live, so it can read/write data from/to the
> > database
> > c) making a web accessible interface to use the same database as the
> > services, to provide real-time live statistics to the web, to enable
website
> > users to view certain portions of the database
> >
> > All help muchly appreciated
> >
> > Dan
> >
> >
> >
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Seek ideas, module(s) for url database/indexer

2002-09-23 Thread Alan C.

Hello,

In contrast to bookmarked web site pages, I may want ability instead to
store these urls in some sort of a text file or files or database of some
sorts.  I'd also use a keyword(s) associated with each url.

My idea is, for my more frequently used urls, to have an organized index
that I can click on one of the sites.  Also a part of that, for infrequently
visited sites, would be ability to search using keyword(s)

Perl cgi might work then just bring the search results listed by keyword
categories, bring up in web browser.  I speak of my local machine only.  I
have Apache as well as Perl.

I use both MS Windows and I learning Linux Red Hat 7.3

What Perl module(s) might already written for this type of task?

Ideas?  Suggestions?

I a beginner knows enuff can (sometimes) write my interface to a module.

--
Thanks.  Alan.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: background process

2002-09-23 Thread dan

i use a forking mechanism to fork irc services to the background, and it
goes like this:

___ START ___
use strict;
use POSIX;
# run in background?
# 1 = yes, 0 = no
$daemon = 1;

if($daemon) {
  exit if fork;
  POSIX::setsid();
}
# script goes here
___ END ___

works perfectly well for me :)

dan

"Paul Tremblay" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am writing a script in perl to backup my system, and would like to run
> a backgroud process to burn each CD as it is created.
>
> Right now I use this command
>
> my $fail=system "tar -vr -T $files_to_back -f $tar_file";
>
> to create a tar file. If the tar file is bigger than 650 M, then I will
> have to use split to split it into chunks. Needless to say, if backing
> up my whole hardrive, I will have many chunks. In fact, if my hardrive
> contains 10 G of info, I would need 10G of extra space just to run my
> script.
>
> So I want to create a background process. (I believe this is what I have
> to do, anyway.) I want tar to create 650M of info, and then stop while I
> create a disk image, burn the image, and then remove the image.
>
> I have looked in *Perl Cookbook,* but I couldn't really find any way to
> do this.
>
> I believe doing what I want is possible. There is a relativley simple
> script called backuponcd that does just this. But the script is written
> as a bash script, and I can't quite figure out what is going on.
>
> Thanks
>
> Paul
>
> PS I feel like I am re-inventing the wheel. I am sure there are a million
> good scripts and programs out there to backup. But I either can't get
> them to run, or they don't quite offer quite the ability to customize
> that I want.
>
> I would like the ability to append new files to old ones.
> For example, if I am working on a document called "my_story.txt", I
> will edit this story every day for several weeks. I want each version to
be on a CD--in other words, there would be 21 copies of this story if I
edited every day for three weeks. After all, I might do some bad editing on
day 18 and really wish that I had a copy of the story that I did on day 15.
>
>
> Anyone know of a *well-documented* perl script that does what I want?
>
> --
>
> 
> *Paul Tremblay *
> *[EMAIL PROTECTED]*
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: log window

2002-09-23 Thread Mat Harris

have the script write to a temporary log file and then just tail it. simple
but effective.

On Mon, Sep 23, 2002 at 10:23:17 +0100, [EMAIL PROTECTED] wrote:
> Hi all
> 
> any thoughts on how to approach this
> 
> I have several perl scripts running and i would like to be able to open up
> a log window from within the script and then dump log issues into it for
> viewing
> 
> os = unix
> 
> bit like a tail -f concept  but in a seperate window to that which the
> parent script is running
> 
> any thoughts much appreciated
> 
> Steve
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Mat Harris  OpenGPG Public Key ID: C37D57D9
[EMAIL PROTECTED]matthewh.genestate.com  



msg30920/pgp0.pgp
Description: PGP signature


log window

2002-09-23 Thread Steven_Massey

Hi all

any thoughts on how to approach this

I have several perl scripts running and i would like to be able to open up
a log window from within the script and then dump log issues into it for
viewing

os = unix

bit like a tail -f concept  but in a seperate window to that which the
parent script is running

any thoughts much appreciated

Steve



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




client-server with socket

2002-09-23 Thread Mat Harris

i have got the multithreaded server example from perldoc but i need a client
that will connect, and upon recieving a certain work from the server, send
some authentication details and the current ip address of the client.

this is for a dynamic dns solution. I need to have the client send and
recieve info to and from the server, but there don't seem to be any examples
of this 2-way conversation.

-- 
Mat Harris  OpenGPG Public Key ID: C37D57D9
[EMAIL PROTECTED]matthewh.genestate.com  



msg30918/pgp0.pgp
Description: PGP signature


Re: Filename modification

2002-09-23 Thread Tanton Gibbs

> ($filename,$fileExtention)=fileparse($moofile, '\..*');
> open (OUTFILE1, ">$filename_TEMP.LOG");
> 

Perl thinks you are trying to access a variable named
$filename_TEMP.  What you want to say is
open( OUTFILE1, ">${filename}_TEMP.LOG" );

HTH,
Tanton


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Filename modification

2002-09-23 Thread John W. Krahn

Henry Wong wrote:
> 
> Actually, my code is something like this:
> 
> print "\n\n\nPLEASE ENTER REQUIRED .LOG FILE:";
> $file = ;
> chomp ($file);
> open (INFILE1, "$file");
> 
> So how can I use the $file variable to be splitted from its *.log and then
> subsequently using it for appending to a "$file_temp.txt" format? Coz when i
> print the $file, it gives me "xxx.log", which i actually want. But i only
> want the front portion "xxx" and not the ".log" later when i create new
> files like 'xxx_temp.txt'. Pls advise, thanks.


use File::Basename;

print "\n\n\nPLEASE ENTER REQUIRED .LOG FILE:";
chomp( my $file =  );
open INFILE1, $file or die "Cannot open $file: $!";

my ($name) = fileparse( $file, '\..*' );

my $temp_file = "${name}_temp.txt";




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Filename modification

2002-09-23 Thread Henry Wong

Hi all, thanks for everyone's contribution to this small question. However,
i now face this problem:
After typing the following code:

($filename,$fileExtention)=fileparse($moofile, '\..*');
open (OUTFILE1, ">$filename_TEMP.LOG");

It didn't seem to work.. i tried printing the "$filename" and it works as we
expected, but however when i try creating a new file like the above code
with a $filename_TEMP, i can't seem to print/create them out? Why is this
so? I tried printing "$filename_TEMP", nothing comes out; but if i were to
print juz "$filename", the filename comes out smoothly. Pls advise?

Regards,

~ HENRY WONG ~


- Original Message -
From: "NYIMI Jose (BMB)" <[EMAIL PROTECTED]>
To: "Henry Wong" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 3:20 PM
Subject: RE: Filename modification


Give a look to File::Basename module.

http://search.cpan.org/author/JHI/perl-5.8.0/lib/File/Basename.pm

José.

> -Original Message-
> From: Henry Wong [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 9:17 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Filename modification
>
>
> Actually, my code is something like this:
>
> print "\n\n\nPLEASE ENTER REQUIRED .LOG FILE:";
> $file = ;
> chomp ($file);
> open (INFILE1, "$file");
>
> So how can I use the $file variable to be splitted from its
> *.log and then subsequently using it for appending to a
> "$file_temp.txt" format? Coz when i print the $file, it gives
> me "xxx.log", which i actually want. But i only want the
> front portion "xxx" and not the ".log" later when i create
> new files like 'xxx_temp.txt'. Pls advise, thanks.
>
>
> Regards,
>
> ~ HENRY WONG ~
>
> - Original Message -
> From: "Dharmender Rai" <[EMAIL PROTECTED]>
> To: "Henry Wong" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Monday, September 23, 2002 2:53 PM
> Subject: Re: Filename modification
>
>
> > Read the name of the file from STDIN. Assign it to
> > some scalar variable. Using that variable, you can
> > open this file. You can have other scalar variable
> > that can be assigned the name of this file appended
> > with whatever you want (like "_temp" etc) and eiher
> > open it (if it is there) or create it.
> >
> >Read about "open" and "close" functions.
> >
> >
> >
> >  --- Henry Wong <[EMAIL PROTECTED]> wrote: > Hi all,
> > a simple question...
> > > How to do a coding that takes in your filename and
> > > then using that filename
> > > for further uses?
> > >
> > > E.g. user is asked to enter a filename. User enters
> REX.log. Program
> > > will then use the name REX.log for future file
> > > extension/usage by creating
> > > various REX files like REX_temp.txt, REX_data.log,
> > > REX_arranged.log,etc
> > > ,etc... in other words, how do i make the  to
> > > be dynamic so that my
> > > program can use the input filenames for file
> > > saving/modification/etc?
> > >
> > >
> > > Regards,
> > >
> > > ~ HENRY WONG ~
> > >
> > >
> > > This e-mail is intended only for the named
> > > addressee(s) and may contain confidential and/or
> > > privileged information. If you are not the named
> > > addressee (or have received this e-mail in error),
> > > please notify the sender immediately and destroy
> > > this e-mail. The unauthorised use, disclosure,
> > > distribution or copying of the contents in this
> > > e-mail is strictly prohibited."
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> >
> > __
> > Do You Yahoo!?
> > Everything you'll ever need on one web page
> > from News and Sport to Email and Music Charts http://uk.my.yahoo.com
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> This e-mail is intended only for the named addressee(s) and
> may contain confidential and/or privileged information. If
> you are not the named addressee (or have received this e-mail
> in error), please notify the sender immediately and destroy
> this e-mail. The unauthorised use, disclosure, distribution
> or copying of the contents in this e-mail is strictly prohibited."
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is
confidential and/or protected by intellectual property rights and are
intended for the sole use of the recipient(s) named above.
Any use of the information contained herein (including, but not limited to,
total or partial reproduction, communication or distribution in any form) by
other persons than the designated recipient(s) is prohibited.
If you have received this e-mail in error, please notify the sender either
by telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone service

Re: Filename modification

2002-09-23 Thread Sudarshan Raghavan

On Mon, 23 Sep 2002, Henry Wong wrote:

> Actually, my code is something like this:
> 
> print "\n\n\nPLEASE ENTER REQUIRED .LOG FILE:";
> $file = ;
> chomp ($file);
> open (INFILE1, "$file");
> 
> So how can I use the $file variable to be splitted from its *.log and then
> subsequently using it for appending to a "$file_temp.txt" format? Coz when i
> print the $file, it gives me "xxx.log", which i actually want. But i only
> want the front portion "xxx" and not the ".log" later when i create new
> files like 'xxx_temp.txt'. Pls advise, thanks.

Well, then why do you want to accept the input as xxx.log. Why not just 
xxx. 

The simplest way would be to split,
$file = ;
chomp ($file);
($file) = split (/\./, $file); # perldoc -f split

Now $file will contain the xxx part of your xxx.log. But this assumes that 
input will not be of this form 'xxx.yyy.log'. One possible way to handle 
this scenario
$file =~ s/\.log$//; # perldoc perlretut, perldoc perlre

I would suggest you read through the docs of the modules too
File::Basename (perldoc File::Basename)
File::Spec (perldoc File::Spec)



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Filename modification

2002-09-23 Thread NYIMI Jose (BMB)

Give a look to File::Basename module.

http://search.cpan.org/author/JHI/perl-5.8.0/lib/File/Basename.pm

José.

> -Original Message-
> From: Henry Wong [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, September 23, 2002 9:17 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Filename modification
> 
> 
> Actually, my code is something like this:
> 
> print "\n\n\nPLEASE ENTER REQUIRED .LOG FILE:";
> $file = ;
> chomp ($file);
> open (INFILE1, "$file");
> 
> So how can I use the $file variable to be splitted from its 
> *.log and then subsequently using it for appending to a 
> "$file_temp.txt" format? Coz when i print the $file, it gives 
> me "xxx.log", which i actually want. But i only want the 
> front portion "xxx" and not the ".log" later when i create 
> new files like 'xxx_temp.txt'. Pls advise, thanks.
> 
> 
> Regards,
> 
> ~ HENRY WONG ~
> 
> - Original Message -
> From: "Dharmender Rai" <[EMAIL PROTECTED]>
> To: "Henry Wong" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Monday, September 23, 2002 2:53 PM
> Subject: Re: Filename modification
> 
> 
> > Read the name of the file from STDIN. Assign it to
> > some scalar variable. Using that variable, you can
> > open this file. You can have other scalar variable
> > that can be assigned the name of this file appended
> > with whatever you want (like "_temp" etc) and eiher
> > open it (if it is there) or create it.
> >
> >Read about "open" and "close" functions.
> >
> >
> >
> >  --- Henry Wong <[EMAIL PROTECTED]> wrote: > Hi all,
> > a simple question...
> > > How to do a coding that takes in your filename and
> > > then using that filename
> > > for further uses?
> > >
> > > E.g. user is asked to enter a filename. User enters 
> REX.log. Program 
> > > will then use the name REX.log for future file
> > > extension/usage by creating
> > > various REX files like REX_temp.txt, REX_data.log,
> > > REX_arranged.log,etc
> > > ,etc... in other words, how do i make the  to
> > > be dynamic so that my
> > > program can use the input filenames for file
> > > saving/modification/etc?
> > >
> > >
> > > Regards,
> > >
> > > ~ HENRY WONG ~
> > >
> > >
> > > This e-mail is intended only for the named
> > > addressee(s) and may contain confidential and/or
> > > privileged information. If you are not the named
> > > addressee (or have received this e-mail in error),
> > > please notify the sender immediately and destroy
> > > this e-mail. The unauthorised use, disclosure,
> > > distribution or copying of the contents in this
> > > e-mail is strictly prohibited."
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> >
> > __
> > Do You Yahoo!?
> > Everything you'll ever need on one web page
> > from News and Sport to Email and Music Charts http://uk.my.yahoo.com
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> This e-mail is intended only for the named addressee(s) and 
> may contain confidential and/or privileged information. If 
> you are not the named addressee (or have received this e-mail 
> in error), please notify the sender immediately and destroy 
> this e-mail. The unauthorised use, disclosure, distribution 
> or copying of the contents in this e-mail is strictly prohibited."
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]