HELP - installing Win32::AdminMisc

2003-01-29 Thread PRADEEP GOEL
Hi All

I have followed many ways of installing AdminMisc  ( 2 are described below)

but all in vain .
I don't know where is this ADMINMISC_XXX.PLL
there is one ADMINMISC.DLL although is there .

then when i give install Win32::AdminMisc
output is
PPM> install Win32::AdminMisc
Install package 'Win32-AdminMisc?' (y/N): y
Installing package 'Win32-AdminMisc'...
Error installing package 'Win32-AdminMisc': Could not locate a PPD file for
pack
age Win32-AdminMisc
PPM>

where it searches for ppd file i have set the repository ( as described
below).
pls do see the 1) below - & pls me what's wrong .
###
1)

 IF you are using the ActiveState version of Win32 Perl:
a) Copy the ADMINMISC.PM file into the directory perl\lib\win32\
- I don't have win32 directory perl\lib\

b) Rename the file ADMINMISC_XXX.PLL to ADMINMISC.PLL
- no idea where is that

c) Make a directory: perl\lib\auto\win32\adminmisc\
- no win32 in auto
d) Copy the ADMINMISC.PLL file into the directory in step c
- no ADMINMISC.PLL  -


2)


| C:\>ppm |
| PPM interactive shell (2.1.5) - type 'help' for available   |
| commands.   |
| PPM> set repository RothConsulting  |
| http://www.roth.net/perl/packages   |
| PPM> set|
| Commands will be confirmed. |
| Temporary files will be deleted.|
| Download status will be updated every 16384 bytes.  |
| Case-insensitive searches will be performed.|
| Package installations will continue if a dependency cannot be   |
| installed.  |
| Tracing info will not be written.   |
| Screens will pause after 24 lines.  |
| Query/search results will be verbose.   |
| Current PPD repository paths:   |
| ActiveState Package Repository: |
| http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServe|
| r   |
| RothConsulting: http://www.roth.net/perl/packages   |
| Packages will be built under: C:\TEMP   |
| PPM>set save|
| PPM>install Win32::AdminMisc|
|-|
 PPM>install Win32::AdminMisc  or
PPM> install  http://www.roth.net/perl/packages/Win32-AdminMisc.ppd
Install package 'http://www.roth.net/perl/packages/Win32-AdminMisc.ppd?'
(y/N):
y
Installing package
'http://www.roth.net/perl/packages/Win32-AdminMisc.ppd'...
Error installing package
'http://www.roth.net/perl/packages/Win32-AdminMisc.ppd'
: Could not locate a PPD file for package
http://www.roth.net/perl/packages/Win3
2-AdminMisc.ppd
PPM>


Regards
Pradeep


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




Re: HTML::TokeParser and  

2003-01-29 Thread David Eason

John W. Krahn wrote:
> According to HTML::Entities
>
>  # Some extra Latin 1 chars that are listed in the HTML3.2 draft
> (21-May-96)
>  copy   => '©',  # copyright sign
>  reg=> '®',  # registered sign
>  nbsp   => "\240", # non breaking space

Thanks, John, I had no idea where to look. I didn't know a non-breaking
space was an actual character, I thought it was just a directive to the
browser.  I have corrected the code below accordingly and it prints "line
1line 3" as desired.

use strict;
use warnings;
use HTML::TokeParser;

my $p = HTML::TokeParser->new(*DATA) or die "Can't open: $!";
while (my $tag = $p->get_tag())
{
if ($tag->[0] eq "dd")
{
my $text = $p->get_trimmed_text();
$text =~ s/^[\s\240]*(.*?)[\s\240]*$/$1/;
print "$text";
}
}

__DATA__

line 1
 
line 3



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




XML -> Perl-variables using XML::Parser

2003-01-29 Thread Nils-Anders Persson
Hello good people!

I have a bit of a problem with turning this piece of XML into a
Perl-variable using the XML::Parser.
Earlier i have used the XML::Dt parser to do this and it works, but the
amount of data is to big
for the later (takes to much time to parse through the file).
I wonder if there is anyone out there with experience of this that could
help me out here.

The result of the XML-code that follows would look something like this:

%Kontoutdraguttag = { Filinfo => {
   SkapadDatum =>
2002-05-17 10:13,

Filnamn=>skkb0061x1,

Blankettid=>4812
 }
   Kontoutdrag =>{

Startid=>16299941,
   Kontohuvud=> {

UtskriftsDatum=> 2002-10-07,

AdressatInfo=> {

.

   }

MyndighetsInfo=>{



  }

...

 }
PeriodSKM=> {

IngaendeSaldo=> { ...}

TransRadsArr[0] =>{

Spec=>...

Rantedag=>...

BeloppSKM=>...

  }

TransRadsArr[1]=>{...}

...

   }
  
}
  }

All help appreciated!




  
2002-05-17 10:13

skkb006x1
4812
12
  
  
16299941

  2002-10-07
  
299900-0041
Aktiebolaget Kamelen
exportvaror
Box 
615 78  STORKÖPING
1629994144
162999411
8032-125 714 003 6
  
  
MYNDIGHETEN I STOCKHOLM
Kontoret i Norrtälje
Kungsgatan 2
Box 215
761 23  NORRTÄLJE
0176-19650
0176-19650
0771-567 567
489 01 03-7
5050-1055
[EMAIL PROTECTED]
www.test.se
  
  Utdrag t.o.m 2002


 
 Ingående saldo
 -510


Debiterad prel. skatt för 2002
020213
-1
 
 
Inbetalning bokförd 020211
020213
45000
  
  
Överskott före ev.utbetalning
19490
  
  
Utbetalning
-18585
  
  
Utgående saldo 2002-03-27
+905
  



  
 Utbetalningsorsak:
 
 Moms för januari 2002
 2
 


 Uppgifter om utbetalning från
skattekontot:
 
   Utbetaltbelopp (högst belopp enl
utbetalningsorsak ovan)*
   18585
 

Beloppet sätts in på ditt konto inom en
vecka.

16299941
XX
  




Regards,
Nils-Anders



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




Apache-Parselog module

2003-01-29 Thread Rob.Grim
Hi list,

