Using a CSS file

2004-12-08 Thread Graeme St. Clair
I have code like this in a Windows XP sys, w. Apache 1.3.27 and Perl 5.6.1:-
 
  $formData = new CGI();
 
  print $formData-header( -expires= 'now');
  print $formData-start_html( -title  = $title,
#  -style  = { 'src' = 'blah.css' },
   -style  = { 'code' = $css },  #
pre-filled with style specs
   -bgcolor= '#CC',
   -leftmargin = '30',
   -topmargin  = '20'
 );
  print $formData-h2( $title );
  print $formData-h3( $message );
 
Using $css works fine, the new HTML page comes up with the desired styles.
But when I try the 'src' way instead, I get un-styled o/p, and two entries
in Apache error.log:-
 
 [Wed Dec 08 10:30:01 2004] [error] [client ###.###.###.###] c:/program
files/perl_apache/apache/cgi-bin/fred/blah.css is not executable; ensure
interpreted scripts have #! first line
 [Wed Dec 08 10:30:01 2004] [error] [client ###.###.###.###] couldn't spawn
child process: c:/program files/perl_apache/apache/cgi-bin/fred/blah.css
 
'blah.css' is in the same folder 'fred' as the script with the code snippet
above.  I tried 'src' = '../blah.css', but that simply brought up the same
error, only in 'htdocs' iso 'fred'.
 
1) is there some appointed place for 'blah.css' other than where it is?
 
2) 'blah.css' contains only the CSS specs, nothing else.  Is that as it
should be?
 
Rgds, GStC.
 
 
 

 



Re: Using a CSS file

2004-12-08 Thread David Dorward
On Wed, Dec 08, 2004 at 07:47:09AM -0800, Graeme St. Clair wrote:
  [Wed Dec 08 10:30:01 2004] [error] [client ###.###.###.###] c:/program
 files/perl_apache/apache/cgi-bin/fred/blah.css is not executable; ensure
 interpreted scripts have #! first line

Looks like your server is configured to treat all files in cgi-bin as
CGI scripts.

 1) is there some appointed place for 'blah.css' other than where it is?

Somewhere where the server won't try to execute them. This probably
means Anywhere but in the cgi-bin :)

 2) 'blah.css' contains only the CSS specs, nothing else.  Is that as it
 should be?

Yes

-- 
David Dorward  http://dorward.me.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Using a CSS file

2004-12-08 Thread Sean Davis
On Dec 8, 2004, at 10:52 AM, David Dorward wrote:
On Wed, Dec 08, 2004 at 07:47:09AM -0800, Graeme St. Clair wrote:
 [Wed Dec 08 10:30:01 2004] [error] [client ###.###.###.###] 
c:/program
files/perl_apache/apache/cgi-bin/fred/blah.css is not executable; 
ensure
interpreted scripts have #! first line
Looks like your server is configured to treat all files in cgi-bin as
CGI scripts.
1) is there some appointed place for 'blah.css' other than where it 
is?
Somewhere where the server won't try to execute them. This probably
means Anywhere but in the cgi-bin :)
Many servers have a htdocs or Documents directory that is readable from 
the server.

Sean
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Using a CSS file

2004-12-08 Thread Lawrence Statton
 
  2) 'blah.css' contains only the CSS specs, nothing else.  Is that as it
  should be?
 
 Yes
 

Well -- or not :)

Just as we can use Perl to produce valid HTML, we can use Perl to
produce valid CSS.  I use it often to produce dynamic CSS based on
User-Agent to work around gross deficiencies in some browsers (*cough*,
Internet Explorer, *cough*).

However, if you wish to do that - and more power if you do - you are
going to have to produce valid output:

... BEGIN PERL PROGRAM .
#!/usr/bin/perl
# file /usr/local/apache/cgi-bin/style.css mode 755 

use strict;
use warnings; 
use CGI;
our $query = new CGI; 
print $query-header('text/css'); 

print 'EOF'
BODY { background: url(/images/ruff.jpg);  font-family: Helvetica, sans;  }
TABLE { margin: auto; border-collapse: collapse; font-weight: bold; border: 
double 3px;  border-color: black;  } 
TR { border: double 3px;} 
TD { border: solid 1px; } 
TD.category { text-align: center; font-size: 120%;  }
TD.red { color: red; border-color: black;  } 
EOF
;

 END PERL PROGRAM ..


Doing soemthing useful is left as an exercise to the reader ;

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Using a CSS file

2004-12-08 Thread Graeme St. Clair
David  Sean: the hints about cgi-bin and htdocs (plus my own unfollowed-up
attempt at 'src' = '../blah.css' were enough.  I simply moved blah.css to
htdocs, and bingo.

Lawrence: you seem to be suggesting something close to my $css approach, but
as I have a couple of other pages to bring into line, the simpler the
parameters to -start_html the happier I shall be.  So I'll pinch your hint
of using body { css stuff }, and plunk it into blah.css too.  Also, I see
you're using lots of table style, and I'll pinch that as well, since the
only way I'd found to get a nice appearance was table border=1
bordercolor=color.

Thanks to all, rgds, G.

When in doubt plagiarise; let no-one else's work evade your eyes ( very
loosely, from Tom Lehrer).

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Setting a Cookie...

2004-12-08 Thread Bill Stephenson
How can I set a cookie when someone visits my home page?
I've tried using a server side include like so
# code #
#!/usr/bin/perl -w
# This is in my html page:
# !--#exec cgi=/cgi-bin/ezInvoice2/ssi.cgi--
use strict;
use CGI qw/:standard/;
use CGI::Carp('fatalsToBrowser');
my $Q = new CGI;
my $visits;
$visits = $Q-cookie('visit_tracker');

if ($visits eq '') {
$visits = 1;
}

else {$visits++}
my $visit_tracker= $Q-cookie(-name='visit_tracker',
  -value=1,
  -expires='+10y');

print $Q-header(-cookie=$visit_tracker);
print You've been here $visits times;
### end code ###
This inserts You've been here 1 times, but does not set the cookie. 
Nor does it create any errors in my server logs.

I assume this can be done with some Apache programming, but I know 
almost nothing about that and I'd rather do this with perl if possible. 
Any tips will be much appreciated...