I've noticed that the Apache-Parselog module is not available for 
win32 (I'm running activestate perl at win32). 

I have two questions:

Does anyone know a good working alternative to parse out apache log-
files on a win32 system:

Does anyone know if someone is working on the Apache parselog 
module.

Thanks in advance,

Rob 
 

Rob Grim 
OSA (Institute for Labour Studies)
Postbus 90153
5000 LE Tilburg 

t: 013-4668077
f: 013-4663349


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




Sharing variables

2003-01-29 Thread Enric Roca
Hello,

I'm new in Perl programming and I think that this is an easy question for
you:

I'm using Apache 1.3.26 and Perl 5.5.3 and I don't want to install
additional modules if I can avoid it.
I have an script, ex. test.pl that must control if it is already executing,
and if it is, it must wait for some seconds. I don't want to use
Proc::ProcessTable or other libraries. I would like to do this with the
standard Perl 5.5.3.

So, I need to create a global variable (environment variable, etc) and set
his value to EXECUTING (1 for instance) when the script begins and change
his value to FREE (0 for example) when the perl script finish. Every time
that the script begins must check the value of this variable and wait some
seconds and try again if the other processes have finished.

Is there any easy way to do this without installing extra modules ?

Thanks in advance,

Enric



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




RE: XML -> Perl-variables using XML::Parser

2003-01-29 Thread NYIMI Jose (BMB)
Give a look to this :

http://www.xml.com/pub/a/2001/02/14/perlsax.html

José.

> -Original Message-
> From: Nils-Anders Persson [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, January 29, 2003 10:09 AM
> To: [EMAIL PROTECTED]
> Subject: XML -> Perl-variables using XML::Parser
> 
> 
> Hello good people!
> 
> I have a bit of a problem with turning this piece of XML into 
> a Perl-variable using the XML::Parser. Earlier i have used 
> the XML::Dt parser to do this and it works, but the amount of 
> data is to big for the later (takes to much time to parse 
> through the file). I wonder if there is anyone out there with 
> experience of this that could help me out here.
> 
> The result of the XML-code that follows would look something 
> like this:
> 
> %Kontoutdraguttag = { Filinfo => {
>
> SkapadDatum => 2002-05-17 10:13,
> 
> Filnamn=>skkb0061x1,
> 
> Blankettid=>4812
>  }
>Kontoutdrag =>{
> 
> Startid=>16299941,
>
> Kontohuvud=> {
> 
> UtskriftsDatum=> 2002-10-07,
> 
> AdressatInfo=> {
> 
> .
>   
>   
>}
> 
> MyndighetsInfo=>{
> 
> 
>   
>   
>   }
> 
> ...
>   
>   
>  }
> 
> PeriodSKM=> {
> 
> IngaendeSaldo=> { ...}
> 
> TransRadsArr[0] =>{
> 
> Spec=>...
> 
> Rantedag=>...
> 
> BeloppSKM=>...
>   
>   
>   }
> 
> TransRadsArr[1]=>{...}
> 
> ...
>   
>   
>}
>   
> }
>   }
> 
> All help appreciated!
> 
> 
>  
> 
>   
> 2002-05-17 10:13
> 
> skkb006x1
> 4812
> 12
>   
>   
> 16299941
> 
>   2002-10-07
>   
> 299900-0041
> Aktiebolaget Kamelen
> exportvaror
> Box 
> 615 78  STORKÖPING
> 1629994144
> 162999411
> 8032-125 714 003 
> 6
>   
>   
> MYNDIGHETEN I 
> STOCKHOLM
> Kontoret i Norrtälje
> Kungsgatan 2
> Box 215
> 761 23  NORRTÄLJE
> 0176-19650
> 0176-19650
> 0771-567 567
> 489 01 03-7
> 5050-1055
> [EMAIL PROTECTED]
> www.test.se
>   
>   Utdrag t.o.m 2002
> 
> 
>  
>  Ingående saldo
>  -510
> 
> 
> Debiterad prel. skatt för 2002
> 020213
> -1
>  
>  
> Inbetalning bokförd 020211
> 020213
> 45000
>   
>   
> Överskott före ev.utbetalning
> 19490
>   
>   
> Utbetalning
> -18585
>   
>   
> Utgående saldo 2002-03-27
> +905
>   
> 
> 
> 
>   
>  Utbetalningsorsak:
>  
>  Moms för januari 2002
>  2
>  
> 
> 
>  Uppgifter om utbetalning från 
> skattekontot:
>  
>Utbetaltbelopp (högst 
> belopp enl utbetalningsorsak ovan)*
>18585
>  
> 
> Beloppet sätts in på ditt konto inom en 
> vecka.
> 
> 16299941
> XX
>   
> 
> 
> 
> 
> Regards,
> Nils-Anders
> 
> 
> 
> -- 
> 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

Re: Apache-Parselog module

2003-01-29 Thread John W. Krahn
"Rob.Grim" wrote:
> 
> Hi list,

Hello,

> I've noticed that the Apache-Parselog module is not available for
> win32 (I'm running activestate perl at win32).

According to
http://testers.cpan.org/search?request=dist&dist=Apache-ParseLog it has
been tested and works on Windows.


John
-- 
use Perl;
program
fulfillment

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




Re: help me to replace ascii charecter with some other ascii charector or text

2003-01-29 Thread John W. Krahn
"R. Joseph Newton" wrote:
> 
> If you want to actually use the non-ASCII characters contained in MS Word,
> you will have to learn the wider character set used.  You may also need to
> come up with a list of MS Word control characters.

You might get some help by looking at the source for Demoronizer

http://www.fourmilab.ch/webtools/demoroniser/


John
-- 
use Perl;
program
fulfillment

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




Re: HTML::TokeParser and  

2003-01-29 Thread John W. Krahn
David Eason wrote:
> 
> John W. Krahn wrote:
> > According to HTML::Entities
> >
> >  # Some extra Latin 1 chars that are listed in the HTML3.2 draft
> > (21-May-96)
> >  copy   => '©',  # copyright sign
> >  reg=> '®',  # registered sign
> >  nbsp   => "\240", # non breaking space
> 
> Thanks, John, I had no idea where to look. I didn't know a non-breaking
> space was an actual character, I thought it was just a directive to the
> browser.

AFAIK it is.

> I have corrected the code below accordingly and it prints "line
> 1line 3" as desired.

FWIW on my computer "\240" prints a "space".  :-)

> use strict;
> use warnings;
> use HTML::TokeParser;
> 
> my $p = HTML::TokeParser->new(*DATA) or die "Can't open: $!";
> while (my $tag = $p->get_tag())
> {
> if ($tag->[0] eq "dd")
> {
> my $text = $p->get_trimmed_text();
> $text =~ s/^[\s\240]*(.*?)[\s\240]*$/$1/;

If you are going to do that then you might as well call get_text and do
all the trimming yourself.

  my $text = $p->get_text();
  for ( $text ) {
  s/^[\s\240]+//;
  s/[\s\240]+$//;
  s/[\s\240]+/ /g;
  }

> print "$text";
> }
> }
> 
> __DATA__
> 
> line 1
>  
> line 3


John
-- 
use Perl;
program
fulfillment

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




Array question

2003-01-29 Thread PL LAMBALLAIS
Hello,


I'm working with a GIF generator and I've a little problem using array
as parameters:

This call works perfectly:

$my_graph->set( 
markers => [1,2],   # kind of 
markers (here, 2 markers)
marker_size => $marker_size,# size of markers
);

As I use a variable as parameter for "marker_size", I want to do the
same for "marker".

So I try:

$markers = "1-2";
@tab_tmp = split("-",$markers);
# Here I have the same thing that:  @tab_tmp = ("1","2");
# and thats' OK.

# And now, using the array as parameter:
$my_graph->set( 
markers => \@tab_tmp,   # kind of markers
marker_size => $marker_size,# size of markers
);

But this don't work. I'm sure of getting the righ value in the array, so
the problem came from "\@tab_tmp". What is the right syntax?

Thanks for the answer (if you get it of course :-)  

Regards to all
PL Lamballais


-- 
**
 Pierre-Louis LAMBALLAIS / [EMAIL PROTECTED]
 
 PARX
 La vitamine de vos projets Internet
 PHP, Perl, ASP, MySQL, PostGreSQL, Oracle...
 
 Entreprise Certifiée ISO-9001/ Version 2000
"Développement Informatique pour sites Internet, Intranet et Extranet"
 
 http://www.parx.net  --  WebDev using CSE
 http://www.dacs.dtic.mil -- More about CSE

**

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




References

2003-01-29 Thread Brian Ling
Hi list,

The following code fragment works but has a horrible feel about it, can
anyone suggest ways to improve it.

The data structure is generated by an XML parser.

for ( keys %{$parsed_data->{value}->{NetworkServices}->{value}} ) {
if (
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{Inter
face}->{value}->{DeviceName}->{value} eq "modem" and
 
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{PPP}-
>{value}->{UserDefinedName}->{value} eq $serviceName) {
print "found correct modem\n";
 
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{PPP}-
>{value}->{AuthName}->{value} = $username;
}
}

Ta very much,

Brian :-(



BBCi at http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain 
personal views which are not the views of the BBC unless specifically 
stated.
If you have received it in error, please delete it from your system, do 
not use, copy or disclose the information in any way nor act in 
reliance on it and notify the sender immediately. Please note that the 
BBC monitors e-mails sent or received. Further communication will 
signify your consent to this.




RE: Sharing variables

2003-01-29 Thread Bob Showalter
Enric Roca wrote:
> Hello,
> 
> I'm new in Perl programming and I think that this is an easy question
> for you:
> 
> I'm using Apache 1.3.26 and Perl 5.5.3 and I don't want to install
> additional modules if I can avoid it.
> I have an script, ex. test.pl that must control if it is already
> executing, and if it is, it must wait for some seconds. I don't want
> to use Proc::ProcessTable or other libraries. I would like to do this
> with the standard Perl 5.5.3.
> 
> So, I need to create a global variable (environment variable, etc)
> and set his value to EXECUTING (1 for instance) when the script
> begins and change his value to FREE (0 for example) when the perl
> script finish. Every time that the script begins must check the value
> of this variable and wait some seconds and try again if the other
> processes have finished. 
> 
> Is there any easy way to do this without installing extra modules ?

Have your script acquire a lock on a file when it starts. If a second
instance is started, it will block while trying to acquire the lock until
the first script releases the lock or exits.

perldoc -f flock

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




RE: Sharing variables

2003-01-29 Thread wiggins


On Wed, 29 Jan 2003 13:42:49 +0100, "Enric Roca" <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I'm new in Perl programming and I think that this is an easy question for
> you:
> 
> I'm using Apache 1.3.26 and Perl 5.5.3 and I don't want to install
> additional modules if I can avoid it.
> I have an script, ex. test.pl that must control if it is already executing,
> and if it is, it must wait for some seconds. I don't want to use
> Proc::ProcessTable or other libraries. I would like to do this with the
> standard Perl 5.5.3.
> 
> So, I need to create a global variable (environment variable, etc) and set
> his value to EXECUTING (1 for instance) when the script begins and change
> his value to FREE (0 for example) when the perl script finish. Every time
> that the script begins must check the value of this variable and wait some
> seconds and try again if the other processes have finished.
> 
> Is there any easy way to do this without installing extra modules ?
> 

This is generally handled with a lock file.  At the start of the script open a file 
for writing, write something to it if you want (usually the PID) and then close it, do 
your work, and then remove the file.  The script should check to see if the file 
exists before creating it, therefore you know if there is already one processing.  
Don't forget to catch your exceptions lest, the lock file may exist and the process 
may not be running

 
use Fcntl ':flock'; # import LOCK_* constants

# create the lock file
my $LOCK;
open $LOCK, ">.lock" or die "Unable to initialize, couldn't create lock file\n";
my $flock = flock($LOCK, (LOCK_EX|LOCK_NB));
unless ($flock) {
   die "Unable to initialize, couldn't lock the lock file, LOCK EXISTS!\n";
}
autoflush $LOCK 1;
print $LOCK $$;
close $LOCK or die "Unable to initialize, couldn't close lock file handle, LOCK 
EXISTS!\n";

then somewhere before this you want to do something similar to:

if (-e '.lock') {
print "$0 already executing...quitting.";
exit(1);
}

-- UNTESTED --

http://danconia.org


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




RE: Array question

2003-01-29 Thread Bob Showalter
PL LAMBALLAIS wrote:
> Hello,
> 
> 
> I'm working with a GIF generator and I've a little problem using
> array as parameters: 
> 
> This call works perfectly:
> 
>   $my_graph->set(
>   markers => [1,2],
>   # kind of markers (here, 2 markers)
>   marker_size => $marker_size,# size
> of markers
>   );
> 
> As I use a variable as parameter for "marker_size", I want to do the
> same for "marker". 
> 
> So I try:
> 
>   $markers = "1-2";
>   @tab_tmp = split("-",$markers);
> # Here I have the same thing that:@tab_tmp = ("1","2"); # and thats'
> OK. 
> 
> # And now, using the array as parameter:
>   $my_graph->set(
>   markers => \@tab_tmp,
> # kind of markers
>   marker_size => $marker_size,# size
> of markers
>   );
> 
> But this don't work. I'm sure of getting the righ value in the array,
> so the problem came from "\@tab_tmp". What is the right syntax?

That syntax looks OK, so there must be something else going on. You need to
define "don't work".

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




how to read binary files in perl

2003-01-29 Thread HK
hi all,
i am a newbie to perl.
I have an application in C which will dump statistics (C structures) into 
log files for post processing.
Can i read those log files from perl and form equivalent structures which 
will help in analysing the files and generate a report on the statistics.

TIA.
-- 
regards,
hari 
  __
 / /__  _  _  _  _ __  __ -o) 
/ /__  / / / \\// //_// \\ \\/ / /  Making things HAPPEN
   // /_/ /_/\\/ /___/  /_/\\_\\_\\_v-  




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




Re: how do i get rid of "<> and , chars ??????

2003-01-29 Thread Janek Schleicher
On Tue, 28 Jan 2003 02:03:32 -0800, Swami Anadi wrote:

> I am reading a line from a file and splitting it into
> a 2 dimensional array, this is no probs..
> BUT i want to get rid of " < > and , out of each line
> - how do i do this ???

What do you mean with "ridding" " < > and , out.
It's always good to see an example, if we shall help you.

If you meant that these characters should be simple deleted from the line,
you can do something like:

$line =~ tr/"<>,//d;
#or
$line =~ s/["<>,]//g;


Greetings,
Janek

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




RE: Array question

2003-01-29 Thread Bob Showalter
[redirecting back to list. keep the discussions on-list, folks.]

PL LAMBALLAIS wrote:
> Well, markers type don't change. :-/
> 
> Try this:
> http://www.parx.net/cgi-bin/samples/bob_1.pl
> and
> http://www.parx.net/cgi-bin/samples/bob_2.pl
> 
> (force refresh as it display a generated GIF so running the second
> script can display the GIF from the first one).
> 
> The only difference is that for bob_1 I use:
> $my_graph->set(
>   markers => [1,2],
>   marker_size => $marker_size,
> );
> and in this case, markers types are OK and change according to the
> values. 
> 
> and for bob_2
>   markers => [1,2],\@tab,

This is *not* what you originally posted. This syntax is wrong, obviously.

It should be:

  markers => \@tab,

> 
> As you can see, no Error 500, the GIF is generated, but the markers
> are not displayed.
> 
> No very cool.
> 
> PLL
> 
> 
> 
> Bob Showalter a *crit :
> > 
> > PL LAMBALLAIS wrote:
> > > Hello,
> > > 
> > > 
> > > I'm working with a GIF generator and I've a little problem using
> > > array as parameters: 
> > > 
> > > This call works perfectly:
> > > 
> > >   $my_graph->set(
> > >   markers => [1,2],
> > >   # kind of markers (here, 2 markers)
> > >   marker_size => $marker_size,# size of
> > >   markers );
> > > 
> > > As I use a variable as parameter for "marker_size", I want to do
> > > the same for "marker". 
> > > 
> > > So I try:
> > > 
> > >   $markers = "1-2";
> > >   @tab_tmp = split("-",$markers);
> > > # Here I have the same thing that:@tab_tmp = ("1","2"); # and
> > > thats' OK. 
> > > 
> > > # And now, using the array as parameter:
> > >   $my_graph->set(
> > >   markers => \@tab_tmp,
> > > # kind of markers
> > >   marker_size => $marker_size,# size of
> > >   markers );
> > > 
> > > But this don't work. I'm sure of getting the righ value in the
> > > array, so the problem came from "\@tab_tmp". What is the right
> > > syntax? 
> > 
> > That syntax looks OK, so there must be something else going on. You
> > need to define "don't work".


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




Re: Array question

2003-01-29 Thread PL LAMBALLAIS


Bob Showalter a *crit :
> 
> [redirecting back to list. keep the discussions on-list, folks.]
Yes :-)

> 
> PL LAMBALLAIS wrote:
> > Well, markers type don't change. :-/
> >
> > Try this:
> > http://www.parx.net/cgi-bin/samples/bob_1.pl
> > and
> > http://www.parx.net/cgi-bin/samples/bob_2.pl
> >
> > (force refresh as it display a generated GIF so running the second
> > script can display the GIF from the first one).
> >
> > The only difference is that for bob_1 I use:
> > $my_graph->set(
> >   markers => [1,2],
> >   marker_size => $marker_size,
> > );
> > and in this case, markers types are OK and change according to the
> > values.
> >
> > and for bob_2
> >   markers => [1,2],\@tab,
> 
> This is *not* what you originally posted. This syntax is wrong, obviously.
> 
> It should be:
> 
>   markers => \@tab,

Well, yes, I know , that's the way it's in the script. It was a mistake
on my mail.
In bob_2 the syntax is "markers => \@tab,"


and it don't work.


PLL
-- 
**
 Pierre-Louis LAMBALLAIS / [EMAIL PROTECTED]
 
 PARX
 La vitamine de vos projets Internet
 PHP, Perl, ASP, MySQL, PostGreSQL, Oracle...
 
 Entreprise Certifiée ISO-9001/ Version 2000
"Développement Informatique pour sites Internet, Intranet et Extranet"
 
 http://www.parx.net  --  WebDev using CSE
 http://www.dacs.dtic.mil -- More about CSE

**

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




Re: how to read binary files in perl

2003-01-29 Thread Paul Johnson

HK said:

> hi all,
> i am a newbie to perl.
> I have an application in C which will dump statistics (C structures) into
> log files for post processing.
> Can i read those log files from perl and form equivalent structures which
> will help in analysing the files and generate a report on the statistics.

Sounds like a job for unpack().

perldoc -f unpack

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


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




Re: References

2003-01-29 Thread Jenda Krynicky
From: "Brian Ling" <[EMAIL PROTECTED]>
> The following code fragment works but has a horrible feel about it,
> can anyone suggest ways to improve it.
> 
> The data structure is generated by an XML parser.
> 
> for ( keys %{$parsed_data->{value}->{NetworkServices}->{value}} ) {
> if (
> $parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{Int
> er face}->{value}->{DeviceName}->{value} eq "modem" and
> ...

What about:

for ( values %{$parsed_data->{value}->{NetworkServices}->{value}} ) {
if ( $_->{value}->{Inter face}->{value}->{DeviceName}->{value} 
eq "modem" and ...

You may also want to use some temporary lexical variables and assign 
the values to them to shorten the code.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Re: Apache-Parselog module

2003-01-29 Thread Jenda Krynicky
From: "Rob.Grim" <[EMAIL PROTECTED]>
> I've noticed that the Apache-Parselog module is not available for
> win32 (I'm running activestate perl at win32). 

You can install it via ppm from http://Jenda.Krynicky.cz/perl

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Re: HELP - installing Win32::AdminMisc

2003-01-29 Thread Jenda Krynicky
From:   "PRADEEP GOEL" <[EMAIL PROTECTED]>
> I have followed many ways of installing AdminMisc  ( 2 are described
> below)

Try
PPM> install http://Jenda.Krynicky.cz/perl/Win32-AdminMisc.ppd

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




A very annoying regex question.

2003-01-29 Thread Zeus Odin
I have spent a very LONG time trying to determine why this script is not
splitting properly only on lines that have equals marks and only on the
first equals. This would be very easy if I didn't slurp in the entire
file at once, but hey life usually isn't easy. The array @a should
always have an equal number of elements. I have tried countless
permutations with no luck. Thanks.

In case the email formatting gets messed up, there are 8 lines beneath
__DATA__.

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

undef $/;
my @a = grep length, split /\[.*\]|^(?:[^=]+)=|\s+/i, ;
print "$_\n" for @a;

__DATA__
[DEFAULT]
BASEURL=http://v4.windowsupdate.microsoft.com/en/default.asp
[DOC#17#19#21]
BASEURL=http://v4.windowsupdate.microsoft.com/en/splash.asp?page=3&x86=true&auenabled=false&;
ORIGURL=splash.asp?page=0&corporate=false&
[InternetShortcut]
URL=http://v4.windowsupdate.microsoft.com/en/default.asp
Modified=B059DD590A4BC20157


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




Re: A very annoying regex question.

2003-01-29 Thread Jenda Krynicky
From: Zeus Odin <[EMAIL PROTECTED]>
> I have spent a very LONG time trying to determine why this script is
> not splitting properly only on lines that have equals marks and only
> on the first equals. This would be very easy if I didn't slurp in the
> entire file at once, but hey life usually isn't easy. The array @a
> should always have an equal number of elements. I have tried countless
> permutations with no luck. Thanks.
> 
> In case the email formatting gets messed up, there are 8 lines beneath
> __DATA__.
> 
> #!/usr/bin/perl -w
> use strict;
> 
> undef $/;
> my @a = grep length, split /\[.*\]|^(?:[^=]+)=|\s+/i, ;

my @a = map {split (/\s*=\s*/, $_, 2)} split(/\r?\n/, );

> print "$_\n" for @a;
> 
> __DATA__
> [DEFAULT]
> BASEURL=http://v4.windowsupdate.microsoft.com/en/default.asp
> [DOC#17#19#21]
> BASEURL=http://v4.windowsupdate.microsoft.com/en/splash.asp?page=3&x86
> =true&auenabled=false& ORIGURL=splash.asp?page=0&corporate=false&
> [InternetShortcut]
> URL=http://v4.windowsupdate.microsoft.com/en/default.asp
> Modified=B059DD590A4BC20157

Sometimes it's better to do one thing at a time :-)

Jenda
P.S.: Are you sure you do not want to 
use Config::IniHash qw(ReadINI);
$config = ReadINI(\*DATA);
print $config->{DEFAULT}->{BASEURL},"\n";
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Re: A very annoying regex question.

2003-01-29 Thread Robert Citek

Hello Zeus,

At 09:49 AM 1/29/2003 -0500, Zeus Odin wrote:
>I have spent a very LONG time trying to determine why this script is not
>splitting properly only on lines that have equals marks and only on the
>first equals.

I'm not quite sure what you are trying to do.  So below is a modified
version of your script which may shed some light on what is happening.

Regards,
- Robert

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

# undef $/;

while (my $line=) {
  chomp $line;
  print "=> $line\n";
  my @f = split(/\[.*\]|^(?:[^=]+)=|\s+/i, $line);
  print "==> @f\n";
  my @a = grep(length, @f);
  print "===> $_\n" for @a;
}

__DATA__
[DEFAULT]
BASEURL=http://v4.windowsupdate.microsoft.com/en/default.asp
[DOC#17#19#21]
BASEURL=http://v4.windowsupdate.microsoft.com/en/splash.asp?page=3&x86=true&;
auenabled=false&
ORIGURL=splash.asp?page=0&corporate=false&
[InternetShortcut]
URL=http://v4.windowsupdate.microsoft.com/en/default.asp
Modified=B059DD590A4BC20157


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




Mail::Sender module

2003-01-29 Thread Dan Muey
Hello All,

Just a quick question I can't find an answer to and I believe one of our frequenters 
will know for sure as they are the module author

I've read somewhere ( in a dreaded Oreilley book ;D ) that the Mail series of modules 
uses the OS's native mail prog to send mail ( sendamil, qmail, etc ) vs. the 
Net::SMTP,etc type that talks directly to the mail servers.

I could be mistaken about that but I'm not totally sure.

Does Mail::Sender use the native OS's mail prog or does it talk to the smtp server 
directly?
If it uses the mailprog, do I need to/how do I specify the mail prog, path, switches 
etc?

Example, if I'm opening a pipe to the prog I'd need to do use this :
/usr/bin/sendmail -t
Or /var/qmail/bin/qmail-inject -f $to_address

Thanks,

Dan

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




Re: References

2003-01-29 Thread Rob Dixon
Brian Ling wrote:
> Hi list,
>
> The following code fragment works but has a horrible feel about it,
> can anyone suggest ways to improve it.
>
> The data structure is generated by an XML parser.
>
> for ( keys %{$parsed_data->{value}->{NetworkServices}->{value}} ) {
> if (
>
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{Inter
> face}->{value}->{DeviceName}->{value} eq "modem" and
>
>
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{PPP}-
>> {value}->{UserDefinedName}->{value} eq $serviceName) {
> print "found correct modem\n";
>
>
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{PPP}-
>> {value}->{AuthName}->{value} = $username;
> }
> }

Hi Brian.

As Jenda said, use temporary variables. Also you can go through all
of the _values_ in the hash instead of all the keys, which is all you
need here since you're only using the key to index the hash. Thirdly
any }->{ or ]->[ pair can be abbreviated to }{ or ][. So how about
this:

for ( values %{$parsed_data->{value}{NetworkServices}{value}} ) {

my $iface = $_->{Interface}{value};
next unless $iface->{DeviceName}{value} eq "modem";

my $ppp = $_->{PPP}{value};
next unless $ppp->{UserDefinedName}{value} eq $serviceName;

print "found correct modem\n";
$ppp->{AuthName}{value} = $username;
}

HTH,

Rob






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




Re: Mail::Sender module

2003-01-29 Thread Jenda Krynicky
From: "Dan Muey" <[EMAIL PROTECTED]>
> Just a quick question I can't find an answer to and I believe one of
> our frequenters will know for sure as they are the module author
> 
> I've read somewhere ( in a dreaded Oreilley book ;D ) that the Mail
> series of modules uses the OS's native mail prog to send mail (
> sendamil, qmail, etc ) vs. the Net::SMTP,etc type that talks directly
> to the mail servers.

I think this information is totally wrong.
Some Mail:: modules use an external program, some talk to a server 
with SMTP, some with IMAP, some are not meant for sending email at 
all (Mail::Addressbook,Mail::MboxParser, ...), ...
The only thing they have in the common is the fact that they are all 
related to mailing.
 
> I could be mistaken about that but I'm not totally sure.
> 
> Does Mail::Sender use the native OS's mail prog or does it talk to the
> smtp server directly?

Directly to an SMTP server.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




RE: Mail::Sender module

2003-01-29 Thread Dan Muey


> From: "Dan Muey" <[EMAIL PROTECTED]>
> > Just a quick question I can't find an answer to and I 
> believe one of 
> > our frequenters will know for sure as they are the module author
> > 
> > I've read somewhere ( in a dreaded Oreilley book ;D ) that the Mail 
> > series of modules uses the OS's native mail prog to send mail ( 
> > sendamil, qmail, etc ) vs. the Net::SMTP,etc type that 
> talks directly 
> > to the mail servers.
> 
> I think this information is totally wrong.

Those darn Oreilley books!

Actually I was reading your module's page on cpan and just 
saw the part that said it talks directly to the server!
Sorry I should have RTFM better! I'll do that to find the answers to my other questions
Before I post to the list for help.

Thanks Jenda, I knew you'd come through!

Dan

> Some Mail:: modules use an external program, some talk to a server 
> with SMTP, some with IMAP, some are not meant for sending email at 
> all (Mail::Addressbook,Mail::MboxParser, ...), ...
> The only thing they have in the common is the fact that they are all 
> related to mailing.
>  
> > I could be mistaken about that but I'm not totally sure.
> > 
> > Does Mail::Sender use the native OS's mail prog or does it 
> talk to the 
> > smtp server directly?
> 
> Directly to an SMTP server.
> 
> Jenda
> = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
> When it comes to wine, women and song, wizards are allowed 
> to get drunk and croon as much as they like.
>   -- Terry Pratchett in Sourcery
> 
> 
> -- 
> 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: :SMTP::Multipart Module

2003-01-29 Thread Dan Muey

Well, I've given up trying to install the Net::SMTP::Multipart Module.
I'm going to use Mail::Sender instead which actually looks like it does more and 
It installed first time el prefecto! Thanks Jenda for that module!!

I'd like to thank John for all his patient help in trying to get this to work.

It seems the issue had to do with it needing to use perl newer than 5.005 and 
The module didn't check for that and is not backward compatable and the author 
was unreachable.

So instead of rewritind the module, installing new perl, ( I will eventually I just 
need to get this mail script up for my employer asap ) I just decide to use a better 
module!

Thanks!

Dan

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




Need help

2003-01-29 Thread Ron Geringer
I'm pretty much used to scripting sendmail applications in tcl - and I'm
very new to perl so this may be a dumb question. I'm working with a sendmail
script that I got off the internet. The script that I'm working with is
listed below:

#!/usr/bin/perl
use CGI;

my $query= new CGI;
my $sendmail = "/usr/sbin/sendmail -i -t";
my $reply_to = "Reply-to: geringer2\@cox.net";
my $subject  = "Subject: Confirmation of your submission";
my $content  = "Thanks for your submission.";
my $to   = $query->param('send_to');
my $file = "subscribers2.txt";

unless ($to) {
   print $query->header;
   print "Please fill in your email and try again";
}

open (FILE, ">>$file") or die "Cannnot open $file: $!";
print $to,"\n";
close(FILE);

my $send_to  = "To: ".$query->param('send_to');

open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL $to;
print SENDMAIL "Content-type: text/plain\n\n";
print SENDMAIL $content;
close(SENDMAIL);

print $query->header;
print "Confirmation of your submission will be emailed to you.";
~
~

--

The only difference between this and the one I found is the "\" in fron of
the "@". When I run this cript - the error that I'm seeing  is that the
header is malformed.

If anyone can tell me what I did wrong - I would appreciate it.

What I'm trying to do is put a perl script on a server which will take data
from an html document and redirect it to an email address. Once I get one to
work, I'm confident that I can make modifications and work with it (testing
etc), to better understand how perl makes it works.

I would really appreciate any help I can get.


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




sorting thoughts

2003-01-29 Thread Steven_Massey
Hi

just about to embark on a sorting routine, and I thought before I spend
ages(at my ability) I would see what thoughts you guys have on  this.

I have an array, each line contains fields seperated by ":"
I want to sort the array numerically ascending by the last field.

 my thoughts are to split fields into seperate arrays, go through the last
array in a comparing process, moving each row index in the original array
to reflect the sort. ( I found this hard to explain)

Do any of you some tips as to how to approach this ??

eg
contents of array1
fred:lucy:24
john:jane:10
frank:mary:5

so I want to end up with
frank:mary:5
john:jane:10
fred:lucy:24

Thanks - here's hoping..
Steve




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




RE: References

2003-01-29 Thread Brian Ling
Thanks for that Rob, Jenda

I hadn't realized you could do that with the hash value,

Easy when someone shows you.

Brian :-)

-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]] 
Sent: 29 January 2003 16:10
To: [EMAIL PROTECTED]
Subject: Re: References


Brian Ling wrote:
> Hi list,
>
> The following code fragment works but has a horrible feel about it, 
> can anyone suggest ways to improve it.
>
> The data structure is generated by an XML parser.
>
> for ( keys %{$parsed_data->{value}->{NetworkServices}->{value}} ) {
> if (
>
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{Inter
> face}->{value}->{DeviceName}->{value} eq "modem" and
>
>
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{PPP}-
>> {value}->{UserDefinedName}->{value} eq $serviceName) {
> print "found correct modem\n";
>
>
$parsed_data->{value}->{NetworkServices}->{value}->{$_}->{value}->{PPP}-
>> {value}->{AuthName}->{value} = $username;
> }
> }

Hi Brian.

As Jenda said, use temporary variables. Also you can go through all of the
_values_ in the hash instead of all the keys, which is all you need here
since you're only using the key to index the hash. Thirdly any }->{ or ]->[
pair can be abbreviated to }{ or ][. So how about
this:

for ( values %{$parsed_data->{value}{NetworkServices}{value}} ) {

my $iface = $_->{Interface}{value};
next unless $iface->{DeviceName}{value} eq "modem";

my $ppp = $_->{PPP}{value};
next unless $ppp->{UserDefinedName}{value} eq $serviceName;

print "found correct modem\n";
$ppp->{AuthName}{value} = $username;
}

HTH,

Rob






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



BBCi at http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain 
personal views which are not the views of the BBC unless specifically 
stated.
If you have received it in error, please delete it from your system, do 
not use, copy or disclose the information in any way nor act in 
reliance on it and notify the sender immediately. Please note that the 
BBC monitors e-mails sent or received. Further communication will 
signify your consent to this.


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




Re: A very annoying regex question.

2003-01-29 Thread Zeus Odin
Hello, Robert. Thanks for the reply. 

An even shorter version of yours is:
-
my @a;
while(){
   next unless /=/ && chomp;
   push @a, split /=/, $_, 2;
}
print "$_\n" for @a;
-

This avoids the temp @f. However, that's just it. I wanted to avoid
processing DATA one line at a time, which is what you are doing. I
wanted to (1) slurp in DATA entirely and (2) then split on the first '='
in ONLY lines containing equals marks. This means throwing away white
space and any lines not containing an equals mark. 

These criteria make the regex a bit more complex. The entity

^(?:[^=]+)=

should split lines containing any equals on the first equals. Everything
I've read agrees, but it does not work.

C'est la vie.

On Wed, 2003-01-29 at 10:52, Robert Citek wrote:
> 
> Hello Zeus,
> 
> At 09:49 AM 1/29/2003 -0500, Zeus Odin wrote:
> >I have spent a very LONG time trying to determine why this script is not
> >splitting properly only on lines that have equals marks and only on the
> >first equals.
> 
> I'm not quite sure what you are trying to do.  So below is a modified
> version of your script which may shed some light on what is happening.
> 
> Regards,
> - Robert
> 
> -
> #!/usr/bin/perl -w
> use strict;
> 
> # undef $/;
> 
> while (my $line=) {
>   chomp $line;
>   print "=> $line\n";
>   my @f = split(/\[.*\]|^(?:[^=]+)=|\s+/i, $line);
>   print "==> @f\n";
>   my @a = grep(length, @f);
>   print "===> $_\n" for @a;
> }
> 
> __DATA__
> [DEFAULT]
> BASEURL=http://v4.windowsupdate.microsoft.com/en/default.asp
> [DOC#17#19#21]
> BASEURL=http://v4.windowsupdate.microsoft.com/en/splash.asp?page=3&x86=true&;
> auenabled=false&
> ORIGURL=splash.asp?page=0&corporate=false&
> [InternetShortcut]
> URL=http://v4.windowsupdate.microsoft.com/en/default.asp
> Modified=B059DD590A4BC20157
> 



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




RE: Need help

2003-01-29 Thread Dan Muey
> I'm pretty much used to scripting sendmail applications in 
> tcl - and I'm very new to perl so this may be a dumb 
> question. I'm working with a sendmail script that I got off 
> the internet. The script that I'm working with is listed below:
> 
> #!/usr/bin/perl
> use CGI;
> 
> my $query= new CGI;
> my $sendmail = "/usr/sbin/sendmail -i -t";
> my $reply_to = "Reply-to: geringer2\@cox.net";
> my $subject  = "Subject: Confirmation of your submission";
> my $content  = "Thanks for your submission.";
> my $to   = $query->param('send_to');
> my $file = "subscribers2.txt";
> 
> unless ($to) {
>print $query->header;
>print "Please fill in your email and try again";
> }
> 
> open (FILE, ">>$file") or die "Cannnot open $file: $!";
> print $to,"\n";
> close(FILE);
> 
> my $send_to  = "To: ".$query->param('send_to');
> 
> open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: 
> $!"; print SENDMAIL $reply_to; print SENDMAIL $subject; print 
> SENDMAIL $to; print SENDMAIL "Content-type: text/plain\n\n"; 
> print SENDMAIL $content; close(SENDMAIL);
> 
> print $query->header;
> print "Confirmation of your submission will be emailed to you."; ~ ~
> 
> --
> 
> The only difference between this and the one I found is the 
> "\" in fron of the "@". When I run this cript - the error 
> that I'm seeing  is that the header is malformed.

If what you're trying to get help on is the malformed 
header error then this is probably the problem :

You should need to do \@ if you're using double quotes, 
shouldn't need if you use single quotes. 

Did having that ( the \ in front of the @ ) cause the error?
Could you be less ambiguous about the problem, is the problem the 
'header malformed' error or you can't send mail or ...?
What happens when you run it form the command line?

You might want to look into a module, they're much easier to work with
and portable. 
The one I started working wioth lately is :
http://search.cpan.org/author/JENDA/Mail-Sender-0.8.04/Sender.pm

Or search cpan and find one you like/does what you want and you'll 
probably on ly need a few lines of code to do what you want.

Dan

> 
> If anyone can tell me what I did wrong - I would appreciate it.
> 
> What I'm trying to do is put a perl script on a server which 
> will take data from an html document and redirect it to an 
> email address. Once I get one to work, I'm confident that I 
> can make modifications and work with it (testing etc), to 
> better understand how perl makes it works.
> 
> I would really appreciate any help I can get.
> 
> 
> -- 
> 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: sorting thoughts

2003-01-29 Thread Ed Christian
Undoubtedly not the best way of doing this, but here's one stab at it.
This assumes you have your data stored in an array as a single string,
rather than having an array of array pointers.

my @array = ('fred:lucy:24', 'john:jane:10', 'frank:mary:5');

@array = sort { my @a_vals = split (':', $a);
my @b_vals = split (':', $b);
$a_vals[2] <=> $b_vals[2]; } @array;

foreach my $string(@array) { print "$string\n"; }

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, January 29, 2003 11:50 AM
> To: [EMAIL PROTECTED]
> Subject: sorting thoughts
> 
> 
> Hi
> 
> just about to embark on a sorting routine, and I thought 
> before I spend
> ages(at my ability) I would see what thoughts you guys have on  this.
> 
> I have an array, each line contains fields seperated by ":"
> I want to sort the array numerically ascending by the last field.
> 
>  my thoughts are to split fields into seperate arrays, go 
> through the last
> array in a comparing process, moving each row index in the 
> original array
> to reflect the sort. ( I found this hard to explain)
> 
> Do any of you some tips as to how to approach this ??
> 
> eg
> contents of array1
> fred:lucy:24
> john:jane:10
> frank:mary:5
> 
> so I want to end up with
> frank:mary:5
> john:jane:10
> fred:lucy:24
> 
> Thanks - here's hoping..
> Steve
> 
> 
> 
> 
> -- 
> 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]




Mail::Sender question

2003-01-29 Thread Dan Muey
Shoot me if this is already in the docs but is it possible to send a variable that 
contains html as an html attachement without it being a file first using Mail::Sender?
 
Eg - 
 
my $html_file_name = "no_existant.html"; # there is no file called 'no_existant.html'
my $html  = " Hello, this would actually be more complete html generated 
by the script! ";
 
 
Is it possible to send $html as an attached file named $html_file_name even though it 
is not in itself file.
The other option I have it to creat a temporary file, mail it, then delete it.
 
What this script does is generate the html code for a contract based on a database 
entry and puts it all in $html.
Then it either prints $html out to the screen to be printed or it emails it to someone.
 
The way I have it now is if they want it emailed is it generates $html, creates a temp 
file, then mails the file , then dleetes the temp file.
 
This is fine but then you have to worry about, building up a lot of files that arenit 
deleted , conflicing filenames, same file name that results in wrong contract being 
sent to a person, etccc
 
Does that make sense to anyone?
 
Can Mail::Sender do that?
 
If it is in the CPAN page for Mail::Sender just say so, I'm still only part way 
throught that page and this thought occured to me.
 
Thanks
 
Dan
 



RE: sorting thoughts

2003-01-29 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote:
> Hi
> 
> just about to embark on a sorting routine, and I thought before I
> spend ages(at my ability) I would see what thoughts you guys have on 
> this. 
> 
> I have an array, each line contains fields seperated by ":"
> I want to sort the array numerically ascending by the last field.
> 
>  my thoughts are to split fields into seperate arrays, go through the
> last array in a comparing process, moving each row index in the
> original array to reflect the sort. ( I found this hard to explain)
> 
> Do any of you some tips as to how to approach this ??
> 
> eg
> contents of array1
> fred:lucy:24
> john:jane:10
> frank:mary:5
> 
> so I want to end up with
> frank:mary:5
> john:jane:10
> fred:lucy:24
> 
> Thanks - here's hoping..
> Steve
  Here is one way:

my @MyData = ();
while (  ) {
chomp;
push(@MyData,$_);
 }

foreach my $MyKey (sort {$a->[3] <=> $b->[3]} map{[$_, split(/:/,$_)]}
@MyData) {
printf "%-s\n", $MyKey->[0];
 }
 
__DATA__
fred:lucy:24
john:jane:10
frank:mary:5

#output:
frank:mary:5
john:jane:10
fred:lucy:24

Wags ;)


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




Help installing Perl and Perl Modules on Mac OS X

2003-01-29 Thread David Brookes
Hi Everyone

This is my first post and I am a complete Perl Newbie.  Here is the
background: (The next paragraph may be skipped.)

I am involved in a physics education project which includes maintaining a
rather large webpage.  I am proficient in html, but I discovered that no
matter what I do, different browsers support css in different ways and
basically I am wasting tons of time.  To cut a long story short.  Someone
suggested that I dynamically generate the webpage from an xml database
using a scripting language such as Perl.  I know how I like to learn new
languages.  Take on a very large difficult project and chip away at
it.  Any fool can write a "hello world" program.  That is not how I learn.
So, I figured I will turn my Mac into a webserver, install the XML-XPath
and XML Parser Perl modules and settle down to writing a perl script which
dynamically generates a webpage, learning Perl on the fly.  Unfortunately
I got stuck on the installation stage.

I basically need help installing perl modules in Mac OS X.  I started by
installing Perl 5.8 using the instructions given at the website below.

http://developer.apple.com/internet/macosx/perl.html

Stupidly (maybe) I installed 5.8 over the 5.6 version that came with
developer tools.  Basically I followed the Apple directory structure, not
the default Perl  structure that the author suggested.  (No good reason
really).  Anyway,
everything seemed to work fine after  completing the installation.  Then I
went to CPAN and downloaded the
XML-XPath 1.12 module and tried to install it.  I followed the std
instructions for unix systems, but it did not install properly and so now
I am stuck.  I am completely clueless as to what to do.  This is probably
a question for a FAQ, but there does not seem to be one that comes with
this mailing list :) - can someone please help - by explaining how 
to install Perl modules in Mac OS 10.2 (You will need to
make instructions explicit since I am a bit of a computer dummy)

Thanks in advance
David


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




Re: HTML::TokeParser and  

2003-01-29 Thread David Eason
I get a space in my editor output window. but when I run it from a cmd
window, I get the other character. (This is under Windows 2000 and perl
5.8.0)
"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> David Eason wrote:
> >
> > John W. Krahn wrote:
> > > According to HTML::Entities
> > >
> > >  # Some extra Latin 1 chars that are listed in the HTML3.2 draft
> > > (21-May-96)
> > >  copy   => '©',  # copyright sign
> > >  reg=> '®',  # registered sign
> > >  nbsp   => "\240", # non breaking space
> >
> > Thanks, John, I had no idea where to look. I didn't know a non-breaking
> > space was an actual character, I thought it was just a directive to the
> > browser.
>
> AFAIK it is.
>
> > I have corrected the code below accordingly and it prints "line
> > 1line 3" as desired.
>
> FWIW on my computer "\240" prints a "space".  :-)
>
> > use strict;
> > use warnings;
> > use HTML::TokeParser;
> >
> > my $p = HTML::TokeParser->new(*DATA) or die "Can't open: $!";
> > while (my $tag = $p->get_tag())
> > {
> > if ($tag->[0] eq "dd")
> > {
> > my $text = $p->get_trimmed_text();
> > $text =~ s/^[\s\240]*(.*?)[\s\240]*$/$1/;
>
> If you are going to do that then you might as well call get_text and do
> all the trimming yourself.
>
>   my $text = $p->get_text();
>   for ( $text ) {
>   s/^[\s\240]+//;
>   s/[\s\240]+$//;
>   s/[\s\240]+/ /g;
>   }
>
> > print "$text";
> > }
> > }
> >
> > __DATA__
> >
> > line 1
> >  
> > line 3
>
>
> John
> --
> use Perl;
> program
> fulfillment



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




RE: Need help

2003-01-29 Thread Dan Muey

Don't forget to post to list and not just the orginal sender!!
> 
> Dan:
> 
> except that I ran the same script on my local linux box and
> got a similar error regarding headers:
> 
> [Wed Jan 29 09:44:52 2003] [error] [client 192.168.0.202]
> malformed header from script. Bad [EMAIL PROTECTED]: 
> /var/www/cgi-b in/test/test.cgi.

Copy the line that has the $to line in it and send it here.

> 
> Same code that I'm trying to run on the server.
> 
> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 11:18 AM
> To: Ron Geringer
> Subject: RE: Need help
> 
> 
> 
> 
> >
> > Dan:
> >
> > you are right - I could have been a little clearer.
> >
> > Here's the actual error from the log that I get when I run
> the script:
> >
> > qmail-inject: fatal: unable to parse this line:
> > Reply-to: [EMAIL PROTECTED]: Confirmation of your
> > [EMAIL PROTECTED]: text/plain
> > [Wed Jan 29 12:05:44 2003] [error] [client 68.13.40.38] malformed
> > header from script. Bad [EMAIL PROTECTED]
> 
> If you're using qmail it would be better to have the
> qmail-inject path instead of sendmail which is probably a sym 
> link to qmail-inject.
> 
> To open a pipe to qmail-inject you need
> /var/qmail/bin/qmail-inject -f $to_address
> 
> Which means you'll have to modify the open statement to use that.
> 
> Do you know what the -i and -t options do for qmail-inject?
> 
> See you're trying to use sendmail's switches with qmail, do
> they work, have the same options, probably not.
> 
> Could be those switches are causing the bad header becaue
> what they do in sendmail could be totally different than 
> qmail. That is why it's best to use a module or at least use 
> the right program/options.
> 
> Dan
> 
> >
> > Ron
> >
> > -Original Message-
> > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 29, 2003 10:56 AM
> > To: Ron Geringer; [EMAIL PROTECTED]
> > Subject: RE: Need help
> >
> >
> > > I'm pretty much used to scripting sendmail applications in
> > tcl - and
> > > I'm very new to perl so this may be a dumb question. I'm
> > working with
> > > a sendmail script that I got off the internet. The script
> that I'm
> > > working with is listed below:
> > >
> > > #!/usr/bin/perl
> > > use CGI;
> > >
> > > my $query= new CGI;
> > > my $sendmail = "/usr/sbin/sendmail -i -t";
> > > my $reply_to = "Reply-to: geringer2\@cox.net";
> > > my $subject  = "Subject: Confirmation of your submission"; my
> > > $content  = "Thanks for your submission.";
> > > my $to   = $query->param('send_to');
> > > my $file = "subscribers2.txt";
> > >
> > > unless ($to) {
> > >print $query->header;
> > >print "Please fill in your email and try again";
> > > }
> > >
> > > open (FILE, ">>$file") or die "Cannnot open $file: $!"; print
> > > $to,"\n"; close(FILE);
> > >
> > > my $send_to  = "To: ".$query->param('send_to');
> > >
> > > open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail:
> > $!"; print
> > > SENDMAIL $reply_to; print SENDMAIL $subject; print SENDMAIL
> > $to; print
> > > SENDMAIL "Content-type: text/plain\n\n"; print SENDMAIL $content;
> > > close(SENDMAIL);
> > >
> > > print $query->header;
> > > print "Confirmation of your submission will be emailed to
> you."; ~ ~
> > >
> > > --
> > >
> > > The only difference between this and the one I found is
> the "\" in
> > > fron of the "@". When I run this cript - the error that I'm
> > seeing  is
> > > that the header is malformed.
> >
> > If what you're trying to get help on is the malformed header error 
> > then this is probably the problem :
> >
> > You should need to do \@ if you're using double quotes,
> shouldn't need
> > if you use single quotes.
> >
> > Did having that ( the \ in front of the @ ) cause the
> error? Could you
> > be less ambiguous about the problem, is the problem the 'header
> > malformed' error or you can't send mail or ...? What 
> happens when you
> > run it form the command line?
> >
> > You might want to look into a module, they're much easier
> to work with
> > and portable. The one I started working wioth lately is : 
> > http://search.cpan.org/author/JENDA/Mail-Sender-0.8.04/Sender.
> pm
> 
> Or search cpan and find one you like/does what you want and
> you'll probably
> on ly need a few lines of code to do what you want.
> 
> Dan
> 
> >
> > If anyone can tell me what I did wrong - I would appreciate it.
> >
> > What I'm trying to do is put a perl script on a server
> which will take
> > data from an html document and redirect it to an email
> address. Once I
> > get one to work, I'm confident that I can make
> modifications and work
> > with it (testing etc), to better understand how perl makes it works.
> >
> > I would really appreciate any help I can get.
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
F

RE: Help installing Perl and Perl Modules on Mac OS X

2003-01-29 Thread wiggins


On Wed, 29 Jan 2003 11:53:17 -0500 (EST), David Brookes <[EMAIL PROTECTED]> 
wrote:

> Hi Everyone
> 
> This is my first post and I am a complete Perl Newbie.  Here is the
> background: (The next paragraph may be skipped.)
> 



> I basically need help installing perl modules in Mac OS X.  I started by
> installing Perl 5.8 using the instructions given at the website below.
> 
> http://developer.apple.com/internet/macosx/perl.html
> 
> Stupidly (maybe) I installed 5.8 over the 5.6 version that came with
> developer tools.  Basically I followed the Apple directory structure, not
> the default Perl  structure that the author suggested.  (No good reason
> really). 

Sometimes the author knows what they are talking about ;-)...

 Anyway,