Kindest Regards,
Bill Stephenson
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Setting a Cookie...

2004-12-08 Thread Bill Stephenson
I apologize, the code I sent previously does create an error, this code 
does not...

# code
#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
use CGI::Carp('fatalsToBrowser');
my $Q = new CGI;
my $demo_uses;
$demo_uses = $Q-cookie('demo_tracker');

if (!$demo_uses) {

$demo_uses = 1;

}

else {$demo_uses++}

my $demo_tracker= $Q-cookie(-name='demo_tracker',
  -value=$demo_uses,
  -expires='+10y');

print $Q-header(-cookie=$demo_tracker);
print Here's Something Big!;
#  end code
Kindest Regards,
Bill Stephenson
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: Setting a Cookie...

2004-12-08 Thread Bob Showalter
Bill Stephenson wrote:
 How can I set a cookie when someone visits my home page?
 
 I've tried using a server side include like so
 
 # code #
 #!/usr/bin/perl -w
 
 # This is in my html page:
 # !--#exec cgi=/cgi-bin/ezInvoice2/ssi.cgi--

[snip cgi ]

Your code to set the cookie is OK, but I don't think you can do this from
SSI; only the body of the response is used, not the headers (where the
cookie is set).

Googling for set cookie from ssi turns up lots of discussion of this
topic.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Google Ads: Was: Setting a Cookie...

2004-12-08 Thread Bill Stephenson
Thanks for the pointer Bob,
I read a few of the Google links you pointed out and now understand why 
this cannot be done. I guess I'll have to work a little bit around this 
one. I found that I can set/read/manipulate a cookie with JavaScript, 
(GoLive has some tools for this) but I haven't tested them yet. If this 
is so, I can link pages from the Home Page to my CGI script and try 
to measure the data I need from there, which is another topic, but I'll 
bring it up now anyway...

Google Ads.
Mainly what I want to know is if people are using a clients Google 
ads as a gateway into their site. It's fine that they get new users 
from Google, but I want to encourage repeat visitors to bookmark the 
site with a Nag Screen if they keep using Google ads to enter the 
site, and I suspect this is so.

Another potential problem I see with Google ads is their Affiliate 
program. What stops someone from setting one of these up on a site they 
own, then clicking links, or even worse, writing a Bot to click the 
ads Google delivers? (aside going to jail for fraud, which we really 
can't depend on). I suspect this may be happening too...

I've been watching their log files in real time and I've see some 
repeated odd behavior that makes me suspicious. A user comes in from
Google and hits the same 4 pages so fast that they cannot possibly even 
be looking at them, then they disappear, and my client pays Google and 
their affiliate for this. I dunno, maybe I'm just paranoid, or tired, 
or both

Any thoughts on this?
Kindest Regards,
Bill Stephenson
On Dec 8, 2004, at 12:58 PM, Bob Showalter wrote:
Your code to set the cookie is OK, but I don't think you can do this 
from
SSI; only the body of the response is used, not the headers (where the
cookie is set).

Googling for set cookie from ssi turns up lots of discussion of this
topic.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: ip4 check

2004-12-08 Thread Ing. Branislav Gerzo
[EMAIL PROTECTED] [D], on Tuesday, December 7, 2004 at 11:49
(-0500) thinks about:

D Did anyone have any ideas I only received one response!  Thanks

what was bad on my response ? Maybe you wanted whole code...here it
is:

use IO::Socket;
my $ip = '192.168.1.1';
$ip_ok =  inet_aton($ip) || die $ip is not IP!\n;

it is IP, only if $ip is in ###.###.###.### format, '127.0.0.1/24'
doesn't work here.

-- 

 ...m8s, cu l8r, Brano.

[Don't say during sex:  Is this a sin too?]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




find and replace all occurance of the string from a list of files

2004-12-08 Thread Chandrakant Reddy
Hi 
  
   I want to replace all occurances of  'and' with '' in all the given files 

   inputfile.txt containts all the names of the files to process.

i wrote a small shell script for this 
 for i in `cat inputfile.txt`
 do
cp $i ${i}.bk
sed -e 's/ and /  /g' ${i}.bk  ${i} # don't replace hand with h
 done 



 Here the problem is the files are owned by different users with
different permissions. But now all the files are owned by root and
also many of the files  with changed permission. i don't want to
change the original ownership and permission of the file.

Is perl can  help me in this problem !!

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: find and replace all occurance of the string from a list of files

2004-12-08 Thread Tor Hildrum
On Wed, 8 Dec 2004 15:22:39 +0530, Chandrakant Reddy
[EMAIL PROTECTED] wrote:
 Hi

I want to replace all occurances of  'and' with '' in all the given files

In-place with backup in filename.bk:
perl -pi'*.bk' -e 's/\band\b//g' filenames

  Here the problem is the files are owned by different users with
 different permissions. But now all the files are owned by root and
 also many of the files  with changed permission. i don't want to
 change the original ownership and permission of the file.

Run your script as root?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




array statistic (different)

2004-12-08 Thread Ing. Branislav Gerzo
Hello,

I have one question - I know how to do this, but maybe someone shows
me, how to do it better (for sure!). Ok, here we comes:

I have:

my @array = ( '1/2/1',
  '1/2/2',
  '1/4/2',
  '2/1/1',
  '2/1/1',
  '3/1/1' );

and now the task:
I want to have in $out = '1/2/1', why ?

This is 3 (values to compare) of 3 (values in 1 field) statistics:

Ok, first pick up _first_ number, do statistics (1 is winner),
we get new array, next pick up _second_ number from @newarray (2 is
winner), pick up third number and do statistics, if here is no winner, so
return first value we have in list.

I think this is nice example for recursive function, do you agree ?

Ok, I am code that, so I am looking for your suggestions, too :)

(Also would be nice, if we have for example '1/2/2/3' values and do
3 values compare statistics, so it could be:
3 values to compare of 4 values in 1 field and similar counts, where
always (values to compare) = (values in 1 field)

any ideas ? :)

--

 --. ,--  ,- ICQ: 7552083  \|||/`//EB: www.2ge.us
,--' |  - |--IRC: [2ge](. .),\\SN: 2ge!2ge_us
`+==+=+===~  ~=-o00-(_)-00o-~
Quantum particles: the dreams that stuff is made of.  -- David Moser
 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: XML::RSS::Parser - ns_qualify failure

2004-12-08 Thread Bob Showalter
Craig Moynes wrote:
 I installed XML::RSS:Parser from CPAN.
 When I try to run a simple script I get (from the sample code):
 Can't locate object method ns_qualify via package
 XML::RSS::Parser at testrss3.pl line 11 (#1)
 (F) You called a method correctly, and it correctly indicated a
 package functioning as a class, but that package doesn't define
 that particular method, nor does any of its base classes.  See
 perlobj. 
 
 Uncaught exception from user code:
 Can't locate object method ns_qualify via package
 XML::RSS::Parser at testrss3.pl line 11.
 
  #!/usr/bin/perl -w
 
  use strict;
  use XML::RSS::Parser;
  use diagnostics;
 
  my $p = new XML::RSS::Parser;
  my $feed = $p-parsefile('TV_shows.rss');
 
  # output some values
  my $title =
  XML::RSS::Parser-ns_qualify('title',$feed-rss_namespace_uri);
  print $feed-channel-children($title)-value.\n; print item
  count: .$feed-item_count().\n\n; foreach my $i ( $feed-items ) {
 map { print $_-name.: .$_-value.\n } $i-children;
 print \n;
  }
 
 
 
 Some of my own (n00b) investigations show that the version on cpan,
 and the version I installed from the cmd line too cpan are different,
 the cpan cmd is version 3.01 I beleve, and the version on the web is
 2.15. It looks like the version downloaded uses a superclass
 XML::Parser. Linux, Perl 5.8.5
 
 Anyone care to take a crack at this?

Poking around at the source, it looks like ns_qualify is implemented in
XML::Parser::Style::Elemental, so perhaps you need to call ns_qualify as a
method of $p, your parser object.

Have you asked the author of this thing?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: array statistic (different)

2004-12-08 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Wednesday, December 8, 2004 at 13:03
(+0100) wrote:

IBG I think this is nice example for recursive function, do you agree ?

I agree too :)

IBG Ok, I am code that, so I am looking for your suggestions, too :)

Ok, here is my solution, not the best one, because it return random
value if max is not exactly defined (we ends with the same values for
strings)

#advanced statistics
use strict;
use warnings;
use Data::Dumper;

my $depth = 3;

my @array = (   '1/1/2/2',  #this one should be result
'1/1/1/1',
'1/2/1/1',
'2/1/1/1',
'2/1/1/1',
);

for my $i (1..$depth) {
my @worka = map { /^((?:[^\/]+\/)[EMAIL PROTECTED]/+])/ } @array;
my ($max_val, $max_key) = 0;
my %hash = ();
for (@worka) { $hash{$_}++ }
while ( my ($key, $val) = each(%hash) ) {
($max_key, $max_val) = ($key,$val) if ($val  $max_val);
}

@array = grep { /^$max_key/ } @array;
print Dumper(\%hash);
print Winner is $max_key\n;
}


-- 

 ...m8s, cu l8r, Brano.

[Virginity can be cured.]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: array statistic (different)

2004-12-08 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Wednesday, December 8, 2004 at 14:28
(+0100) wrote these comments:

IBG Ok, here is my solution, not the best one, because it return random
IBG value if max is not exactly defined (we ends with the same values for
IBG strings)

ok, if anyone interested - I change it a bit, and this is last version
:)
works, as was defined at start.

#advanced statistics
use strict;
use warnings;
use Data::Dumper;

my $depth = 3;

my @oarray = (  'a/1/5/2',  #this one should be result
'a/1/1/1',
'a/1/3/1',
'2/1/1/1',
'2/1/1/1',
);

my @array = @oarray;

my %hash = ();  
for my $i (1..$depth) {
my @worka = map { /^((?:[^\/]+\/)[EMAIL PROTECTED]/]+)/ } @array;
my ($max_val, $max_key) = 0;
%hash = ();
for (@worka) { $hash{$_}++ }
while ( my ($key, $val) = each(%hash) ) {
($max_key, $max_val) = ($key,$val) if ($val  $max_val);
}

@array = grep { /^$max_key/ } @array;
print Dumper(\%hash);
print Winner is $max_key\n;
}

#getting the right value
my $id = 0;
while ( my $key = each(%hash) ) {
for my $i (0..$#oarray) {
$id = $i if ($i  $id  $oarray[$i] =~ /^$key/);
}
}

(my $result = $oarray[$id]) =~ s/^((?:[^\/]+\/)[EMAIL PROTECTED]/]+).*/$1/g;
print \nFinal result: $result;

-- 

 ...m8s, cu l8r, Brano.