> everything seemed to work fine after  completing the installation.  Then I
> went to CPAN and downloaded the
> XML-XPath 1.12 module and tried to install it.  I followed the std
> instructions for unix systems, but it did not install properly and so now
> I am stuck. 

Why?  What was the output and what errors were listed?  If you can give a better 
explanation of "did not install properly" then someone here may be able to help you. 
The other suggestion is to use the power of CPAN's ability to handle module 
installation for you, by reading perldoc CPAN and then issuing:

 perl -MCPAN -e shell

In the future you may want to post mac specific questions to the [EMAIL PROTECTED] list 
(though there are a number of us on both).

http://danconia.org

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




Re: Mail::Sender question

2003-01-29 Thread Jenda Krynicky
From: "Dan Muey" <[EMAIL PROTECTED]>
> Shoot me if this is already in the docs but is it possible to send a
> variable that contains html as an html attachement without it being a
> file first using Mail::Sender?

:-)

Yes it it possible.

$sender = new Mail::Sender {...};
$sender->OpenMultipart({..});
$sender->Body({ctype => 'text/plain', msg => $message_body});
$sender->Part({ctype => 'text/html', disposition => 'attachment',
msg => $html
});
$sender->Close();

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Re: sorting thoughts

2003-01-29 Thread Jenda Krynicky
From: [EMAIL PROTECTED]
> just about to embark on a sorting routine, and I thought before I
> spend ages(at my ability) I would see what thoughts you guys have on 
> this.