[Hey!  Scott!  You're back!  How was the treatment program?]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread Edward WIJAYA
On Wed, 8 Dec 2004 12:56:15 +0800, Xun Yu [EMAIL PROTECTED] wrote:
The problem is  I can only get a evaluate license for PDK-Pro-6.0,
so what I am looking for is a compiler more powerfull than perlcc,
and must be free.

I don't know if this is really what you want,
but you can try to look at CPAN's PAR module:
http://search.cpan.org/search?mode=modulequery=PAR
--
Regards,
Edward WIJAYA
Singapore
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Variables and MySQL

2004-12-08 Thread Dave Kettmann
Hi List,

I have a script that takes input ( Formatted: +1## ). What it does with 
the input is read thru a database table and try to find a match. Here is an 
example to help clarify this:

+--+--+
| alias| sendto   |
+--+--+
| +131489804[0-7][0-9] | sip:[EMAIL PROTECTED]|
+--+--+

The input is first matched to the 'alias' column. So in this case, +13148980555 
would match (because of the regex). After the script finds a match, it returns 
the 'sendto' column. Does anyone know how to get the script to expand the $1 
variable? Is it even possible? I've toyed with it for a while, and can't get it 
right. Any help is greatly appreciated.

Also, from a Good idea, Bad idea point of view... If this were to be run 
approximately 100 times a second searching over 1 lines in the DB, would it 
pose a problem processor-wise? Is there a better way to go about this? Again, 
any and all help is greatly appreciated.

Here is the code that I have so far: 

#!/usr/bin/perl

use strict;
use warnings;
use DBI;

my @DBIconn = qw(DBI:mysql:ser:bunsen.netlogic.net ser ftff39b);

my $dbh = DBI-connect(@DBIconn) or
die Couldn't connect to database:  . DBI-errstr;

my $uri_to = $ENV{'SIP_HF_TO'};

print Type in a qualified number:\n;

$uri_to = ;
chomp $uri_to;

$uri_to =~ m/(\+1\d\d\d\d\d\d\d\d\d\d)/ ;

my $sth = $dbh-prepare(SELECT alias, sendto FROM aliases2) or
die Couldn't prepare statement:  . sth-errstr;

$sth-execute();

my $i = 0;

my @data;

if ($sth-rows == 0) {
  exit -1;
}

while (@data = $sth-fetchrow_array) {

  if ($uri_to =~ m/(\+$data[0])/) {
print Matches!\n;
print \tForwarding to: $data[1]\n;
  } else {
print No Match\n;
  }
}

__END__

Thanks,

Dave Kettmann
NetLogic
636-561-0680


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: array statistic (different)

2004-12-08 Thread Charles K. Clarkson
Ing. Branislav Gerzo [EMAIL PROTECTED] wrote:

: I have:
: 
: my @array = ( '1/2/1',
:   '1/2/2',
:   '1/4/2',
:   '2/1/1',
:   '2/1/1',
:   '3/1/1' );

What is it representative of? What is the application?
Will there be only didgits? What is the range of values
available.


: and now the task:
: I want to have in $out = '1/2/1', why ?
: 
: This is 3 (values to compare) of 3 (values in 1 field)
: statistics: 
: 
: Ok, first pick up _first_ number, do statistics (1 is winner),
: we get new array, next pick up _second_ number from @newarray
: (2 is winner), pick up third number and do statistics, if here
: is no winner, so return first value we have in list.
: 
: I think this is nice example for recursive function, do you
: agree ? 

No. Probably not.

: 
: Ok, I am code that, so I am looking for your suggestions, too :)


   With the information presented:

my @stats = qw(
1/2/1
1/2/2
1/4/2
2/1/1
2/1/1
3/1/1
);

my @sorted_stats = sort @stats;

print $sorted_stats[0];

__END__

 
: (Also would be nice, if we have for example '1/2/2/3' values
: and do 3 values compare statistics, so it could be:
: 3 values to compare of 4 values in 1 field and similar counts,
: where always (values to compare) = (values in 1 field)

The example above would work. It pretty much depends on what
the range of values are in the fields. Tell us what those are
and we might be able to help more.


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328











-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: XML::RSS::Parser - ns_qualify failure

2004-12-08 Thread Craig Moynes
Bob,

I have tried both lines:
 my $title = XML::RSS::Parser-ns_qualify('title',$feed-rss_namespace_uri);
and
 my $title = $p-ns_qualify('title',$feed-rss_namespace_uri);

I will try and make sure everything that is installed is up-to-date,
then I will contact the author as my next step and then send the
result on to the list for archiving.

Thanks for the tip,
Craig

On Wed, 8 Dec 2004 08:29:37 -0500, Bob Showalter
[EMAIL PROTECTED] wrote:
 Craig Moynes wrote:
 
 
  I installed XML::RSS:Parser from CPAN.
  When I try to run a simple script I get (from the sample code):
  Can't locate object method ns_qualify via package
  XML::RSS::Parser at testrss3.pl line 11 (#1)
  (F) You called a method correctly, and it correctly indicated a
  package functioning as a class, but that package doesn't define
  that particular method, nor does any of its base classes.  See
  perlobj.
 
  Uncaught exception from user code:
  Can't locate object method ns_qualify via package
  XML::RSS::Parser at testrss3.pl line 11.
 
   #!/usr/bin/perl -w
 
   use strict;
   use XML::RSS::Parser;
   use diagnostics;
 
   my $p = new XML::RSS::Parser;
   my $feed = $p-parsefile('TV_shows.rss');
 
   # output some values
   my $title =
   XML::RSS::Parser-ns_qualify('title',$feed-rss_namespace_uri);
   print $feed-channel-children($title)-value.\n; print item
   count: .$feed-item_count().\n\n; foreach my $i ( $feed-items ) {
  map { print $_-name.: .$_-value.\n } $i-children;
  print \n;
   }
 
 
 
  Some of my own (n00b) investigations show that the version on cpan,
  and the version I installed from the cmd line too cpan are different,
  the cpan cmd is version 3.01 I beleve, and the version on the web is
  2.15. It looks like the version downloaded uses a superclass
  XML::Parser. Linux, Perl 5.8.5
 
  Anyone care to take a crack at this?
 
 Poking around at the source, it looks like ns_qualify is implemented in
 XML::Parser::Style::Elemental, so perhaps you need to call ns_qualify as a
 method of $p, your parser object.
 
 Have you asked the author of this thing?
 


-- 
Primer:
   Shane Carruth: It's about some engineers that are trying to build a
device that degrades gravity. They find out it has unexplainable
properties. Hilarity ensues.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: array statistic (different)

2004-12-08 Thread Ing. Branislav Gerzo
Charles K. Clarkson [CKC], on Wednesday, December 8, 2004 at 08:32
(-0600) thinks about:

CKC What is it representative of? What is the application?
CKC Will there be only didgits? What is the range of values
CKC available.

It will be not digits, I give bad example, I should use some words.
You can imagine that array as paths in filesystem...

I'm still working on it, the last example I posted wasn't good.

-- 

 ...m8s, cu l8r, Brano.

[Redundant Book Title:  Windows For Dummies]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread JupiterHost.Net

I am looking for a free perl compiler.
My /usr/bin/perl was free :)
 
I suspect he wants something for Windows.

By compiler, I further suspect that he wants something that will 
generate .exe files that can be run without a perl.exe on the system.

If the usual line of thinking for this question applies, he also 
probably wants the code to be obfuscated so that others can get back to 
the original text. 
Exactly :)
Bad question that makes me spend time trying to figure out what he wants 
= answer that is true but probably not much help ;p

Can't locate Mind::Telepathy.pm in @INC (@INC contains: ...) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Ghost of Gunnar says right on Lee!
You're answer was right on though, very helpful :)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: Should be a simple substitution?

2004-12-08 Thread Bakken, Luke
 And is this method any faster or more efficient than this?
 
 $var =~ s/\{([^}]+)\}/$v = $1; $v =~ s!,!|!g; qq!($v)!/ge;

Why not find out yourself?

C:\src\perltype rebench.plx
use strict;
use Benchmark qw/cmpthese/;

sub luke
{
my $var = 'blargh{a,b,c}';
my $v;
$var =~ s/\{([^}]+)\}/$v = $1; $v =~ s!,!|!g; qq!($v)!/ge;
}

sub john
{
my $var = 'blargh{a,b,c}';
$var =~ s{([^}]+)}(?:@{[ ($a = $1) =~ y/,/|/  $a ]});
}

cmpthese(10, {
'Luke' = \luke,
'John' = \john
});

C:\src\perlrebench
Rate John Luke
John 59809/s   -- -21%
Luke 75301/s  26%   --

Also, switching the s!,!|!g to a y!,!|! in mine is faster yet:

C:\src\perlrebench2.plx
Rate John Luke
John 59242/s   -- -32%
Luke 87642/s  48%   --

Of course, unless you're doing 10 substitutions in your program, the
speed difference doesn't matter at all :-)

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Should be a simple substitution?

2004-12-08 Thread Bakken, Luke
  $var =~ s{([^}]+)}(?:@{[ ($a = $1) =~ y/,/|/  $a ]});
 
 
 Does it not need the 'ge' at the end?
 
 I don't understand why you are creating an anonymous array 
 with a single
 value, then dereferencing it...   And what does the ?: do?  

I think the ?: must be extraneous:

C:\src\perlperl -pes{([^}]+)}(?:@{[ ($a = $1) =~ y/,/|/  $a ]})
blargh{a,b,c}blargh
blargh(?:a|b|c)blargh


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Variables and MySQL

2004-12-08 Thread Lawrence Statton
 Hi List,
 
 I have a script that takes input ( Formatted: +1## ). What it does wi
 th the input is read thru a database table and try to find a match. Here is a
 n example to help clarify this:
 


Here is the cleaned up version of what you're doing -- since I don't
have your database I'm using a DATA section to simulate it.

I've cleaned up some of the regexps to be a little tidier

Also, you had a subtle non-effectual bug -- because the row from the
database had an embedded + in it, the regexp inside your match in
the while loop ( $uri_to =~ m/(\+$data[0])/ was evaluated as 
\++1314898... Which meant optionally put a plus in front of this
number...  

I think it is cleaner to explicitly do the substitution in the target
string, although I'm sure there is a way to force it with an eval() 

(I'm a big fan of Explicit and Clear vs. Subtle and Confusing )

.. BEGIN PERL PROGRAM ..
#!/usr/bin/perl
# file: /tmp/dialplan.pl

use strict;
use warnings;
use DBI;

# my @DBIconn = qw(DBI:mysql:ser:bunsen.netlogic.net ser ftff39b);

#my $dbh = DBI-connect(@DBIconn) or
#die Couldn't connect to database:  . DBI-errstr;

my $uri_to ; #= $ENV{'SIP_HF_TO'};

print Type in a qualified number:\n;

$uri_to = ;
chomp $uri_to;

#$uri_to =~ m/(\+1\d\d\d\d\d\d\d\d\d\d)/ ;
if ( $uri_to =~ m/(\+1\d{10})/) { 


while (DATA) {
my ($plan, $destination) = split /::/;
if (my ($target) = $uri_to =~ m/(\+$plan)/) {
$destination =~ s/__TARGET__/$target/; 
print Matches with $destination \n;
last; 
} else {
print No Match\n;
}
}
}

__DATA__
15305473410::sip:[EMAIL PROTECTED]
161757789\d{2}::sip:[EMAIL PROTECTED]
131489804[0-7][0-9]::sip:[EMAIL PROTECTED]
... END PERL PROGRAM ...

Now, as to the second part of your questin Is this a bad idea ...?  

My gut (and many years of experience) tells me putting a big fat
database select in the middle of your route selection code is going to
be a performance pig.  Caching, caching, caching.  

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Should be a simple substitution?

2004-12-08 Thread Dave Gray
 I think the ?: must be extraneous:

That construct lets the regex engine know that it doesn't need to
worry about saving backreferences to the parenthesized group.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Variables and MySQL

2004-12-08 Thread Lawrence Statton

Aww, dangit --- I should have not used __TARGET__ as the replacement
tag -- there is just too much room for confusion with reserved words
like __PACKAGE__ or __LINE__ ... Everyone take out your erasers and
change that to --TARGET-- please :)

--L

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Should be a simple substitution?

2004-12-08 Thread Bakken, Luke
  I think the ?: must be extraneous:
 
 That construct lets the regex engine know that it doesn't need to
 worry about saving backreferences to the parenthesized group.

It's on the right hand-side of the regex, however. Look at the output:

C:\src\perlperl -pes{([^}]+)}(?:@{[ ($a = $1) =~ y/,/|/  $a ]})
blargh{a,b,c}blargh
blargh(?:a|b|c)blargh

The OP didn't want the ?: in there

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread Jonathan Paton
 
*** Somewhat off-topic ***

  * Obfuscators don't work well enough to bother with. If you can't have
 people reading your code, don't use Perl, or better still, use Perl but
 don't allow access to the machine where the program runs (e.g. put up a
 web interface to a service under your control).
 

Agree strongly after I looked at the example encoded and obfuscated
output of Stunnix Obfuscator.  I was able to bring it back to near
original code (some information like original variable names are lost).

They might stop the lower 90% of the Perl programmers, but not the
type people hire to reverse engineer.  Obfuscated code is likely to be
poor quality code (lack of pride - bugs hidden away).

http://www.stunnix.com/prod/po/sample.shtml

Jonathan Paton

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Help with cookies

2004-12-08 Thread Moon, John
Does anyone know if I should be able to write a cookie like :
 
snip
$secure{USER}=$user-{USER_ID};
$secure{LEVEL}=$REQUEST{LEVEL};
%{$secure{USER_CATEGORIES}}=%USER_CATEGORIES;
%{$secure{USER_ACCOUNTS}}=%USER_ACCOUNTS;
@[EMAIL PROTECTED];
my $my_cookie = $q-cookie(-name='TechDirect', -value=\%secure, 
-expires='+10h');
print $q-header({-type=text/html, -target='toolbar',
-cookie=$my_cookie});
/snip