As Slobodan Jaksic correctly pointed out a few weeks ago I don't have 
any thoughts of my own. I just point people to docs :-P

See "Far More Than Everything You've Ever Wanted to Know About 
Sorting" : http://www.perl.com/doc/FMTEYEWTK/sort.html
by Tom Christiansen

Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




RE: Need help

2003-01-29 Thread Dan Muey

Please reply to the list and no tjust to me! Hit your mail client's reply-to all 
button and make sure you have the list address in either the to or CC section.
That way we all benefit.

> 
> I'm really new at this so forgive me if I sound stupid. I
> didn't quite understand "Copy the line that has the $to line 
> in it and send it here."

Open the perl script in a text editor
Copy the line that sets the variable that causes the header error by Holding down your 
left mouse button and dragging the mouse over the text, Then right click on the 
highlighted area and select 'copy'.

Then come to this email place the cursor in the message.
Right click and select 'paste'

Send email to me. 

I realize you sent the script before but I don't know if that's the exact same script 
you're running or if it's the original one you got off the net. 

Dan
> 
> Tbe query variable is the variable email that the html
> document inserts and passes on to the perl script. I'm 
> assuming that the $query works with send_to as the original 
> sender. What's really confusing is that when I write a tcl 
> script - I just hardcode the receiver's email (much like the 
> perl script does here), I grab the user's email (usually from 
> a database), assign a variable to it and add that veriable to 
> the same line as the hardcoded email --- and all this is sent 
> using open $X --- multiple prints and the close. Its real 
> easy. Unfortunately, not all servers have tcl loaded so I've 
> got to fall back and learn perl.
> 
> I've been working with a number of perl scripts and so far I
> haven't gotten any of them to work - even if I don't get an 
> error, it still doesn't send anything.
> 
> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 11:52 AM
> To: Ron Geringer
> Subject: RE: Need help
> 
> 
> 
> Don't forget to posyt to list and not just the orginal sender!!
> >
> > Dan:
> >
> > except that I ran the same script on my local linux box and got a
> > similar error regarding headers:
> >
> > [Wed Jan 29 09:44:52 2003] [error] [client 192.168.0.202] malformed
> > header from script. Bad [EMAIL PROTECTED]: /var/www/cgi-b 
> > in/test/test.cgi.
> 
> Copy the line that has the $to line in it and send it here.
> 
> >
> > Same code that I'm trying to run on the server.
> >
> > -Original Message-
> > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 29, 2003 11:18 AM
> > To: Ron Geringer
> > Subject: RE: Need help
> >
> >
> >
> >
> > >
> > > Dan:
> > >
> > > you are right - I could have been a little clearer.
> > >
> > > Here's the actual error from the log that I get when I run
> > the script:
> > >
> > > qmail-inject: fatal: unable to parse this line:
> > > Reply-to: [EMAIL PROTECTED]: Confirmation of your
> > > [EMAIL PROTECTED]: text/plain
> > > [Wed Jan 29 12:05:44 2003] [error] [client 68.13.40.38] malformed
> > > header from script. Bad [EMAIL PROTECTED]
> >
> > If you're using qmail it would be better to have the
> qmail-inject path
> > instead of sendmail which is probably a sym link to qmail-inject.
> >
> > To open a pipe to qmail-inject you need
> /var/qmail/bin/qmail-inject -f
> > $to_address
> >
> > Which means you'll have to modify the open statement to use that.
> >
> > Do you know what the -i and -t options do for qmail-inject?
> >
> > See you're trying to use sendmail's switches with qmail, do
> they work,
> > have the same options, probably not.
> >
> > Could be those switches are causing the bad header becaue
> what they do
> > in sendmail could be totally different than qmail. That is why it's
> > best to use a module or at least use the right program/options.
> >
> > Dan
> >
> > >
> > > Ron
> > >
> > > -Original Message-
> > > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, January 29, 2003 10:56 AM
> > > To: Ron Geringer; [EMAIL PROTECTED]
> > > Subject: RE: Need help
> > >
> > >
> > > > I'm pretty much used to scripting sendmail applications in
> > > tcl - and
> > > > I'm very new to perl so this may be a dumb question. I'm
> > > working with
> > > > a sendmail script that I got off the internet. The script
> > that I'm
> > > > working with is listed below:
> > > >
> > > > #!/usr/bin/perl
> > > > use CGI;
> > > >
> > > > my $query= new CGI;
> > > > my $sendmail = "/usr/sbin/sendmail -i -t";
> > > > my $reply_to = "Reply-to: geringer2\@cox.net";
> > > > my $subject  = "Subject: Confirmation of your submission"; my
> > > > $content  = "Thanks for your submission.";
> > > > my $to   = $query->param('send_to');
> > > > my $file = "subscribers2.txt";
> > > >
> > > > unless ($to) {
> > > >print $query->header;
> > > >print "Please fill in your email and try again";
> > > > }
> > > >
> > > > open (FILE, ">>$file") or die "Cannnot open $file: $!"; print
> > > > $to,"\n"; close(FILE);
> > > >
> > > > my $send_to  = "To: ".$query->param('send_to');
> > > >
> > > > open(SENDMAIL, "|$sendmail") o

RE: Mail::Sender question

2003-01-29 Thread Dan Muey
> 
> From: "Dan Muey" <[EMAIL PROTECTED]>
> > Shoot me if this is already in the docs but is it possible 
> to send a 
> > variable that contains html as an html attachement without 
> it being a 
> > file first using Mail::Sender?
> 
> :-)
> 
> Yes it it possible.
> 
>   $sender = new Mail::Sender {...};
>   $sender->OpenMultipart({..});
>   $sender->Body({ctype => 'text/plain', msg => $message_body});
>   $sender->Part({ctype => 'text/html', disposition => 
> 'attachment',
>   msg => $html
>   });
>   $sender->Close();

That is creamy! Thanks a million! Your module rocks! 
If your ever in St. Louis let me know and I'll buy you a beer!

Dan

> 
> Jenda
> = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
> When it comes to wine, women and song, wizards are allowed 
> to get drunk and croon as much as they like.
>   -- Terry Pratchett in Sourcery
> 
> 
> -- 
> 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]




Apache-Parselog module.

2003-01-29 Thread Rob.Grim
{PRIVATE "TYPE=PICT;ALT=PASS}Hi list, 
  
Thanks for the reactions I got from John and Jenda (I've added you site to my 
favourites) on the Apache-Parselog module. 

Please allow me to ask a few additional questions that came up after reading the  
comments:

Following the link suggested by John:
http://testers.cpan.org/search?request=dist&dist=Apache-ParseLog it has
been tested and works on Windows.

I find two versions of the Apache parselog module:  

1.   MSWin32 4.0 MSWin32-x86  documents this module has been succesfully tested,
2. {PRIVATE "TYPE=PICT;ALT=FAIL"  MSWin32 4.0 MSWin32-x86-multi-thread failed.  
}
Until now I always used the MSWin32-x86-multi-thread version with ppm (activestate) 
when installing a new module. (Activestate documents that the Apache Parselog 
module is not available from them).  

John refers to the  CPAN testers archive which makes clear that the apache-parse log 
module is tested, however the documentation is not very helpful as to how a succesfull 
installation cab be achieved. 

Is it possible to install perl modules without ppm on windows? 

Where can i get  binaries for the tested apache-parselog  version on  MSWin32 4.0 
MSWin32-x86? 

Can someone point me to a instructive file on how to install perl modules from the 
CPAN-archive under windows.

Jenda pointed me to his site  http://Jenda.Krynicky.cz/perl 

However the ppd file only prints: 
Object-oriented Perl extension for parsing Apache log files Akira Hangai 
[EMAIL PROTECTED]) .*no ppd file to download, as I expected. 
Refrased, how is the apache parse log module installed on win32 (without the usual 
activestate multi thread version and ppd-file). 

Thanks, in advance 
Rob Rob Grim 
OSA (Institute for Labour Studies)
Postbus 90153
5000 LE Tilburg 

t: 013-4668077
f: 013-4663349


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




RE: Need help

2003-01-29 Thread Ron Geringer


-Original Message-
From: Ron Geringer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 12:35 PM
To: Dan Muey
Subject: RE: Need help


Thought that's what you meant but didn't want to impose if I was wrong.

Here is the script from my linux box. I'm running it pretty much the way I
took it off the web except I changed the reply-to my email and put the "\"
before the "@".

I've named the script "test.cgi" and put it in my cgi-bin directory on the
linux box.

The html document is in the www/html directory under a subdirectory entitled
"test"

Perl Script:

---

#!/usr/bin/perl
use CGI;

my $query= new CGI;
my $sendmail = "/usr/sbin/sendmail -t";
my $reply_to = "Reply-to: geringer2\@cox.net";
my $subject  = "Subject: Confirmation of your submission";
my $content  = "Thanks for your submission.";
my $to   = $query->param('send_to');
my $file = "subscribers.txt";

unless ($to) {
   print $query->header;
   print "Please fill in your email and try again";
}

open (FILE, ">>$file") or die "Cannnot open $file: $!";
print $to,"\n";
close(FILE);

my $send_to  = "To: ".$query->param('send_to');

open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL $to;
print SENDMAIL "Content-type: text/plain\n\n";
print SENDMAIL $content;
close(SENDMAIL);

print $query->header;
print "Confirmation of your submission will be emailed to you.";
~

---

HTML Script

---




Untitled Document













-

Thanks

-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 12:14 PM
To: Ron Geringer
Subject: RE: Need help




>
> I'm really new at this so forgive me if I sound stupid. I
> didn't quite understand "Copy the line that has the $to line
> in it and send it here."

Open the perl script in a text editor
Copy the line that sets the variable that causes the header error by
Holding down your left mouse button and dragging the mouse over the text,
Then right click on the highlighted area and select 'copy'.

Then come to this email place the cursor in the message.
Right click and select 'paste'

Send email to me.

I realize you sent the script before but I don't know if that's the exact
same script you're running or if it's the original one you got off the net.