When I return the cookie I don't appear to have the USER_CATEGORIES 
USER_ACCOUNTS plus USER_GROUP is null but is an array reference...
The scalar values return OK...

jwm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Term::ReadKey substitute for perl v5.8.0

2004-12-08 Thread Jason.Price
In trying to use Term::ReadKey, I've come across information indicating
that Term::ReadKey does not work properly with Perl v5.8.0.  We are
running 5.8.0 on numerous systems, and upgrading them is not a trivial
thing, due to business reasons.  So, I need to find an alternative to
some ReadKey functionality.
 
I have a script that runs continuously, until explicitly ended by the
user (cntl-c), displaying updated results to the screen on a pre-defined
interval.  I want to allow the user to hit specific keys to define what
is being displayed on the screen.  So, I need the ReadKey(-1),
non-breaking functionality without using the Term::ReadKey module.  Any
ideas how I might accomplish this?
 
Thanks.
 
Jason


Re: Help with cookies

2004-12-08 Thread Jonathan Paton
Dear John,

It is likely that you cannot store complex datastructures in cookies.  (at least
how the CGI module is currently written).  You could try encoding the data
to a string.

Jonathan Paton

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Help with cookies

2004-12-08 Thread Moon, John
Dear John,

It is likely that you cannot store complex datastructures in cookies.  (at
least
how the CGI module is currently written).  You could try encoding the data
to a string.

Jonathan Paton
[jwm] 

Thank you for the Dear John letter ;-)... I was afraid that may be the
answer I got... but wanted to check before starting down another path...

Thanks for the reply...

jwm

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread Octavian Rasnita
So the conclusion is that perl code cannot be really hidden (for comercial
purposes)?
A license is equal to zero in some countries... so that's not a solution.

Teddy

- Original Message - 
From: Jonathan Paton [EMAIL PROTECTED]
To: Chris Devers [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, December 08, 2004 9:23 PM
Subject: Re: I am looking for a free perl compiler.



*** Somewhat off-topic ***



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread Chris Devers
On Wed, 8 Dec 2004, Octavian Rasnita wrote:

 So the conclusion is that perl code cannot be really hidden (for 
 comercial purposes)?

For any purposes, yes, code cannot be hidden.

More broadly, for any interpreted language -- Perl, Python, Tcl, even 
ones like Java and Visual Basic -- it's fairly straightforward to turn 
an obfuscated version back into something resembling the original if you 
know what you're doing.

It's harder with compiled languages like C, but even then there are 
decompilers and other tools for getting source code back out.

If you don't want someone seeing how your code works, don't let them 
have access to the machine on which your code runs. In a networked 
world, this isn't hard to do -- just have the interesting bits written 
in the language of your choice running on a machine somewhere under your 
control, and provide an appropriate interface for your clients. This is 
exactly how every web site in the world works, including the really 
clever ones like Amazon and Google.

It works for them; it can work for you, too.


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Help with cookies

2004-12-08 Thread Lawrence Statton
 Does anyone know if I should be able to write a cookie like :
  
 snip
 $secure{USER}=$user-{USER_ID};
 $secure{LEVEL}=$REQUEST{LEVEL};
 %{$secure{USER_CATEGORIES}}=%USER_CATEGORIES;
 %{$secure{USER_ACCOUNTS}}=%USER_ACCOUNTS;
 @[EMAIL PROTECTED];
 my $my_cookie = $q-cookie(-name='TechDirect', -value=\%secure, 
   -expires='+10h');
 print $q-header({-type=text/html, -target='toolbar',
   -cookie=$my_cookie});
 /snip
 
 When I return the cookie I don't appear to have the USER_CATEGORIES 
 USER_ACCOUNTS plus USER_GROUP is null but is an array reference...
 The scalar values return OK...
 

You need to learn to write little test programs to See What's Really
Happening BEFORE you ask the list.

.. BEGIN PERL PROGRAM ..
#!/usr/bin/perl

use strict;
use warnings; 
use CGI;
use Data::Dumper;


my %secure; 
$secure{USER} = 123;
$secure{LEVEL} = 'exulted';
%{$secure{USER_CATEGORIES}} = ( metal = 'rusty',
fruit = 'citrus' );
@{$secure{USER_GROUPS}} = ( 10, 20, 30 ); 

warn Dumper \%secure; 

my $query = new CGI; 

my $cookie = $query-cookie (-name = 'cookie',
 -value = \%secure ); 

warn Dumper $cookie; 

warn $cookie-as_string; 
... END PERL PROGRAM ...

Produces the output (interspersed with commentary)

lawrence  /tmp  perl test.pl
$VAR1 = {
  'USER_CATEGORIES' = {
 'fruit' = 'citrus',
 'metal' = 'rusty'
   },
  'LEVEL' = 'exulted',
  'USER_GROUPS' = [
 10,
 20,
 30
   ],
  'USER' = 123
};

Okay -- here we see the secure hashref -- looks good.

$VAR1 = bless( {
 'value' = [
  'USER_CATEGORIES',
  {
'fruit' = 'citrus',
'metal' = 'rusty'
  },
  'LEVEL',
  'exulted',
  'USER_GROUPS',
  [
10,
20,
30
  ],
  'USER',
  123
],
 'name' = 'cookie',
 'path' = '/'
   }, 'CGI::Cookie' );

And, it got promoted into a cookie pretty well ... 

cookie=USER_CATEGORIESHASH%280x12afe8%29LEVELexultedUSER_GROUPSARRAY%280x21d24c%29USER123;
 path=/ at test.pl line 25.

Ahhh, but here we see where it's failing (and by the way, John Paton
is right: You Just Can't Do That)

Basically:  A cookie can have as it's value either a scalar, or a
single list of scalars.  (Which you can choose to pass in as a listref
or a hashref,  keeping in mind the relationship bewteen hash
constructors and lists ) 

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread Chris Devers
On Wed, 8 Dec 2004, Xun Yu wrote:

 I am going to compile a perl script to binary on linux

That was worth mentioning up front! :-)
 
 I tried perlcc, I doesn't always works well.