Dan
>
> Tbe query variable is the variable email that the html
> document inserts and passes on to the perl script. I'm
> assuming that the $query works with send_to as the original
> sender. What's really confusing is that when I write a tcl
> script - I just hardcode the receiver's email (much like the
> perl script does here), I grab the user's email (usually from
> a database), assign a variable to it and add that veriable to
> the same line as the hardcoded email --- and all this is sent
> using open $X --- multiple prints and the close. Its real
> easy. Unfortunately, not all servers have tcl loaded so I've
> got to fall back and learn perl.
>
> I've been working with a number of perl scripts and so far I
> haven't gotten any of them to work - even if I don't get an
> error, it still doesn't send anything.
>
> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 11:52 AM
> To: Ron Geringer
> Subject: RE: Need help
>
>
>
> Don't forget to posyt to list and not just the orginal sender!!
> >
> > Dan:
> >
> > except that I ran the same script on my local linux box and got a
> > similar error regarding headers:
> >
> > [Wed Jan 29 09:44:52 2003] [error] [client 192.168.0.202] malformed
> > header from script. Bad [EMAIL PROTECTED]: /var/www/cgi-b
> > in/test/test.cgi.
>
> Copy the line that has the $to line in it and send it here.
>
> >
> > Same code that I'm trying to run on the server.
> >
> > -Original Message-
> > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 29, 2003 11:18 AM
> > To: Ron Geringer
> > Subject: RE: Need help
> >
> >
> >
> >
> > >
> > > Dan:
> > >
> > > you are right - I could have been a little clearer.
> > >
> > > Here's the actual error from the log that I get when I run
> > the script:
> > >
> > > qmail-inject: fatal: unable to parse this line:
> > > Reply-to: [EMAIL PROTECTED]: Confirmation of your
> > > [EMAIL PROTECTED]: text/plain
> > > [Wed Jan 29 12:05:44 2003] [error] [client 68.13.40.38] malformed
> > > header from script. Bad [EMAIL PROTECTED]
> >
> > If you're using qmail it would be better to have the
> qmail-inject path
> > instead of sendmail which is probably a sym link to qmail-inject.
> >
> > To open a pipe to qmail-inject you need
> /var/qmail/bin/qmail-inject -f
> > $to_address
> >
> > Which means you'll have to modify the open statement to use that.
> >
> > Do

Re: Apache-Parselog module.

2003-01-29 Thread Jenda Krynicky
From: "Rob.Grim" <[EMAIL PROTECTED]>
> Thanks for the reactions I got from John and Jenda (I've added you
> site to my favourites) on the Apache-Parselog module. 
> 
> Please allow me to ask a few additional questions that came up after
> reading the  comments:
> 
> Following the link suggested by John:
> http://testers.cpan.org/search?request=dist&dist=Apache-ParseLog it
> has been tested and works on Windows.
> 
> I find two versions of the Apache parselog module:  
> 
> 1.   MSWin32 4.0 MSWin32-x86  documents this module has been
> succesfully tested, 

This is I believe the 5.005_07 version

> 2. {PRIVATE "TYPE=PICT;ALT=FAIL"  MSWin32 4.0
> MSWin32-x86-multi-thread failed.

I did not try the module myself (I don't have Apache installed).
I only run its own tests and it did succeed.

> Is it possible to install perl modules without ppm on windows? 

Yes. Normaly you need a C compiler, but some modules do not contain C 
code and all you need then is nmake:
ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe

The process is:
download the .tar.gz from CPAN - http://search.cpan.org/
extract it into a temp directory preserving paths
start the command prompt and go to the created directory
run
Makefile.PL
nmake
nmake test
nmake install
you should be done

 
> Jenda pointed me to his site  http://Jenda.Krynicky.cz/perl 
> 
> However the ppd file only prints: 
> Object-oriented Perl extension for parsing Apache log files Akira
> Hangai [EMAIL PROTECTED]) .*no ppd file to download, as I
> expected. Refrased, how is the apache parse log module installed on
> win32 

You seem to have opened the .ppd in your browser.
You should just run

ppm install http://Jenda.Krynicky.cz/perl/Apache-Parselog.ppd

Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




RE: Need help

2003-01-29 Thread Dan Muey

Check to make sure that the list address is in the to ro cc field.
This one was sent just to me as well.
Any who on to business...
> 
> 
> Thought that's what you meant but didn't want to impose if I 
> was wrong.
> 
> Here is the script from my linux box. I'm running it pretty 
> much the way I took it off the web except I changed the 
> reply-to my email and put the "\" before the "@".
> 
> I've named the script "test.cgi" and put it in my cgi-bin 
> directory on the linux box.
> 
> The html document is in the www/html directory under a 
> subdirectory entitled "test"
> 
> Perl Script:
> 
> ---
> 
> #!/usr/bin/perl
> use CGI;
> 
> my $query= new CGI;
> my $sendmail = "/usr/sbin/sendmail -t";
> my $reply_to = "Reply-to: geringer2\@cox.net";
Change this to 
my $reply_to = 'Reply-to: [EMAIL PROTECTED]';
> my $subject  = "Subject: Confirmation of your submission";
> my $content  = "Thanks for your submission.";
> my $to   = $query->param('send_to');
> my $file = "subscribers.txt";
> 
> unless ($to) {
>print $query->header;
>print "Please fill in your email and try again";
> }
> 
> open (FILE, ">>$file") or die "Cannnot open $file: $!";
> print $to,"\n";
> close(FILE);
> 
> my $send_to  = "To: ".$query->param('send_to');
> 
> open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail : $!"; 
> print SENDMAIL $reply_to; 
> print SENDMAIL $subject; 
> print SENDMAIL $to;

Change the three lines above to :
 print SENDMAIL "$to \n"; 
 print SENDMAIL "$from \n"; # add this line
 print SENDMAIL $reply_to \n"; 
 print SENDMAIL "$subject \n\n";
> print SENDMAIL "Content-type: text/plain\n\n"; 
Get rid of this line
> print SENDMAIL $content; 
> close(SENDMAIL);
> 
> print $query->header;
> print "Confirmation of your submission will be emailed to you."; ~
> 
> --
> -
> 
> HTML Script
> 
> --
> -
> 
>  Transitional//EN">   Untitled 
> Document  content="text/html; charset=iso-8859-1"> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -
> 
> Thanks
> 
> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 12:14 PM
> To: Ron Geringer
> Subject: RE: Need help
> 
> 
> 
> 
> >
> > I'm really new at this so forgive me if I sound stupid. I 
> didn't quite 
> > understand "Copy the line that has the $to line in it and send it 
> > here."
> 
> Open the perl script in a text editor
> Copy the line that sets the variable that causes the header 
> error by Holding down your left mouse button and dragging the 
> mouse over the text, Then right click on the highlighted area 
> and select 'copy'.
> 
> Then come to this email place the cursor in the message.
> Right click and select 'paste'
> 
> Send email to me.
> 
> I realize you sent the script before but I don't know if 
> that's the exact same script you're running or if it's the 
> original one you got off the net.
> 
> Dan
> >
> > Tbe query variable is the variable email that the html document 
> > inserts and passes on to the perl script. I'm assuming that 
> the $query 
> > works with send_to as the original sender. What's really 
> confusing is 
> > that when I write a tcl script - I just hardcode the 
> receiver's email 
> > (much like the perl script does here), I grab the user's email 
> > (usually from a database), assign a variable to it and add that 
> > veriable to the same line as the hardcoded email --- and 
> all this is 
> > sent using open $X --- multiple prints and the close. Its real
> > easy. Unfortunately, not all servers have tcl loaded so I've
> > got to fall back and learn perl.
> >
> > I've been working with a number of perl scripts and so far 
> I haven't 
> > gotten any of them to work - even if I don't get an error, it still 
> > doesn't send anything.
> >
> > -Original Message-
> > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 29, 2003 11:52 AM
> > To: Ron Geringer
> > Subject: RE: Need help
> >
> >
> >
> > Don't forget to posyt to list and not just the orginal sender!!
> > >
> > > Dan:
> > >
> > > except that I ran the same script on my local linux box and got a 
> > > similar error regarding headers:
> > >
> > > [Wed Jan 29 09:44:52 2003] [error] [client 192.168.0.202] 
> malformed 
> > > header from script. Bad [EMAIL PROTECTED]: /var/www/cgi-b 
> > > in/test/test.cgi.
> >
> > Copy the line that has the $to line in it and send it here.
> >
> > >
> > > Same code that I'm trying to run on the server.
> > >
> > > -Original Message-
> > > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, January 29, 2003 11:18 AM
> > > To: Ron Geringer
> > > Subject: RE: Need help
> > >
> > >
> > >
> > >
> > > >
> > > > Dan:
> > > >
> > > > you are right - I could have been a little clearer.
> > > >
> > > > Here's the 

still needing help

2003-01-29 Thread Ron Geringer
Here is the script from my linux box. I'm running it pretty much the way I
took it off the web except I changed the reply-to my email and put the "\"
before the "@".

I've named the script "test.cgi" and put it in my cgi-bin directory on the
linux box.

The html document is in the www/html directory under a subdirectory entitled
"test"

Perl Script:

---

#!/usr/bin/perl
use CGI;

my $query= new CGI;
my $sendmail = "/usr/sbin/sendmail -t";
my $reply_to = "Reply-to: geringer2\@cox.net";
my $subject  = "Subject: Confirmation of your submission";
my $content  = "Thanks for your submission.";
my $to   = $query->param('send_to');
my $file = "subscribers.txt";

unless ($to) {
   print $query->header;
   print "Please fill in your email and try again";
}

open (FILE, ">>$file") or die "Cannnot open $file: $!";
print $to,"\n";
close(FILE);

my $send_to  = "To: ".$query->param('send_to');

open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL $to;
print SENDMAIL "Content-type: text/plain\n\n";
print SENDMAIL $content;
close(SENDMAIL);

print $query->header;
print "Confirmation of your submission will be emailed to you.";
~

---

HTML Script

---




Untitled Document













-

Thanks

-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 12:14 PM
To: Ron Geringer
Subject: RE: Need help




>
> Tbe query variable is the variable email that the html
> document inserts and passes on to the perl script. I'm
> assuming that the $query works with send_to as the original
> sender. What's really confusing is that when I write a tcl
> script - I just hardcode the receiver's email (much like the
> perl script does here), I grab the user's email (usually from
> a database), assign a variable to it and add that veriable to
> the same line as the hardcoded email --- and all this is sent
> using open $X --- multiple prints and the close. Its real
> easy. Unfortunately, not all servers have tcl loaded so I've
> got to fall back and learn perl.
>
> I've been working with a number of perl scripts and so far I
> haven't gotten any of them to work - even if I don't get an
> error, it still doesn't send anything.
>
> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 11:52 AM
> To: Ron Geringer
> Subject: RE: Need help
>
>
>
> Don't forget to posyt to list and not just the orginal sender!!
> >
> > Dan:
> >
> > except that I ran the same script on my local linux box and got a
> > similar error regarding headers:
> >
> > [Wed Jan 29 09:44:52 2003] [error] [client 192.168.0.202] malformed
> > header from script. Bad [EMAIL PROTECTED]: /var/www/cgi-b
> > in/test/test.cgi.
>
> Copy the line that has the $to line in it and send it here.
>
> >
> > Same code that I'm trying to run on the server.
> >
> > -Original Message-
> > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 29, 2003 11:18 AM
> > To: Ron Geringer
> > Subject: RE: Need help
> >
> >
> >
> >
> > >
> > > Dan:
> > >
> > > you are right - I could have been a little clearer.
> > >
> > > Here's the actual error from the log that I get when I run
> > the script:
> > >
> > > qmail-inject: fatal: unable to parse this line:
> > > Reply-to: [EMAIL PROTECTED]: Confirmation of your
> > > [EMAIL PROTECTED]: text/plain
> > > [Wed Jan 29 12:05:44 2003] [error] [client 68.13.40.38] malformed
> > > header from script. Bad [EMAIL PROTECTED]
> >
> > If you're using qmail it would be better to have the
> qmail-inject path
> > instead of sendmail which is probably a sym link to qmail-inject.
> >
> > To open a pipe to qmail-inject you need
> /var/qmail/bin/qmail-inject -f
> > $to_address
> >
> > Which means you'll have to modify the open statement to use that.
> >
> > Do you know what the -i and -t options do for qmail-inject?
> >
> > See you're trying to use sendmail's switches with qmail, do
> they work,
> > have the same options, probably not.
> >
> > Could be those switches are causing the bad header becaue
> what they do
> > in sendmail could be totally different than qmail. That is why it's
> > best to use a module or at least use the right program/options.
> >
> > Dan
> >
> > >
> > > Ron
> > >
> > > -Original Message-
> > > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, January 29, 2003 10:56 AM
> > > To: Ron Geringer; [EMAIL PROTECTED]
> > > Subject: RE: Need help
> > >
> > >
> > > > I'm pretty much used to scripting sendmail applications in
> > > tcl - and
> > > > I'm very new to perl so this may be a dumb question. I'm
> > > working with
> > > > a sendmail script that I got off the internet. The script
> 

Re: HTML::TokeParser and  

2003-01-29 Thread Rob Dixon

"David Eason" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I get a space in my editor output window. but when I run it from a cmd
> window, I get the other character. (This is under Windows 2000 and
perl
> 5.8.0)

Hi David

Windows command prompt doesn't support Unicode, but obviously
your editor does! \240 is at least ten bits long, and so must be
represented in Perl with UTF-8.

Cheers,

Rob




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




Linux Perl Gantt Chart display issue

2003-01-29 Thread John P Walls


Hello,

I've recently been told I am now the PERL support person, even though I've never
worked with Perl before.  I've gone through the O'Reilly Nutshell book, but
cannot solve an issue.  We are running SUSE Linux 8.0 Professional.  We have a
Perl script ( original author is long gone ) that does not display the starting
dates of tasks correctly on a Gantt chart display (generated from the Perl
script).  The start date graph indicators all start from the same point, even
though the actual start dates for the tasks are different.

Can anyone help?  We do not have any other Linux/Perl expertise available here.
I can email a copy of the script upon request.

Thanks in advance for your time and cooperation, it is greatly appreciated.

John Walls
602-431-6020 X-235
[EMAIL PROTECTED]



|--->
|USFCTAZ01/FlipChip |
|USFCTAZ02/FlipChip |
|--->
  >---|
  |01/29/2003 12:59:01 PM - 01/29/2003|
  |12:59:02 PM01/29/2003 12:56:12 PM -|
  |01/29/2003 12:56:12 PM |
  >---|







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




Re: sorting thoughts

2003-01-29 Thread Rob Dixon

"Steven Massey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
m...
> Hi
>
> just about to embark on a sorting routine, and I thought before I
spend
> ages(at my ability) I would see what thoughts you guys have on  this.
>
> I have an array, each line contains fields seperated by ":"
> I want to sort the array numerically ascending by the last field.
>

Hi Steven

This will work. Let us know if you want the code explaining.

Thanks to Ed for his people.

my @array = qw(
fred:lucy:24
john:jane:10
frank:mary:5
rupert:cindy:16
);

my @sorted = sort {
(split ':', $a)[-1] <=> (split ':', $b)[-1]
} @array;

print "$_\n" foreach @sorted;

Cheers,

Rob




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




Weird problem with writing to PostgreSQL through DBI

2003-01-29 Thread Ben Siders
I am parsing some XML and trying to write the tags to a table.  Here is 
the table (PostgreSQL):

Column   |  Type   | Modifiers
---+-+---
id| integer |
ref_id| text|
ref_table | text|
tag   | text|
seq   | integer |

Here is the code where I try to write to the table:

my $CreateMarkup = <
insert into markup (id, ref_id, ref_table, tag, seq) values (:1, :2, :3, 
:4, :5);
EOF
my $mch = $dbw->prepare($CreateMarkup);

  $mch->bind_param(1, $serialID{MarkupId} );
  $mch->bind_param(2, $el->{parent_seq});
  $mch->bind_param(3, $el->{parent_table});
  $mch->bind_param(4, $el->{tag});
  $mch->bind_param(5, $parent->{count});

  $mch->execute();

Simple enough, right?  I put in some debugging to print out what it's 
trying to do.  If the second parameter is 'struct__APIDocStruct_1m0', it 
fails with this error:

DBD::Pg::st execute failed: ERROR:  pg_atoi: error in 
"struct__APIDocStruct_1m0": can't parse "struct__APIDocStruct_1m0" at 
/usr/cms/bsiders/sourcedb/bin/ParseSingleSchemaXml.pl line 946

If the second parameter, however, is 'axes_8h_1a0' it works jsut fine.  
The field is just text.  Why does one random string work and another fail?
--- Begin Message ---
I am parsing some XML and trying to write the tags to a table.  Here is the table (PostgreSQL):

 Column   |  Type   | Modifiers
---+-+---
id| integer |
ref_id| text|
ref_table | text|
tag   | text|
seq   | integer |

Here is the code where I try to write to the table:

my $CreateMarkup = bind_param(1, $serialID{MarkupId} );
   $mch->bind_param(2, $el->{parent_seq});
   $mch->bind_param(3, $el->{parent_table});
   $mch->bind_param(4, $el->{tag});
   $mch->bind_param(5, $parent->{count});

   $mch->execute();

Simple enough, right?  I put in some debugging to print out what it's trying to do.  If the second parameter is 'struct__APIDocStruct_1m0', it fails with this error:

DBD::Pg::st execute failed: ERROR:  pg_atoi: error in "struct__APIDocStruct_1m0": can't parse "struct__APIDocStruct_1m0" at /usr/cms/bsiders/sourcedb/bin/ParseSingleSchemaXml.pl line 946

If the second parameter, however, is 'axes_8h_1a0' it works jsut fine.  The field is just text.  Why does one random string work and another fail?

--
Benjamin J. Siders
Software Engineer




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


Re: Weird problem with writing to PostgreSQL through DBI

2003-01-29 Thread Ben Siders
Nevermind.  Got it figured out.  Turns out I had a bad environment 
variable that was trying to insert into a parallel DB in which the 
ref_id field was defined as 'integer' instead of 'text'.

Ben Siders wrote:

I am parsing some XML and trying to write the tags to a table.  Here 
is the table (PostgreSQL):

Column   |  Type   | Modifiers
---+-+---
id| integer |
ref_id| text|
ref_table | text|
tag   | text|
seq   | integer |

Here is the code where I try to write to the table:

my $CreateMarkup = <
insert into markup (id, ref_id, ref_table, tag, seq) values (:1, :2, 
:3, :4, :5);
EOF
my $mch = $dbw->prepare($CreateMarkup);

  $mch->bind_param(1, $serialID{MarkupId} );
  $mch->bind_param(2, $el->{parent_seq});
  $mch->bind_param(3, $el->{parent_table});
  $mch->bind_param(4, $el->{tag});
  $mch->bind_param(5, $parent->{count});

  $mch->execute();

Simple enough, right?  I put in some debugging to print out what it's 
trying to do.  If the second parameter is 'struct__APIDocStruct_1m0', 
it fails with this error:

DBD::Pg::st execute failed: ERROR:  pg_atoi: error in 
"struct__APIDocStruct_1m0": can't parse "struct__APIDocStruct_1m0" at 
/usr/cms/bsiders/sourcedb/bin/ParseSingleSchemaXml.pl line 946

If the second parameter, however, is 'axes_8h_1a0' it works jsut 
fine.  The field is just text.  Why does one random string work and 
another fail?



Subject:
Weird problem with writing to PostgreSQL through DBI
From:
Ben Siders <[EMAIL PROTECTED]>
Date:
Wed, 29 Jan 2003 14:35:30 -0600
To:
[EMAIL PROTECTED]


I am parsing some XML and trying to write the tags to a table.  Here 
is the table (PostgreSQL):

 Column   |  Type   | Modifiers
---+-+---
id| integer |
ref_id| text|
ref_table | text|
tag   | text|
seq   | integer |

Here is the code where I try to write to the table:

my $CreateMarkup = <
insert into markup (id, ref_id, ref_table, tag, seq) values (:1, :2, 
:3, :4, :5);
EOF
my $mch = $dbw->prepare($CreateMarkup);

   $mch->bind_param(1, $serialID{MarkupId} );
   $mch->bind_param(2, $el->{parent_seq});
   $mch->bind_param(3, $el->{parent_table});
   $mch->bind_param(4, $el->{tag});
   $mch->bind_param(5, $parent->{count});

   $mch->execute();

Simple enough, right?  I put in some debugging to print out what it's 
trying to do.  If the second parameter is 'struct__APIDocStruct_1m0', 
it fails with this error:

DBD::Pg::st execute failed: ERROR:  pg_atoi: error in 
"struct__APIDocStruct_1m0": can't parse "struct__APIDocStruct_1m0" at 
/usr/cms/bsiders/sourcedb/bin/ParseSingleSchemaXml.pl line 946

If the second parameter, however, is 'axes_8h_1a0' it works jsut 
fine.  The field is just text.  Why does one random string work and 
another fail?


--
Benjamin J. Siders
Software Engineer




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




RE: Mail::Sender question

2003-01-29 Thread Dan Muey
So to send an html file attachment (from html in a variable not a file) with images ::
Which is the best way to send the images?
use disposition=inline and the cid:img1 img tag
or
Use disposition=attachment and a regular img tag 

If neither what am I missing?

$sender = new Mail::Sender {...};
$sender->OpenMultipart({..});
$sender->Body({ctype => 'text/plain', msg => $text});
$sender->Part({ctype => 'text/html', disposition => 'attachment',
msg => $contract_html
});
$sender->Attach({
description => 'Infiniplex Logo',
ctype => 'image/gif',
encoding => 'base64',
#Which one of these 'dispositions' would be best if either?
#   disposition => "inline; 
filename=\"infinlogo.gif\";\r\nContent-ID: ",
#   disposition => 'attachment; filename="infinlogo.gif"; 
type="Gif Image"',
file => 'infinlogo.gif'
});
$sender->Close();

Thanks again as usual!

Dan

> 
> From: "Dan Muey" <[EMAIL PROTECTED]>
> > Shoot me if this is already in the docs but is it possible 
> to send a 
> > variable that contains html as an html attachement without 
> it being a 
> > file first using Mail::Sender?
> 
> :-)
> 
> Yes it it possible.
> 
>   $sender = new Mail::Sender {...};
>   $sender->OpenMultipart({..});
>   $sender->Body({ctype => 'text/plain', msg => $message_body});
>   $sender->Part({ctype => 'text/html', disposition => 
> 'attachment',
>   msg => $html
>   });
>   $sender->Close();
> 
> Jenda
> = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
> When it comes to wine, women and song, wizards are allowed 
> to get drunk and croon as much as they like.
>   -- Terry Pratchett in Sourcery
> 
> 
> -- 
> 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: Linux Perl Gantt Chart display issue

2003-01-29 Thread Paul Johnson
On Wed, Jan 29, 2003 at 12:58:57PM -0700, John P Walls wrote:

> Hello,

Hello,

> I've recently been told I am now the PERL support person, even though
> I've never worked with Perl before.

That's fun.  First lesson:  it's Perl, not PERL :-)

>  I've gone through the O'Reilly
> Nutshell book, but cannot solve an issue.  We are running SUSE Linux
> 8.0 Professional.  We have a Perl script ( original author is long
> gone ) that does not display the starting dates of tasks correctly on
> a Gantt chart display (generated from the Perl script).  The start
> date graph indicators all start from the same point, even though the
> actual start dates for the tasks are different.
> 
> Can anyone help?  We do not have any other Linux/Perl expertise
> available here.  I can email a copy of the script upon request.

That's not usually the way we work here.  This mailing list can be very
helpful when people want to learn Perl, and come with specific questions
which indicate that they have done their homework and want to learn.

If you can provide such a question, letting us know what you've done so
far, I'm sure there will be plenty of people willing to help.  Reading a
beginners book is a good start - now give us something to work with.

If you just want someone to get your script working you may find some
generous soul willing to help, but your web site tells me you had sales
of $464 million last year, you might want to consider hiring someone for
the job.

> Thanks in advance for your time and cooperation, it is greatly appreciated.

We look forward to a specific question :-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




Re: sorting thoughts

2003-01-29 Thread david
Steven Massey wrote:

>
> I have an array, each line contains fields seperated by ":"
> I want to sort the array numerically ascending by the last field.
> 
>  my thoughts are to split fields into seperate arrays, go through the last
> array in a comparing process, moving each row index in the original array
> to reflect the sort. ( I found this hard to explain)
> 
> Do any of you some tips as to how to approach this ??
> 

not suprisingly, there are many approach to this. i actually take some time 
to benchmark some of the most populars and see what will be better:

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

use Benchmark;

my @array = ('abcd:xxx:1234','yyy:xxx:2','a:b:12');

sub sr_s{
for(sort {(my $a_value = $a) =~ s/.+:.+://;
  (my $b_value = $b) =~ s/.+:.+://;
  $a_value <=> $b_value} @array){;}
}

sub split_s{
for(sort {my @a_val = split(/:/,$a);
  my @b_val = split(/:/,$b);
  $a_val[2] <=> $b_val[2]} @array){;}
}

sub split_ref_s{
for(sort {(split(/:/,$a))[2] <=> (split(/:/,$b))[2]} @array){;}
}

sub reg_s{
for(sort { my ($i) = $a =~ /(\d+)$/;
   my ($j) = $b =~ /(\d+)$/; $i <=> $j} @array){;}
}

sub reg_ref_s{
for(sort {($a =~ /(\d+)$/)[0] <=> ($b =~ /(\d+)$/)[0]} @array){;}
}

timethese(9,{split_s => \&split_s,
 split_ref_s => \&split_ref_s,
 reg_s   => \®_s,
 reg_ref_s   => \®_ref_s,
 sr_s=> \&sr_s});

__END__

prints:

Benchmark: timing 9 iterations of 

reg_ref_s, reg_s, split_ref_s, split_s, sr_s...

reg_ref_s: 35 wallclock secs (15.13 usr +  0.02 sys = 15.15 CPU) @ 6600.59/s 
(n=9)

 reg_s: 40 wallclock secs (18.17 usr +  0.02 sys = 18.19 CPU) @ 
5497.47/s (n=9)

split_ref_s: 30 wallclock secs (13.87 usr +  0.01 sys = 13.88 CPU) @ 
7204.54/s (n=9)

   split_s: 54 wallclock secs (23.12 usr +  0.03 sys = 23.15 CPU) @ 
4319.61/s (n=9)

  sr_s: 31 wallclock secs (13.37 usr +  0.01 sys = 13.38 CPU) @ 
7473.77/s (n=9)

looks like sr_s is the winner.

david

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




RE: sorting thoughts

2003-01-29 Thread Bob Showalter
david wrote:
> Steven Massey wrote:
> 
> > 
> > I have an array, each line contains fields seperated by ":"
> > I want to sort the array numerically ascending by the last field.
> > 
> >  my thoughts are to split fields into seperate arrays, go through
> > the last array in a comparing process, moving each row index in the
> > original array to reflect the sort. ( I found this hard to explain)
> > 
> > Do any of you some tips as to how to approach this ??
> > 
> 
> not suprisingly, there are many approach to this. i actually take
> some time to benchmark some of the most populars and see what will be
> better: 
> 
> #!/usr/bin/perl -w
> use strict;
> 
> use Benchmark;
> 
> my @array = ('abcd:xxx:1234','yyy:xxx:2','a:b:12');
> 
> sub sr_s{
> for(sort {(my $a_value = $a) =~ s/.+:.+://;
>   (my $b_value = $b) =~ s/.+:.+://;
>   $a_value <=> $b_value} @array){;} }
> 
> sub split_s{
> for(sort {my @a_val = split(/:/,$a);
>   my @b_val = split(/:/,$b);
>   $a_val[2] <=> $b_val[2]} @array){;} }
> 
> sub split_ref_s{
> for(sort {(split(/:/,$a))[2] <=> (split(/:/,$b))[2]}
> @array){;} }
> 
> sub reg_s{
> for(sort { my ($i) = $a =~ /(\d+)$/;
>my ($j) = $b =~ /(\d+)$/; $i <=> $j} @array){;} }
> 
> sub reg_ref_s{
> for(sort {($a =~ /(\d+)$/)[0] <=> ($b =~
> /(\d+)$/)[0]} @array){;}
> }
> 
> timethese(9,{split_s => \&split_s,
>  split_ref_s => \&split_ref_s,
>  reg_s   => \®_s,
>  reg_ref_s   => \®_ref_s,
>  sr_s=> \&sr_s});
> 
> __END__
> 
> prints:
> 
> Benchmark: timing 9 iterations of
> 
> reg_ref_s, reg_s, split_ref_s, split_s, sr_s...
> 
> reg_ref_s: 35 wallclock secs (15.13 usr +  0.02 sys = 15.15 CPU) @
> 6600.59/s (n=9)
> 
>  reg_s: 40 wallclock secs (18.17 usr +  0.02 sys = 18.19 CPU) @
> 5497.47/s (n=9) 
> 
> split_ref_s: 30 wallclock secs (13.87 usr +  0.01 sys = 13.88 CPU) @
> 7204.54/s (n=9) 
> 
>split_s: 54 wallclock secs (23.12 usr +  0.03 sys = 23.15 CPU) @
> 4319.61/s (n=9) 
> 
>   sr_s: 31 wallclock secs (13.37 usr +  0.01 sys = 13.38 CPU) @
> 7473.77/s (n=9) 
> 
> looks like sr_s is the winner.
> 
> david

Don't forget the Schwartzian Transform:

   map $_->[0], 
   sort {$a->[1] <=> $b->[1]} 
   map [$_, (split /:/, $_)[-1]],
   @array

This will be quicker than the other methods, especially as the array size
grows. Try your benchmark with an array of say 10, or 100 elements.

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




RE: sorting thoughts

2003-01-29 Thread david
Bob Showalter wrote:

>
> This will be quicker than the other methods, especially as the array size
> grows. Try your benchmark with an array of say 10, or 100 elements.
>

yes, it's faster. i didn't include the code since this algr. is well known. 
just some number for those who are interested:

Benchmark: timing 9 iterations of reg_ref_s, reg_s, split_ref_s, 
split_s, sr_s, st_s...

 reg_ref_s: 155 wallclock secs (68.77 usr +  0.12 sys = 68.89 CPU) @ 
1451.57/s (n=9)

 reg_s: 204 wallclock secs (90.51 usr +  0.11 sys = 90.62 CPU) @ 
1103.50/s (n=9)

split_ref_s: 139 wallclock secs (63.22 usr +  0.07 sys = 63.29 CPU) @ 
1580.01/s (n=9)

   split_s: 254 wallclock secs (125.16 usr +  0.12 sys = 125.28 CPU) @ 
798.20/s (n=9)

  sr_s: 114 wallclock secs (51.76 usr +  0.06 sys = 51.82 CPU) @ 
1929.74/s (n=9)

  st_s: 74 wallclock secs (35.84 usr +  0.06 sys = 35.90 CPU) @ 
2785.49/s (n=9)

st_s (Schwartzian Transform) is the winner.

david

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




creating hash from name/value found in file.

2003-01-29 Thread Jamie Risk
Okay, it's 5:25pm and I started programming PERL shortly after downloading
the 5.8.0 tarballs at 2:30pm.
I'd like to create a hash from a text file that has name/value pairs, one
per line. So far, I'm only capable of reading it in as a list - this PERL
stuff really seems easy - but can I (excuse the c lingo) 'cast' or refer to
my list (@desc) as a hash somehow?

I've got this so far:


#!/usr/bin/perl -w