No, it doesn't.
 
 I tried the same script with perlapp from PDK-Pro-6.0 from 
 ActiveState? It works.
 
 The problem is I can only get a evaluate license for PDK-Pro-6.0, so 
 what I am looking for is a compiler more powerfull than perlcc, and 
 must be free.

Again, the question stands: why do you want to do this?

Nearly every instance of Linux in the world is going to have Perl 
installed, so why bother making Perl scripts that avoid using that 
built-in interpreter? There are a handful of reasons to want to do this, 
some a little convincing (e.g. weird compatibility requirements), but by 
far the most common reason is because the programmer wants a way to hide 
his code, and is hoping that a compiled version will be more obscure.

Don't bother. It won't work. You can get something that will compile, 
and run, and look funny if you examine the file, but if someone wants 
the original code back, there are techniques for doing so. 

If you're after something else, please explain, but be aware that in 
most cases, the answer is the standard Perl that comes with Linux.




-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: Help with cookies

2004-12-08 Thread Bob Showalter
Moon, John wrote:
 Does anyone know if I should be able to write a cookie like :
 

[ snip complex data structure ]

You can do this if you serialize the complex structure into a scalar and
then deserialize it when you read the cookie back.

For an example of how to do this see the module
Apache::Session::Serialize::Base64. It uses Storable and MIME::Base64 to do
the serialization. There are various other serialization modules on CPAN you
might look into...

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread Lawrence Statton
 So the conclusion is that perl code cannot be really hidden (for comercial
 purposes)?
 A license is equal to zero in some countries... so that's not a solution.
 

Well - never say, Never ... I think the output from perlcc is pretty
inscrutable for any but the most dedicated attacker, and assume that
ActiveState's commercially licensed products are similar.  

I think it's *HIGHLY* ironic that the original poster is looking for a
solution that allows him to close off his code, but demands that it be
a freely distributable solution to his problem.  My first reaction is:
If you want to lock the door on your code (and I think that is
perfectly within an authors rights -- I'm no RMS clone) , you are
going to have to pay someone to do it -- there just isn't any demand
for open-source source-closing software.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread Tor Hildrum
On Wed, 8 Dec 2004 15:26:58 -0500 (EST), Chris Devers [EMAIL PROTECTED] wrote:
 On Wed, 8 Dec 2004, Octavian Rasnita wrote:
 
  So the conclusion is that perl code cannot be really hidden (for
  comercial purposes)?
 
 For any purposes, yes, code cannot be hidden.

It can be hidden, but it will always be possible to reverse engineer
it's mechanics back.
 
Here is a silly example of a wrapper:
int main(void)
{
  FILE *fp;

  fp = fopen(./perl.pl, w);

  fputs(#!/usr/bin/perl\nprint\Hello World\\n\, fp);
  fclose(fp);
  chmod(./perl.pl, 755);
  execve(./perl.pl, NULL, NULL);
  remove(./perl.pl);

  return EXIT_SUCCESS;
}

The code is somewhat hidden after compilation, but it can still be
found if you have access to the machine it's running on.

You could write a wrapper that holds the key to your encrypted
source-code, and have that wrapper decrypt it before running it. Your
code is somewhat hidden, but can be found in RAM at runtime. And, it
can be reverse-engineered like everything else.

 If you don't want someone seeing how your code works, don't let them
 have access to the machine on which your code runs.

This is the only solution. Obscurity can only get you so far.

Tor

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread JupiterHost.Net
Lawrence Statton wrote:
So the conclusion is that perl code cannot be really hidden (for comercial
purposes)?
A license is equal to zero in some countries... so that's not a solution.
Well - never say, Never ... I think the output from perlcc is pretty
inscrutable for any but the most dedicated attacker, and assume that
ActiveState's commercially licensed products are similar.  
true, it does seem to work ok whenever I've played with it...
I think it's *HIGHLY* ironic that the original poster is looking for a
solution that allows him to close off his code, but demands that it be
a freely distributable solution to his problem.  My first reaction is:
If you want to lock the door on your code (and I think that is
perfectly within an authors rights -- I'm no RMS clone) , you are
going to have to pay someone to do it -- there just isn't any demand
for open-source source-closing software.
I second that! Thats one reason I posted such a lame reply originally:
I want to protect my work by someone else doing the work so I can make 
money without having to invest anything...

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Help with cookies

2004-12-08 Thread Lawrence Statton
 Moon, John wrote:
  Does anyone know if I should be able to write a cookie like :
  
 
 [ snip complex data structure ]
 
 You can do this if you serialize the complex structure into a scalar and
 then deserialize it when you read the cookie back.
 
 For an example of how to do this see the module
 Apache::Session::Serialize::Base64. It uses Storable and MIME::Base64 to do
 the serialization. There are various other serialization modules on CPAN you
 might look into...

This entire thread segueues nicely to a discussion on what should you
keep in a cookie?

Lawrence's Cookie Dogma #1:  Any site that has more than one opaque
identifier per user is B-R-O-K-E-N.  ESPECIALLY sites that keep lots
and lots of state in a cookie.

Exceptions to LCD#1 include: Yeah, yeah, I know -- sometimes site
operators install some 3d party thing that needs it's OWN opaque
identifier, and then they find they have seven of these 3d party
modules, each with its own identity cookie ... 

Some advantages to having state kept on the server side:

1 - I can connect from any computer in the world and my preferences
and state follow me.  This is ESPECIALLY important for markets outside
the US, where some large fraction do all their web-surfing from
public-access computers.

2 - The amount of data you can safely store in a cookie is browser
dependent and variable.  

3 - ALL cookie data (barring some clever hacks with paths) is
transmitted with EVERY request, increasing overall site latency.
Imagine how long it takes to send a dozen cookies of a few hundred
bytes each with EVERY request when the user is on a severely
asymmetrical connection.  Now, multiply that delay through the
eleventy-three indivisual graphic elements on each of your pages, and
keep that in mind when the marketing people come ask you why so many
users only get one layer deep in the click-path.

4 - If the day comes, that you decide NOT to use cookies at all for
state, for marketing reasons[1], you're going to have to solve this
problem again.

Footnotes:

[1] I actually think cookie paranoia is misplaced, and would love to
see users educated -- but The Client Is Always Right, and if they say
Our industry demands no cookies then so be it.  There are other ways
of keeping state, use them when you must.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread Lawrence Statton
 On Wed, 8 Dec 2004 15:26:58 -0500 (EST), Chris Devers [EMAIL PROTECTED] wro
 te:
  On Wed, 8 Dec 2004, Octavian Rasnita wrote:
  
   So the conclusion is that perl code cannot be really hidden (for
   comercial purposes)?
  
  For any purposes, yes, code cannot be hidden.
 
 It can be hidden, but it will always be possible to reverse engineer
 it's mechanics back.

Well - you don't have to outrun the bear ... (it's the punchline of an
old joke)...  Sometimes it's just easier to duplicate the application
than try to reverse engineer someone's obfuscated version.  (I had
exactly that happen for a work-related project.  After spending three
days deobfuscating, I threw up my hands and rewrote from scratch in
one afternoon.)

I was looking into a binary-output Perl compiler some time ago for a
product I wanted to release for Win32.  Not because I wanted to
obscure the code (it was open source) but for the simple expedient
that there are seventeen people in the world with Perl installed on
their Win32 machines, and they are all on this list :) The rest of the
Windows-using world thinks pearl is something that grows inside an
oyster and just want to have a dot-exe file they can download and run.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Lawrence Statton - [EMAIL PROTECTED] s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
sort them into the correct order.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: I am looking for a free perl compiler.