if (0 > $#ARGV)
{
  print "Need a file (or files)  describing where to find states and
stimuli.\n";
  exit;
}

foreach my $state_machine (@ARGV)
{
  chomp $state_machine;
  print "Processing the file \"$state_machine\"\n";
  open SM_FILE, $state_machine || die "can't open \"$state_machine\": $!\n";

  while ()
  {
chomp;
unshift (@desc, split);
  }

  foreach my $key (@desc)
  {
print $key, "\n";
  }

  close SM_FILE || die "this is wierd, can't close \"$state_machine\":
$!\n";
}


The "foreach my $key(@desc)" I'd prefer to be something like:
foreach my $key (sort(keys(%desc)))
{
  print $key,'=',$desc{$key};
}





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




RE: creating hash from name/value found in file.

2003-01-29 Thread Timothy Johnson

Why not something like this?

my %hash;
while(){
  chomp $_;#remove the newline
  my($key,$value) = split(/,/,$_); #split by commas or whatever
  $hash{$key} = $value;#assign the value here
}

foreach(sort keys %hash){
  print "$key => $value\n";
}


-Original Message-
From: Jamie Risk [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 2:32 PM
To: [EMAIL PROTECTED]
Subject: creating hash from name/value found in file.


Okay, it's 5:25pm and I started programming PERL shortly after downloading
the 5.8.0 tarballs at 2:30pm.
I'd like to create a hash from a text file that has name/value pairs, one
per line. So far, I'm only capable of reading it in as a list - this PERL
stuff really seems easy - but can I (excuse the c lingo) 'cast' or refer to
my list (@desc) as a hash somehow?

I've got this so far:


#!/usr/bin/perl -w

if (0 > $#ARGV)
{
  print "Need a file (or files)  describing where to find states and
stimuli.\n";
  exit;
}

foreach my $state_machine (@ARGV)
{
  chomp $state_machine;
  print "Processing the file \"$state_machine\"\n";
  open SM_FILE, $state_machine || die "can't open \"$state_machine\": $!\n";

  while ()
  {
chomp;
unshift (@desc, split);
  }

  foreach my $key (@desc)
  {
print $key, "\n";
  }

  close SM_FILE || die "this is wierd, can't close \"$state_machine\":
$!\n";
}


The "foreach my $key(@desc)" I'd prefer to be something like:
foreach my $key (sort(keys(%desc)))
{
  print $key,'=',$desc{$key};
}





-- 
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: creating hash from name/value found in file.

2003-01-29 Thread Toby Stuart


> -Original Message-
> From: Jamie Risk [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 9:32 AM
> To: [EMAIL PROTECTED]
> Subject: creating hash from name/value found in file.
> 
> 
> Okay, it's 5:25pm and I started programming PERL shortly 
> after downloading
> the 5.8.0 tarballs at 2:30pm.
> I'd like to create a hash from a text file that has 
> name/value pairs, one
> per line. So far, I'm only capable of reading it in as a list 
> - this PERL
> stuff really seems easy - but can I (excuse the c lingo) 
> 'cast' or refer to
> my list (@desc) as a hash somehow?
> 

Firstly it's good practice to 'use strict;' in all scripts.


> I've got this so far:
> 
> 
> #!/usr/bin/perl -w
> 
use strict;

my %pairs; # hash to store key/value pairs
my ($key, $value);

> if (0 > $#ARGV)
> {
>   print "Need a file (or files)  describing where to find states and
> stimuli.\n";
>   exit;
> }
> 
> foreach my $state_machine (@ARGV)
> {
>   chomp $state_machine;
>   print "Processing the file \"$state_machine\"\n";
>   open SM_FILE, $state_machine || die "can't open 
> \"$state_machine\": $!\n";
> 
>   while ()
>   {
> chomp;
> unshift (@desc, split);

# not sure what your delimeter is but say it is an equal sign
($key,$value) = split(/=/, $_);
$pairs{$key} = $value;

>   }
> 
[snipped now redundant section]
> 
>   close SM_FILE || die "this is wierd, can't close \"$state_machine\":
> $!\n";
> }
> 
> 
> The "foreach my $key(@desc)" I'd prefer to be something like:
> foreach my $key (sort(keys(%desc)))
> {
>   print $key,'=',$desc{$key};
> }
> 

while (($key,$value) = each %pairs)
{
print "$key=$value\n";
}





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




Re: creating hash from name/value found in file.

2003-01-29 Thread Jamie Risk
Thanks, Timothy, I almost had it before I decided to look back at the list.
My only concern was the creation of data space for each new key, I guess
it's a non issue. ALTHOUGH, if I have repetitions of keys, code below would
obliterate previous key data, would it not? I guess I'm looking at a hash of
lists. hmm

- Jamei

"Timothy Johnson"
>
> Why not something like this?
>
> my %hash;
> while(){
>   chomp $_;#remove the newline
>   my($key,$value) = split(/,/,$_); #split by commas or whatever
>   $hash{$key} = $value;#assign the value here
> }
>
> foreach(sort keys %hash){
>   print "$key => $value\n";
> }
>




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




Re: HTML::TokeParser and  

2003-01-29 Thread John W. Krahn
Rob Dixon wrote:
> 
> "David Eason" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I get a space in my editor output window. but when I run it from a cmd
> > window, I get the other character. (This is under Windows 2000 and
> perl
> > 5.8.0)
> 
> Windows command prompt doesn't support Unicode, but obviously
> your editor does! \240 is at least ten bits long, and so must be
> represented in Perl with UTF-8.

$ perl -e'printf "%b\n", ord "\240"'
1010

I count eight bits.  ;-/



John
-- 
use Perl;
program
fulfillment

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




RE: creating hash from name/value found in file.

2003-01-29 Thread Timothy Johnson

Yep, or a list of hashes.  Being that you've only used it for a little
while, you probably haven't had time to look through the *extensive*
documentation.  Try checking out "perldoc perlreftut" and "perldoc perlref"
and "perldoc perllol".

-Original Message-
From: Jamie Risk [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 3:03 PM
To: [EMAIL PROTECTED]
Subject: Re: creating hash from name/value found in file.


Thanks, Timothy, I almost had it before I decided to look back at the list.
My only concern was the creation of data space for each new key, I guess
it's a non issue. ALTHOUGH, if I have repetitions of keys, code below would
obliterate previous key data, would it not? I guess I'm looking at a hash of
lists. hmm

- Jamei

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




RE: Mail::Sender question

2003-01-29 Thread Jenda Krynicky
From: "Dan Muey" <[EMAIL PROTECTED]>

> So to send an html file attachment (from html in a variable not a
> file) with images :: Which is the best way to send the images? use
> disposition=inline and the cid:img1 img tag or Use
> disposition=attachment and a regular img tag 

Well this can get a bit complex. Most probably you'll have to 
experiment a bit. Maybe even with nested multipart parts (bleargh).

Try one thing first. Add

multipart => 'Related'

into the OpenMultipart({...}) call and use disposition=>'inline' + 
cids for the images.

If this doesn't work try:

$sender = new Mail::Sender {...};
$sender->OpenMultipart({..});
$sender->Body({ctype => 'text/plain', msg => $text});
$sender->Part({ctype => 'multipart/related'});
$sender->Part({ctype => 'text/html', disposition => 'attachment',
msg => $contract_html
});
$sender->Attach({
description => 'Infiniplex Logo',
ctype => 'image/gif',
encoding => 'base64',
disposition => "inline; 
filename=\"infinlogo.gif\";\r\nContent-ID:
",
file => 'infinlogo.gif'
});
$sender->EndPart("multipart/related");
$sender->Close();

Jenda

= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Re: still needing help

2003-01-29 Thread jdavis
i have not been following this thread...but it appears as if you just
want a generic cgi scrip to work...I like to use  &ReadParse for
most of my easy cgi interactions ...heer is a example..

if you had a form varable like so



you could use ReadParse like this...

#!/usr/bin/perl

&ReadParse;

print "$in{email}\n";

#all you need to do is paste this at the bottom
# of your cgi scrip and refer to the form vars by
#ther name using the method above...

# Adapted from cgi-lib.pl by [EMAIL PROTECTED] 
# Copyright 1994 Steven E. Brenner 
sub ReadParse {
  local (*in) = @_ if @_;
  local ($i, $key, $val);

  if ( $ENV{'REQUEST_METHOD'} eq "GET" ) { 
$in = $ENV{'QUERY_STRING'}; 
  } elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
  } else {
# Added for command line debugging
# Supply name/value form data as a command line argument
# Format: name1=value1\&name2=value2\&... 
# (need to escape & for shell)
# Find the first argument that's not a switch (-)
$in = ( grep( !/^-/, @ARGV )) [0];
$in =~ s/\\&/&/g;
  }

  @in = split(/&/,$in);

  foreach $i (0 .. $#in) {
# Convert plus's to spaces
$in[$i] =~ s/\+/ /g;

# Split into key and value.
($key, $val) = split(/=/,$in[$i],2); # splits on the first =.

# Convert %XX from hex numbers to alphanumeric
$key =~ s/%(..)/pack("c",hex($1))/ge;   
$val =~ s/%(..)/pack("c",hex($1))/ge;

# Associate key and value. \0 is the multiple separator
$in{$key} .= "\0" if (defined($in{$key})); 
$in{$key} .= $val;
  }
  return length($in);
}  


good luck,
jd

fine jewelry

http://www.kastnerotte.com




On Wed, 2003-01-29 at 11:58, Ron Geringer wrote:
> Here is the script from my linux box. I'm running it pretty much the way I
> took it off the web except I changed the reply-to my email and put the "\"
> before the "@".
> 
> I've named the script "test.cgi" and put it in my cgi-bin directory on the
> linux box.
> 
> The html document is in the www/html directory under a subdirectory entitled
> "test"
> 
> Perl Script:
> 
> ---
> 
> #!/usr/bin/perl
> use CGI;
> 
> my $query= new CGI;
> my $sendmail = "/usr/sbin/sendmail -t";
> my $reply_to = "Reply-to: geringer2\@cox.net";
> my $subject  = "Subject: Confirmation of your submission";
> my $content  = "Thanks for your submission.";
> my $to   = $query->param('send_to');
> my $file = "subscribers.txt";
> 
> unless ($to) {
>print $query->header;
>print "Please fill in your email and try again";
> }
> 
> open (FILE, ">>$file") or die "Cannnot open $file: $!";
> print $to,"\n";
> close(FILE);
> 
> my $send_to  = "To: ".$query->param('send_to');
> 
> open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
> print SENDMAIL $reply_to;
> print SENDMAIL $subject;
> print SENDMAIL $to;
> print SENDMAIL "Content-type: text/plain\n\n";
> print SENDMAIL $content;
> close(SENDMAIL);
> 
> print $query->header;
> print "Confirmation of your submission will be emailed to you.";
> ~
> 
> ---
> 
> HTML Script
> 
> ---
> 
> 
> 
> 
> Untitled Document
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -
> 
> Thanks
> 
> -Original Message-
> From: Dan Muey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 12:14 PM
> To: Ron Geringer
> Subject: RE: Need help
> 
> 
> 
> 
> >
> > Tbe query variable is the variable email that the html
> > document inserts and passes on to the perl script. I'm
> > assuming that the $query works with send_to as the original
> > sender. What's really confusing is that when I write a tcl
> > script - I just hardcode the receiver's email (much like the
> > perl script does here), I grab the user's email (usually from
> > a database), assign a variable to it and add that veriable to
> > the same line as the hardcoded email --- and all this is sent
> > using open $X --- multiple prints and the close. Its real
> > easy. Unfortunately, not all servers have tcl loaded so I've
> > got to fall back and learn perl.
> >
> > I've been working with a number of perl scripts and so far I
> > haven't gotten any of them to work - even if I don't get an
> > error, it still doesn't send anything.
> >
> > -Original Message-
> > From: Dan Muey [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 29, 2003 11:52 AM
> > To: Ron Geringer
> > Subject: RE: Need help
> >
> >
> >
> > Don't forget to posyt to list and not just the orginal sender!!
> > >
> > > Dan:
> > >
> > > except that I ran the same script on my local linux box and got a
> > > similar error regarding headers:
> > >

Re: Linux Perl Gantt Chart display issue

2003-01-29 Thread John W. Krahn
John P Walls wrote:
> 
> Hello,

Hello,

> I've recently been told I am now the PERL support person, even though I've never
> worked with Perl before.  I've gone through the O'Reilly Nutshell book, but
> cannot solve an issue.  We are running SUSE Linux 8.0 Professional.

Good choice!  :-)

> We have a
> Perl script ( original author is long gone ) that does not display the starting
> dates of tasks correctly on a Gantt chart display (generated from the Perl
> script).  The start date graph indicators all start from the same point, even
> though the actual start dates for the tasks are different.
> 
> Can anyone help?  We do not have any other Linux/Perl expertise available here.
> I can email a copy of the script upon request.

If you can describe what the code does or doesn't do and what you want
it to do and enough code to demonstrate the problem then someone should
be able to help you.  If you don't know enough Perl to be able to do
that then either post a URL to the program or find a Perl
expert/consultant near you.

http://jobs.perl.org/
http://www.pm.org/groups/index.html

Posting guidelines for comp.lang.perl.misc describe how to ask a Perl
question.
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



John
-- 
use Perl;
program
fulfillment

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




Re: HTML::TokeParser and  

2003-01-29 Thread Rob Dixon
"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Rob Dixon wrote:
> >
> > "David Eason" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I get a space in my editor output window. but when I run it from a
cmd
> > > window, I get the other character. (This is under Windows 2000 and
> > perl
> > > 5.8.0)
> >
> > Windows command prompt doesn't support Unicode, but obviously
> > your editor does! \240 is at least ten bits long, and so must be
> > represented in Perl with UTF-8.
>
> $ perl -e'printf "%b\n", ord "\240"'
> 1010
>
> I count eight bits.  ;-/

Quite right, I'm completely off beam here! I always use hex, never
octal, so saw a \x that wasn't there :-/

Truth is,  \xA0 is non-breaking space in ISO Latin 1, and a-acute in
Extended ASCII.

HTH,

Rob




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




Re: creating hash from name/value found in file.

2003-01-29 Thread John W. Krahn
Jamie Risk wrote:
> 
> Okay, it's 5:25pm and I started programming PERL shortly after downloading
> the 5.8.0 tarballs at 2:30pm.
> I'd like to create a hash from a text file that has name/value pairs, one
> per line. So far, I'm only capable of reading it in as a list - this PERL
> stuff really seems easy - but can I (excuse the c lingo) 'cast' or refer to
> my list (@desc) as a hash somehow?

You could but you probably want to use a hash instead.  Unless the keys
are not unique because perl's hash keys have to be unique.

my %hash;

$hash{one} = 1;
# creates a key 'one' with the value 1
$hash{one} = 'one';
# oops, overwrote the value 1 with 'one'

BTW, @desc is an array NOT a list

perldoc -q "What is the difference between a list and an array"



> I've got this so far:
> 
> 
> #!/usr/bin/perl -w
> 
> if (0 > $#ARGV)
> {
>   print "Need a file (or files)  describing where to find states and
> stimuli.\n";
>   exit;
> }

It is more idiomatic to use an array in a scalar context then to use the
index of the last element in the array.

die "Need a file (or files)  describing where to find states and
stimuli.\n"
unless @ARGV;


> foreach my $state_machine (@ARGV)

Perl provides a built-in mechanism for reading from all the files on the
command line.

while ( <> ) {

This will open each file on the command line and put the current line in
the $_ variable.


> {
>   chomp $state_machine;

It is VERY unlikely that command line input will be terminated with a
newline as the shell splits the arguments on whitespace.


>   print "Processing the file \"$state_machine\"\n";
>   open SM_FILE, $state_machine || die "can't open \"$state_machine\": $!\n";

This will be parsed by perl as:

open SM_FILE, ( $state_machine || die "can't open \"$state_machine\":
$!\n" );

Which means that the die() will only execute if the value of
$state_machine is false.  You need to use the low precedence 'or' or use
parenthesis to set the correct precedence.


>   while ()
>   {
> chomp;
> unshift (@desc, split);

If you know that the keys will be unique then use a hash:

my ( $key, $val ) = split /=/;
$hash{ $key } = $val;

If not then you could use an array of arrays:

push @array, [ split /=/ ];


>   }
> 
>   foreach my $key (@desc)
>   {
> print $key, "\n";
>   }
> 
>   close SM_FILE || die "this is wierd, can't close \"$state_machine\":
> $!\n";
> }
> 
> 
> The "foreach my $key(@desc)" I'd prefer to be something like:
> foreach my $key (sort(keys(%desc)))
> {
>   print $key,'=',$desc{$key};
> }



John
-- 
use Perl;
program
fulfillment

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




Re: creating hash from name/value found in file.

2003-01-29 Thread Jamie Risk
Thanks for the pointers to the documentation.

I'm happily playing with a hash of a hash of lists which is ideal for the
problem I'm wanted to solve.

This PERL stuff is great!

- Jamie

"Timothy Johnson" <[EMAIL PROTECTED]> wrote in message
C0FD5BECE2F0C84EAA97D7300A500D50046DD4BE@SMILEY">news:C0FD5BECE2F0C84EAA97D7300A500D50046DD4BE@SMILEY...
>
> Yep, or a list of hashes.  Being that you've only used it for a little
> while, you probably haven't had time to look through the *extensive*
> documentation.  Try checking out "perldoc perlreftut" and "perldoc
perlref"
> and "perldoc perllol".
>
> -Original Message-
> From: Jamie Risk [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 29, 2003 3:03 PM
> To: [EMAIL PROTECTED]
> Subject: Re: creating hash from name/value found in file.
>
>
> Thanks, Timothy, I almost had it before I decided to look back at the
list.
> My only concern was the creation of data space for each new key, I guess
> it's a non issue. ALTHOUGH, if I have repetitions of keys, code below
would
> obliterate previous key data, would it not? I guess I'm looking at a hash
of
> lists. hmm
>
> - Jamei




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




Help about Regex

2003-01-29 Thread lielie meimei
I'm newbie..
Would u help me to explain this regex:

=[td]s/$directory/

What is the meaning of [td]???, because there is no
metacharacter or regex that use [td].


Thanks for your help.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




Parsing Fixed Length data

2003-01-29 Thread Kevin Old
Hello all,

I have run into a situation that I've never faced before.  I've always
parsed delimited (comma, pipe, etc) data.  Now I'm faced with parsing
fixed-width data.  That's fine and I understand how to do it and have
even found a module for it (Parse::FixedLength).

Say I have the following string and the first 10 characters are the
first name, the second 10 are the last name and the next 7 are the
price.

 KevinOld001.000

I understand that with the name fields I can just strip off the \s
characters and then I have my first name, but what about the price? 
Some times it could be like 1000.00 or 0100.00but with the preceding
zeros it makes it confusing.  Do I need to explicitly strip off the
preceding zeros?  

Any help on dealing with fixed width data is appreciated,

Kevin
-- 
Kevin Old <[EMAIL PROTECTED]>


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




RE: Help about Regex

2003-01-29 Thread Mark Anderson
Is this in pseudocode or in working code?  

I would guess that it is some sort of meta- for tilde (~), since you
need =~ before the s/// construct.

/\/\ark

-Original Message-
From: lielie meimei [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 5:10 PM
To: [EMAIL PROTECTED]
Subject: Help about Regex


I'm newbie..
Would u help me to explain this regex:

=[td]s/$directory/

What is the meaning of [td]???, because there is no
metacharacter or regex that use [td].


Thanks for your help.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.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]




system call

2003-01-29 Thread jdavis
hello,
  Could someont tell me the secure way
to get input from a system call
like...

$date = `/bin/date`;

or

$client = `/usr/bin/finsmb`;

TIA,
-- 
jd
[EMAIL PROTECTED]

Bad spellers of the world untie!



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




Re: Parsing Fixed Length data

2003-01-29 Thread Wiggins d'Anconia
Kevin Old wrote:

Hello all,

I have run into a situation that I've never faced before.  I've always
parsed delimited (comma, pipe, etc) data.  Now I'm faced with parsing
fixed-width data.  That's fine and I understand how to do it and have
even found a module for it (Parse::FixedLength).

Say I have the following string and the first 10 characters are the
first name, the second 10 are the last name and the next 7 are the
price.

 KevinOld001.000

I understand that with the name fields I can just strip off the \s
characters and then I have my first name, but what about the price? 
Some times it could be like 1000.00 or 0100.00but with the preceding
zeros it makes it confusing.  Do I need to explicitly strip off the
preceding zeros?  

Any help on dealing with fixed width data is appreciated,

perldoc -f pack
perldoc -f unpack

Should get you started.

http://danconia.org


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




Re: system call

2003-01-29 Thread simran
not sure what you mean... but try:

  perldoc perlsec

as a starting point... 


On Thu, 2003-01-30 at 12:38, jdavis wrote:
> hello,
>   Could someont tell me the secure way
> to get input from a system call
> like...
> 
> $date = `/bin/date`;
> 
> or
> 
> $client = `/usr/bin/finsmb`;
> 
> TIA,
> -- 
> jd
> [EMAIL PROTECTED]
> 
> Bad spellers of the world untie!



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




RE: Parsing Fixed Length data

2003-01-29 Thread Toby Stuart


> -Original Message-
> From: Kevin Old [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 12:18 PM
> To: [EMAIL PROTECTED]
> Subject: Parsing Fixed Length data
> 
> 
> Hello all,
> 
> I have run into a situation that I've never faced before.  I've always
> parsed delimited (comma, pipe, etc) data.  Now I'm faced with parsing
> fixed-width data.  That's fine and I understand how to do it and have
> even found a module for it (Parse::FixedLength).
> 
> Say I have the following string and the first 10 characters are the
> first name, the second 10 are the last name and the next 7 are the
> price.
> 
>  KevinOld001.000
> 
> I understand that with the name fields I can just strip off the \s
> characters and then I have my first name, but what about the price? 
> Some times it could be like 1000.00 or 0100.00but with 
> the preceding
> zeros it makes it confusing.  Do I need to explicitly strip off the
> preceding zeros?  
> 
> Any help on dealing with fixed width data is appreciated,
> 
> Kevin
> -- 



perldoc -f unpack


use strict;
use warnings;

my %records;

my $surname;
my $given_name;
my $price;

my @fields;

my $i=0;
while ()
{
@fields = unpack("A10A10A7", $_);

$records{$i} = { 
given_name => $fields[0],
surname=> $fields[1],
price  => $fields[2]
};

$i++;
}

print "$records{0}{surname}\n";
print "$records{0}{given_name}\n";
print "$records{0}{price}\n";

print "\n";

print "$records{1}{surname}\n";
print "$records{1}{given_name}\n";
print "$records{1}{price}\n";


__DATA__
Kevin Old   001.000
Someone   Else1.000


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




Re: Parsing Fixed Length data

2003-01-29 Thread John W. Krahn
Kevin Old wrote:
> 
> Hello all,

Hello,

> I have run into a situation that I've never faced before.  I've always
> parsed delimited (comma, pipe, etc) data.  Now I'm faced with parsing
> fixed-width data.  That's fine and I understand how to do it and have
> even found a module for it (Parse::FixedLength).

You would usually use unpack() for this.

> Say I have the following string and the first 10 characters are the
> first name, the second 10 are the last name and the next 7 are the
> price.
> 
>  KevinOld001.000
  1234567890123456789012345678

Usually, text fields in fixed length format are left justified.

> I understand that with the name fields I can just strip off the \s
> characters and then I have my first name, but what about the price?
> Some times it could be like 1000.00 or 0100.00but with the preceding
> zeros it makes it confusing.  Do I need to explicitly strip off the
> preceding zeros?

No.

> Any help on dealing with fixed width data is appreciated,

my $record = ' Kevin   Old001.000';

my ( $first, $last, $price ) = unpack 'A10 A10 A7', $record;

# If the fields are right justified then:
my ( $first, $last, $price ) = map { s/^\s+//; $_ } unpack 'A10 A10 A7', $record;


Note that the 'A' format to unpack will automatically strip trailing whitespace.



John
-- 
use Perl;
program
fulfillment

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




Re: system call

2003-01-29 Thread John W. Krahn
Jdavis wrote:
> 
> hello,

Hello,

>   Could someont tell me the secure way
> to get input from a system call
> like...
> 
> $date = `/bin/date`;
> 
> or
> 
> $client = `/usr/bin/finsmb`;

The output from using backticks is just data and so is not inherently
insecure.  However, how do you know that /bin/date is the real /bin/date
and not a cracker program installed by someone who has broken in to your
system?  Whenever possible use perl's built-in functions ($date =
localtime;).  The perlsec document will explain security in more detail.

perldoc perlsec



John
-- 
use Perl;
program
fulfillment

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




how to use pos function

2003-01-29 Thread kasi ramanathen

hi friends

i want to use pos function please give me an example.

while($ln=~m/([…-])/g)
{
 print pos;
 print "*$1*\n";
}

kasi

Catch all the cricket action. Download Yahoo! Score tracker


Re: Parsing Fixed Length data

2003-01-29 Thread John W. Krahn
Toby Stuart wrote:
> 
> use strict;
> use warnings;
> 
> my %records;
> 
> my $surname;
> my $given_name;
> my $price;

You create these three variables because?

> my @fields;

You should declare this _inside_ the loop.

> my $i=0;
> while ()
> {
> @fields = unpack("A10A10A7", $_);

  my @fields = unpack 'A10A10A7', $_;


> $records{$i} = {
  
Why not just use an array?


> given_name => $fields[0],
> surname=> $fields[1],
> price  => $fields[2]
> };

push @records, { given_name => $fields[0],
 surname=> $fields[1],
 price  => $fields[2] };

Or:

@{$records[$i++]}{ qw/given_name surname price/ } = unpack
'A10A10A7', $_;


> $i++;
> }
> 
> print "$records{0}{surname}\n";
> print "$records{0}{given_name}\n";
> print "$records{0}{price}\n";
> 
> print "\n";
> 
> print "$records{1}{surname}\n";
> print "$records{1}{given_name}\n";
> print "$records{1}{price}\n";
> 
> __DATA__
> Kevin Old   001.000
> Someone   Else1.000








John
-- 
use Perl;
program
fulfillment

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




Re: how to use pos function

2003-01-29 Thread John W. Krahn
Kasi ramanathen wrote:
> 
> hi friends

Hello,

> i want to use pos function please give me an example.
> 
> while($ln=~m/([?-])/g)
> {
>  print pos;

   print pos $ln;

>  print "*$1*\n";
> }


John
-- 
use Perl;
program
fulfillment

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




RE: Parsing Fixed Length data

2003-01-29 Thread Toby Stuart


> -Original Message-
> From: John W. Krahn [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 30, 2003 2:16 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Parsing Fixed Length data
> 
> 
> Toby Stuart wrote:
> > 
> > use strict;
> > use warnings;
> > 
> > my %records;
> > 
> > my $surname;
> > my $given_name;
> > my $price;
> 
> You create these three variables because?
> 

whoops.  was playing around with alternative solutions and forgot to remove
them :(

> > my @fields;
> 
> You should declare this _inside_ the loop.
> 

point taken.

> > my $i=0;
> > while ()
> > {
> > @fields = unpack("A10A10A7", $_);
> 
>   my @fields = unpack 'A10A10A7', $_;
> 
> 
> > $records{$i} = {
>   
> Why not just use an array?

different strokes for different strokes :)

> 
> 
> > given_name => $fields[0],
> > surname=> $fields[1],
> > price  => $fields[2]
> > };
> 
> push @records, { given_name => $fields[0],
>  surname=> $fields[1],
>  price  => $fields[2] };
> 
> Or:
> 
> @{$records[$i++]}{ qw/given_name surname price/ } = unpack
> 'A10A10A7', $_;
> 

i like that!

> 
> > $i++;
> > }
> > 
> > print "$records{0}{surname}\n";
> > print "$records{0}{given_name}\n";
> > print "$records{0}{price}\n";
> > 
> > print "\n";
> > 
> > print "$records{1}{surname}\n";
> > print "$records{1}{given_name}\n";
> > print "$records{1}{price}\n";
> > 
> > __DATA__
> > Kevin Old   001.000
> > Someone   Else1.000
> 
> 

> 

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




how to use pos fn.

2003-01-29 Thread kasi ramanathen

hi,

i want to just use a pos function to indicate the position of the match.

help me

kasi

Catch all the cricket action. Download Yahoo! Score tracker


RE: Parsing Fixed Length data

2003-01-29 Thread Toby Stuart

> > > my $i=0;
> > > while ()
> > > {
> > > @fields = unpack("A10A10A7", $_);
> > 
> >   my @fields = unpack 'A10A10A7', $_;
> > 
> > 
> > > $records{$i} = {
> >   
> > Why not just use an array?
> 
> different strokes for different strokes :)

Now that reads a bit weird.
Folks, i meant folks...but i guess u knew that.

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




Re: A very annoying regex question.

2003-01-29 Thread Robert Citek

Hello Zeus,

At 11:55 AM 1/29/2003 -0500, Zeus Odin wrote:
>An even shorter version of yours is:
>-
>my @a;
>while(){
>   next unless /=/ && chomp;
>   push @a, split /=/, $_, 2;
>}
>print "$_\n" for @a;
>-

This is even shorter, eliminates all uses of variables, and slurps in the
data all at once:

#!/usr/bin/perl -w0
print join("\n", map({split(/=/,$_,2)} grep(/=/, split(/\n/, ;

The only thing it does not do is use the regex.  Is the regex a requirement?

Regards,
- Robert


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




Re: A very annoying regex question.

2003-01-29 Thread John W. Krahn
Robert Citek wrote:
> 
> Hello Zeus,
> 
> At 11:55 AM 1/29/2003 -0500, Zeus Odin wrote:
> >An even shorter version of yours is:
> >-
> >my @a;
> >while(){
> >   next unless /=/ && chomp;
> >   push @a, split /=/, $_, 2;
> >}
> >print "$_\n" for @a;
> >-
> 
> This is even shorter, eliminates all uses of variables, and slurps in the
> data all at once:
> 
> #!/usr/bin/perl -w0
> print join("\n", map({split(/=/,$_,2)} grep(/=/, split(/\n/, ;
> 
> The only thing it does not do is use the regex.  Is the regex a requirement?

It is not _quite_ the same.  Your version uses "\0" as the input record
separator (-0 in perlrun) and doesn't print a newline after the last
record (join "\n").  If you want to slurp the whole file use the -0777
switch or undefine $/.  But why slurp the file and then split it on
newlines?

This will do it correctly:

perl -ne's/=/\n/&&print' yourfile.txt

Or in a program:

while (  ) {
s/=/\n/ && print;
}




John
-- 
use Perl;
program
fulfillment

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




Re: how to use pos fn.

2003-01-29 Thread Jeff 'japhy' Pinyan
On Jan 30, kasi ramanathen said:

>i want to just use a pos function to indicate the position of the match.

pos() doesn't tell you that.  It tells you where the NEXT match will START
looking.  If you're using Perl 5.6 or later, you can use the $-[0]
variable (that is element 0 of the @- array) to get the starting position
of the current match.  If you're using an older version of Perl, you'll
have to do something like

  pos($str) - length($&)

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
 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: help me to replace ascii charecter with some other ascii charector or text

2003-01-29 Thread R. Joseph Newton
"John W. Krahn" wrote:

> You might get some help by looking at the source for Demoronizer
>
> http://www.fourmilab.ch/webtools/demoroniser/

Hi John,

Well, it was a cute read, I must say.  The only problem is that I'm not sure quite 
what application he was talking about.  You see, I just tested the text you suggested, 
along with a couple other lines of my own surrounding it.  I just re-installed Office 
2K so I haven't gotten around to killing the Auto-Correct and "Autoformat as you type" 
features.  So I got the smart quotes and dashes.  The dash [0x2c] remained, but the 
quotes were all turned to standard 0x27 '"'.  I threw in a couple other goodies, too, 
the most revealing of which was two ways to get a copyright to print in Word.

In the original Word in doc format, I used the insert|symbol... feature to insert the 
copyright mark before MS.  I used a text escape later, before apostrophes.  When I 
saved as text, the inserted symbol took on varied translations, but the text (c) was 
restored to the form originally entered.


#!/usr/bin/perl -w

use strict;

open IN, ";
close IN;
foreach my $Line (@Lines) {
#  my $Line = ;
  my @Chars = split //, $Line;
  print "\n$Line\n";
  foreach (@Chars) {
my $num = ord($_);
   print "$_ $num\n";
  }
}


Perl Output:
E:\d_drive\perlStuff\guests>unichars.pl

Okay, here's a more extended test of the "moron" characteristics of (MS -Word.


O 79
k 107
a 97
y 121
, 44
  32
h 104
e 101
r 114
e 101
' 39
s 115
  32
a 97
  32
m 109
o 111
r 114
e 101
  32
e 101
x 120
t 116
e 101
n 110
d 100
e 101
d 100
  32
t 116
e 101
s 115
t 116
  32
o 111
f 102
  32
t 116
h 104
e 101
  32
" 34
m 109
o 111
r 114
o 111
n 110
" 34
  32
c 99
h 104
a 97
r 114
a 97
c 99
t 116
e 101
r 114
i 105
s 115
t 116
i 105
c 99
s 115
  32
o 111
f 102
  32
( 40
M 77
S 83
  32
- 45
W 87
o 111
r 114
d 100
. 46
  32
  32

 10

"Halt," he cried, "this is the police!"

" 34
H 72
a 97
l 108
t 116
, 44
" 34
  32
h 104
e 101
  32
c 99
r 114
i 105
e 101
d 100
, 44
  32
" 34
t 116
h 104
i 105
s 115
  32
i 105
s 115
  32
t 116
h 104
e 101
  32
p 112
o 111
l 108
i 105
c 99
e 101
! 33
" 34

 10

What did he mean by 'single quotes', anyway?  All I see is (c)apostrophes.

W 87
h 104
a 97
t 116
  32
d 100
i 105
d 100
  32
h 104
e 101
  32
m 109
e 101
a 97
n 110
  32
b 98
y 121
  32
' 39
s 115
i 105
n 110
g 103
l 108
e 101
  32
q 113
u 117
o 111
t 116
e 101
s 115
' 39
, 44
  32
a 97
n 110
y 121
w 119
a 97
y 121
? 63
  32
  32
A 65
l 108
l 108
  32
I 73
  32
s 115
e 101
e 101
  32
i 105
s 115
  32
( 40
c 99
) 41
a 97
p 112
o 111
s 115
t 116
r 114
o 111
p 112
h 104
e 101
s 115
. 46

 10




 10

E:\d_drive\perlStuff\guests>
EndPerlOutput

Word Output <


Re: Need help

2003-01-29 Thread R. Joseph Newton
Ron Geringer wrote:

> I'm pretty much used to scripting sendmail applications in tcl - and I'm
> very new to perl so this may be a dumb question. I'm working with a sendmail
> script that I got off the internet.

path>ppm

ppm>install Mail::sendmail


The following was posted within the last three days, I believe, though I added a 
couple line to the message part:

#!/usr/bin/perl5 -w

use strict;
#use warnings;
use Mail::sendmail("sendmail");

my %mail =  (
  To  => '[EMAIL PROTECTED]',
  From=> '[EMAIL PROTECTED]',
  Subject => "Message to self--Test",
  Message => <


RE: Need help

2003-01-29 Thread Ron Geringer
Thanks for the feedback. Little late tonight but I'll give it a shot
tomorrow.

Again - thanks

Ron

-Original Message-
From: R. Joseph Newton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 12:23 AM
To: Ron Geringer
Cc: [EMAIL PROTECTED]
Subject: Re: Need help


Ron Geringer wrote:

> I'm pretty much used to scripting sendmail applications in tcl - and I'm
> very new to perl so this may be a dumb question. I'm working with a
sendmail
> script that I got off the internet.

path>ppm

ppm>install Mail::sendmail


The following was posted within the last three days, I believe, though I
added a couple line to the message part:

#!/usr/bin/perl5 -w

use strict;
#use warnings;
use Mail::sendmail("sendmail");

my %mail =  (
  To  => '[EMAIL PROTECTED]',
  From=> '[EMAIL PROTECTED]',
  Subject => "Message to self--Test",
  Message => <