2004-12-08 Thread JupiterHost.Net

Jonathan Paton wrote:
I think it's *HIGHLY* ironic that the original poster is looking for a
solution that allows him to close off his code, but demands that it be
a freely distributable solution to his problem.  My first reaction is:
If you want to lock the door on your code (and I think that is
perfectly within an authors rights -- I'm no RMS clone) , you are
going to have to pay someone to do it -- there just isn't any demand
for open-source source-closing software.
I second that! Thats one reason I posted such a lame reply originally:
I want to protect my work by someone else doing the work so I can make
money without having to invest anything...

Do you work for SCO?
No, why?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: Term::ReadKey substitute for perl v5.8.0

2004-12-08 Thread Jason.Price
Okay, I'm seeing mixed info on whether or not Term::ReadKey works
properly with perl 5.8.0.  So, maybe I'll just throw out some code, and
see if others can get it to work.

I'm trying to wrap the ReadKey call in an infinite loop, but it breaks
as soon as I add the loop.  Take away the loop, or convert the ReadKey
to blocking, and it works just fine.  Here's the test code snippet I'm
using:


use Term::ReadKey;

while (1) {
ReadMode ('cbreak');
if (defined ($char = ReadKey(-1)) ) {
print Char: $char\n;
} else {
print None!\n;
}
ReadMode ('normal');
  sleep 1;
}


Remove the while loop, or change the -1 to 0, and it works properly.
As is, it never makes it into the if defined section of the if
statement.  I have one 5.6.1 box available, and it works fine there.
Can anyone with 5.8.0 test this out, and see if it works for them?

-Original Message-
From: Price, Jason (TLR Corp) 
Sent: Wednesday, December 08, 2004 1:36 PM
To: [EMAIL PROTECTED]
Subject: Term::ReadKey substitute for perl v5.8.0

In trying to use Term::ReadKey, I've come across information indicating
that Term::ReadKey does not work properly with Perl v5.8.0.  We are
running 5.8.0 on numerous systems, and upgrading them is not a trivial
thing, due to business reasons.  So, I need to find an alternative to
some ReadKey functionality.
 
I have a script that runs continuously, until explicitly ended by the
user (cntl-c), displaying updated results to the screen on a pre-defined
interval.  I want to allow the user to hit specific keys to define what
is being displayed on the screen.  So, I need the ReadKey(-1),
non-breaking functionality without using the Term::ReadKey module.  Any
ideas how I might accomplish this?
 
Thanks.
 
Jason

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Should be a simple substitution?

2004-12-08 Thread Dave Gray
 It's on the right hand-side of the regex, however. Look at the output:
 
 C:\src\perlperl -pes{([^}]+)}(?:@{[ ($a = $1) =~ y/,/|/  $a ]})
 blargh{a,b,c}blargh
 blargh(?:a|b|c)blargh
 
 The OP didn't want the ?: in there

So it is!

I'm usually a fan of one-liners, but I think this is a great example
of something that would benefit a lot from the extra clarity that
can't be shoehorned into the right half of a regex.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Variables and MySQL

2004-12-08 Thread John W. Krahn
Dave Kettmann wrote:
Hi List,
Hello,
I have a script that takes input ( Formatted: +1## ). What
it does with the input is read thru a database table and try to find
a match. Here is an example to help clarify this:
+--+--+
| alias| sendto   |
+--+--+
| +131489804[0-7][0-9] | sip:[EMAIL PROTECTED]|
+--+--+
The input is first matched to the 'alias' column. So in this case,
+13148980555 would match (because of the regex). After the script
finds a match, it returns the 'sendto' column. Does anyone know how
to get the script to expand the $1 variable? Is it even possible?
   ^^
I've toyed with it for a while, and can't get it right. Any help is
greatly appreciated.
That is a Frequently Asked Question.
perldoc -q expand variable
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Term::ReadKey substitute for perl v5.8.0

2004-12-08 Thread Jonathan Paton
On Wed, 8 Dec 2004 16:06:49 -0600, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Okay, I'm seeing mixed info on whether or not Term::ReadKey works
 properly with perl 5.8.0.  So, maybe I'll just throw out some code, and
 see if others can get it to work.
 
 I'm trying to wrap the ReadKey call in an infinite loop, but it breaks
 as soon as I add the loop.  Take away the loop, or convert the ReadKey
 to blocking, and it works just fine.  Here's the test code snippet I'm
 using:

Jason,

Have you tried placing the two ReadMode calls outside of the loop?

Jonathan Paton

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




want to get the count of rows of a table from oracle database using perl script

2004-12-08 Thread Priyanka krishnaraj
Hi All
 
I want to get the count of rows in paticular table of the oracle database. 
Should i write an sql script to conect to database? if so how didi retun the 
value to the perl script. please can anybody help me
 
thank you
pri

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com