Encoding iso-8859-16

2005-08-03 Thread Sastry
Hi

I am running the following script on EBCDIC 

use Encode;
$string = "a";
$enc_string = encode("iso-8859-16", $string);
print "\n String: $string\n";
print "\n enc_string: $enc_string\n";


The output:

String: a
enc_string: ñ (This is the character for codepoint \xF1 on iso-8859-16)

What is the expected output in enc_string?

On Linux both String and enc_string are set to "a"

Thanks in advance

regards
Sastry

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




Re: perl and java and html

2005-08-03 Thread Xavier Noria

On Aug 4, 2005, at 2:47, Chris Devers wrote:

You can run CGI scripts on your local computer IF you have a web  
server,
but that's not necessarily a problem. Most versions of Unix will  
already
include some version of the Apache web server, and there are many  
groups
offering pre-packaged versions of Apache along with Perl, MySQL,  
and PHP

for Windows. Once you have Apache installed, there's not much overhead
to running things this way -- you just interact with things through a
web browser on your computer using  etc.


There are other fast and lightweight web servers that have less  
features but are a breeze to configure, for instance:


 lighttpd
 http://www.lighttpd.net/

 Thy
 http://bonehunter.rulez.org/software/thy/

-- fxn

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




Transliteration operator(tr//)on EBCDIC platform

2005-08-03 Thread Sastry
Hi

I am trying to run this script on an EBCDIC platform using perl-5.8.6
 
($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/\x89-\x91/X/;
is($a, "");


The result I get is 

 'X«»ðý±°X'

a) Is this happening  since \x8a\x8b\x8c\x8d\x8f\x90 are the gapped
characters in EBCDIC ?
or 
b) Should all the bytes in $a change to X?

Thanks in advance
Sastry

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




Re: perl and java and html

2005-08-03 Thread Tony Frasketi
Thanks very much Chris for the clear explanation. Sounds like just what 
I need - A way to completely build and check out a web site on my own 
compter and then be able to migrate it to a hosting service when I'm 
ready. Sure beats the local editing and back and forth trips from my 
computer to the hosting service via FTP and SSH shell.


Tony


These kits are useful for developers to set up things on their Windows 
workstations (or laptops) and do all the work there, developing and 
testing sites all from one computer that isn't even necessarily attached 
to a network -- think of commuting on a train, etc. Once you're happy 
with how it works here, you can upload your work to whatever the server 
may be (or serverS, for that matter, if things are broken up that way), 
and everything should work the same way there that it did originally. 

These kits make things very easy, too. I've seen them set up on laptops 
for non-technical managers and salespeople so that they could do onsite 
demos of complex Apache / Perl / PHP / MySQL / Flash / Actionscript web
sites. Even if there wouldn't be a network connection available for the 
demo, no problem, just click the "Apache Start" icon in the Start menu, 
then open up http://localhost/demo/ in the web browser, and it seems as 
if the salesperson was connected back to the "real" site. Everything is 
going to work exactly the same way as the real site, even when it's all 
just running from a modest little Windows laptop.



 



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




Re: perl and java and html

2005-08-03 Thread Chris Devers
On Wed, 3 Aug 2005, Tony Frasketi wrote:

> I would appreciate it if you would steer me to one or more of those 
> groups you mentioned that offer pre-packaged version of Apache with 
> Perl, MySQL and PHP for windows 

A quick Google search turns up several:

http://www.google.com/search?q=windows+Apache+Perl+MySQL+PHP

Look through them and find one you like.

> Can these packages run on the same machine that I have windows 
> running? Do I access these packages from Windows or do i have to 
> dedicate a windows machine just for Apache functionality?

Yes. That's rather the point :-)

You can deploy things using these packages, but IMO that isn't really 
what they're most suitable for. All this software works fine on Windows 
now, but it really sings on Unix, and that's really the best way to put 
it into production. 

These kits are useful for developers to set up things on their Windows 
workstations (or laptops) and do all the work there, developing and 
testing sites all from one computer that isn't even necessarily attached 
to a network -- think of commuting on a train, etc. Once you're happy 
with how it works here, you can upload your work to whatever the server 
may be (or serverS, for that matter, if things are broken up that way), 
and everything should work the same way there that it did originally. 

These kits make things very easy, too. I've seen them set up on laptops 
for non-technical managers and salespeople so that they could do onsite 
demos of complex Apache / Perl / PHP / MySQL / Flash / Actionscript web
sites. Even if there wouldn't be a network connection available for the 
demo, no problem, just click the "Apache Start" icon in the Start menu, 
then open up http://localhost/demo/ in the web browser, and it seems as 
if the salesperson was connected back to the "real" site. Everything is 
going to work exactly the same way as the real site, even when it's all 
just running from a modest little Windows laptop.

I won't bother recommending a specific kit because every time I've 
looked in the past year or so, I turn up a whole different set of "top" 
ones according to Google rankings, and it isn't clear to me which, among 
the ones that come and go, has the best reputation. 

I knew a guy that really liked UniServer, to name just one, but I didn't 
like that one because the directory layout was really eccentric and it 
promoted bad habits like putting half the web server config in a bunch 
of scattered and hidden .htaccess files rather than one central 
httpd.conf, which made it really annoying to figure out some of the 
behavior it did. It mostly worked, but was hard to tinker with. 

I found another one that seemed to be much more sane than UniServer, but 
it was mostly in French & so was not really useful to a typical American 
development group. In any case, I forget what it was called.

So, like I say, search for yourself and decide for yourself which suite 
looks most useful to you. There's lots of options... :-)


-- 
Chris Devers

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




Re: perl and java and html

2005-08-03 Thread Tony Frasketi




Hello
I would appreciate it if you would steer me to one or more of those 
groups you mentioned that offer pre-packaged version of Apache with 
Perl, MySQL and PHP for windows  Can these packages run on the same 
machine that I have windows running? Do I access these packages from 
Windows or do i have to dedicate a windows machine just for Apache 
functionality? 
Thanks

Tony



You can run CGI scripts on your local computer IF you have a web server, 
but that's not necessarily a problem. Most versions of Unix will already 
include some version of the Apache web server, and there are many groups 
offering pre-packaged versions of Apache along with Perl, MySQL, and PHP 
for Windows. Once you have Apache installed, there's not much overhead 
to running things this way -- you just interact with things through a 
web browser on your computer using  etc. 
 



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




Re: perl and java and html

2005-08-03 Thread Chris Devers
On Wed, 3 Aug 2005, Sonia wrote:

> I want to run PERL script which will combine several JAVA applications.

This is possible.

> Furthermore, I need this script to run in the HTML page.

This is not possible.

HTML is just a "markup language". It tells an application such as a web 
browser how to present the contents of the page text, but that's it. You 
can have HTML that includes or refers to Javascript (or *cough* *spit* 
VBScript) code, but the application interpreting the HTML handles it 
separately, if at all. 

If you want to mix HTML and Perl [note that it isn't capitalized; nor is 
Java for that matter], the common way to do it is with a CGI script. CGI 
scripts are programs that get run by a web server, accepting a request 
from that server, processing the result in some way -- such as by firing 
off Java programs in the background -- and then returning results back 
to the web client, typically in HTML format. 

You can run CGI scripts on your local computer IF you have a web server, 
but that's not necessarily a problem. Most versions of Unix will already 
include some version of the Apache web server, and there are many groups 
offering pre-packaged versions of Apache along with Perl, MySQL, and PHP 
for Windows. Once you have Apache installed, there's not much overhead 
to running things this way -- you just interact with things through a 
web browser on your computer using  etc. 

If you want to do things this way, the beginners-cgi@perl.org list has 
been set up to help people get up and running with this sort of work.


-- 
Chris Devers

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




RE: perl string operations - query

2005-08-03 Thread Wagner, David --- Senior Programmer Analyst --- WGO
prakash m wrote:
> I have written a small code which will just try to split a string
> based on the Key. -
> $val="sample1a+2.8sample2a+2.8sample3a";
> print "String=$val\n";
> print "split Key: 2.8\n";
> @arr=split(/2.8/,$val);
> foreach $i (@arr)
> {
>   print "**Split value: $i\n";
> }
> print "**\n";
> print "split Key: a+2.8\n";
> @arr1=split(/a+2.8/,$val);
> foreach $j (@arr1)
> {
>   print "**Split value: $j\n";
> }
> 
> The first case the key is 2.8 and the output is correct, but if i
> want to split the string based on key "a+2.8" it's giving an improper
> result. 
> String=sample1a+2.8sample2a+2.8sample3a
> split Key: 2.8
> **Split value: sample1a+
> **Split value: sample2a+
> **Split value: sample3a
> **
> split Key: a+2.8
> **Split value: sample1a+2.8sample2a+2.8sample3a
> Can anyone tell me what changes are needed to split the string based
> on "a+2.8" 

If really a+2.8 then /a\+2\.8/ would be the split. The + has meaning in 
the regex as give me 1 or more a's. Also should \ the period since a+218 would 
be a valid split on a\+2.8 where the . says anything can be there.

Wags ;)
> Thanks,
> Prakash
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com



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


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




Re: perl string operations - query

2005-08-03 Thread Greg Maruszeczka
prakash m wrote:
> I have written a small code which will just try to split a string based on 
> the Key.
> -
> $val="sample1a+2.8sample2a+2.8sample3a";
> print "String=$val\n";
> print "split Key: 2.8\n";
> @arr=split(/2.8/,$val);
> foreach $i (@arr)
> {
>   print "**Split value: $i\n";
> }
> print "**\n";
> print "split Key: a+2.8\n";
> @arr1=split(/a+2.8/,$val);
> foreach $j (@arr1)
> {
>   print "**Split value: $j\n";
> }
> 
> The first case the key is 2.8 and the output is correct, but if i want to 
> split the string based on key "a+2.8"
> it's giving an improper result.
> String=sample1a+2.8sample2a+2.8sample3a
> split Key: 2.8
> **Split value: sample1a+
> **Split value: sample2a+
> **Split value: sample3a
> **
> split Key: a+2.8
> **Split value: sample1a+2.8sample2a+2.8sample3a
> Can anyone tell me what changes are needed to split the string based on 
> "a+2.8"


backwhack the '+' (ie. "\+")

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




perl string operations - query

2005-08-03 Thread prakash m
I have written a small code which will just try to split a string based on the 
Key.
-
$val="sample1a+2.8sample2a+2.8sample3a";
print "String=$val\n";
print "split Key: 2.8\n";
@arr=split(/2.8/,$val);
foreach $i (@arr)
{
  print "**Split value: $i\n";
}
print "**\n";
print "split Key: a+2.8\n";
@arr1=split(/a+2.8/,$val);
foreach $j (@arr1)
{
  print "**Split value: $j\n";
}

The first case the key is 2.8 and the output is correct, but if i want to split 
the string based on key "a+2.8"
it's giving an improper result.
String=sample1a+2.8sample2a+2.8sample3a
split Key: 2.8
**Split value: sample1a+
**Split value: sample2a+
**Split value: sample3a
**
split Key: a+2.8
**Split value: sample1a+2.8sample2a+2.8sample3a
Can anyone tell me what changes are needed to split the string based on "a+2.8"
Thanks,
Prakash

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

perl and java and html

2005-08-03 Thread Sonia
Hi,
I want to run PERL script which will combine several JAVA applications.
Furthermore, I need this script to run in the HTML page.
Is that possible?  Can I run this locally on my machine, without a server?

Thanks



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




match basename file and s / / /;

2005-08-03 Thread Brian Volk
Hi All~
 
my program below is not returning any errors but nothing is happening to the
.txt files like I hoped.  Can someone pls take a look and let me know what
I'm doing wrong.  
 
- Thank you! 
 
# If there is a .pdf file and a matching .txt file, open the .txt file and s
%  http://.*  %  "$link"  %  
 
#!/usr/bin/perl 
 
use strict;
use warnings;
use File::Basename;
 
my $pdf_dir = "j:/flash_host/ecomm/descriptions/product/MSDS";
opendir(PDFDIR, $pdf_dir) or die "Can't open the $pdf_dir: $!\n";
 
# read file/directory names in that directory into @htmls
 
my @pdfs = readdir(PDFDIR) or die "Unable to read current dir:$!\n";
 
closedir(PDFDIR);
 
my $text_dir = "c:/brian/descriptions/product/small";
opendir (TEXTDIR, $text_dir) or die "Can't open $text_dir: $!";
 
# read all the .txt files and load @ARGV for <> operator
 
@ARGV = map { "$text_dir/$_" } grep { !/^\./ } readdir TEXTDIR;
 
my %PDFDIR_LIST;
 
$PDFDIR_LIST{$_}=1 for @pdfs;
 
foreach my $text_file (<>) {
 
my ($basename, $suffix) = fileparse($text_file,'.txt');
 my $link = "descriptions/product/small/$basename.pdf";
 
 if( $PDFDIR_LIST{"$basename.pdf"} ){
 open FH, $text_file or die "can't open $text_file: $!";
s% http://.* % $link %;
next;}
 
 }
close (FH);
closedir (TEXTDIR);
 
__END__
 
 
 
Brian Volk
HP Products
317.298.9950 x1245
  [EMAIL PROTECTED]
 


Re: weird return

2005-08-03 Thread Brent Clark

Brent Clark wrote:

Brent Clark wrote:


Hi list

I have my code as so:

for my $roomCode ( keys %{ $ref_hash->{$fileName} } ){
my $roomName =  $ref_hash->{$fileName}{$roomCode};

if( $pCode eq 'p110'){
if ($p110rm01 eq $roomName ){
$finalHash{$fileName}[0] = $roomName;


K sorry for been a pain

I realised my mistake,

But whats the diffs with

$finalHash{$fileName}[0] = $roomName;

or

push @{ $finalHash{$fileName} } ,  $roomName;


--
Brent Clark
MSN: [EMAIL PROTECTED]
WEB: http://www.eccotours.biz
eMail: [EMAIL PROTECTED]
Tel: +27 21 683 0069
Fax: +27 21 683 6137

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




Re: How to set uid ?

2005-08-03 Thread John W. Krahn
Prasad J Pandit wrote:
>   Hello friends !

Hello,

> Does any one know how to set user-id in perl script? I
> mean counter-part of setuid() in perl ??

You mean that you don't want to use POSIX::setuid()?  You might want to
lookup the $< and $> variables in:

perldoc perlvar


John
-- 
use Perl;
program
fulfillment

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




Re: firing an external program and exiting

2005-08-03 Thread Ram
> 
> Let's try this again :) You were most of the way there the first time,
> and the shell script thing I suggested is unnecessary.
> 
> system("command >/dev/null &"); # works for me
> 
> Specifically:
> 
> sleep.pl:
> #!/usr/bin/perl
> $|++;
> print STDERR time." start of sleep\n";
> sleep(5);
> print STDERR time." end of sleep\n";
> 
> sleep.cgi:
> #!/usr/bin/perl
> system('/path/to/sleep.pl >/dev/null &');
> print "Content-type: text/html\n\n";
> print "done printing".time;
> 
> 
> 
Yes this works now..thanks Dave..

You have hell of patience :)


Now since sleep.pl has been invoked by sleep.cgi, sleep.pl will spawn as 
child process with cgi script being the parent process. Then
sleep.cgicannot stop until
sleep.pl gets finished.

So effectively, even though the html page is displayed to the user the 
sleep.cgi script will not exit and return to webserver.

Is my understanding correct? If it is correct, then how do we make a new 
process independent of invoking process?


Re: Backup of a subroutine

2005-08-03 Thread Dave Gray
On 8/3/05, John W. Krahn <[EMAIL PROTECTED]> wrote:
> marcos rebelo wrote:
> > I need to redefine localy one subroutine and have it correctlly after.
> > How do I do it?
> 
> $ perl -e'
> my $myPrint = sub { print "Teste 1\n" };
> 
> sub test { $myPrint = sub { print "Teste 2\n" } }
> 
> $myPrint->();
> test;
> $myPrint->();
> exit;
> '
> Teste 1
> Teste 2

If you combine this solution with local variables, you can do exactly
what you need:

#!/usr/bin/perl
use strict;
use warnings;
our $print = sub { print "test 1\n" };
sub test { $print = sub { print "test 2\n" } }
$print->();
{
  local $print = $print;
  $print->();
  test();
  $print->();
}
$print->();

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




Re: reg exp using \G

2005-08-03 Thread DBSMITH
   
 Jay Savage
 <[EMAIL PROTECTED] 
 l.com> To 
   "[EMAIL PROTECTED]"
 08/02/2005 05:43  <[EMAIL PROTECTED]>, beginners 
 PMperl
cc 
   
 Please respond to Subject 
Jay Savage Re: reg exp using \G
 <[EMAIL PROTECTED] 
  l.com>   
   
   
   
   







Please don't top post. I think you've been asked this before.


On 8/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> ok I understand now...thanks, but I tried it and it is still stopping at
> original1.1
> I then modified it to print YE if ($1) but never saw YE in
STDOUT.


Tha's because as a one liner it doesn't use parentheses. And also
becuase YES isn't a string, it's a constant. Do you have warnings
turned on? warnings and strict would catch these sorts of things.

print "Yes" if $1;   # or
if ($1) {print "Yes"}

Your choice.


> > #!/usr/bin/perl
> > use strict;
> > use warnings;
> >
> > while () {
> > if (/AA/ ... /(CC)/) {
> > print;
> > if ($1) {
> > while () {
> > # this regex defines when your section is done
> > last if /^\s*$/;
> > print;
> > }
>
> # so you don't have to spin over the rest of the file
> last;
>
> > }
> > }
> > }

I think we need a clearer description of what you want to do here. At
least I do. will your last line have "original.1"? Or will it have
something else? i don't think anyone knows what "the "end of
original.1" means. "original.1" is a string, and the current code
matches that string. If you need to match the end of the string, use
'/original\.1$/'.

I think, though that you mean the end of some block of lines in your data
file.

It looks to me like you want something along the lines of :

  while(<>) {
if (/allsets/ .. /original\.1/) {
  print;
} elsif (/media/ .. /Total/) {
  print;
}
  }

-- j
--



BOTTOM POST

I got it working and the code I am using is now

open (ARC, "archiver -lv |") or die $!;
my $flag=0;
foreach ()
{
if (/(?i)allsets/)
{
$flag=1;
}
if ($flag==1)
{
print $_;
  }
}

as opposed to

if (/allsets/ .. /original1.1/ )

because I needed the data after original1.1.

thank you
derek






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




Re: firing an external program and exiting

2005-08-03 Thread Dave Gray
On 8/2/05, Ram <[EMAIL PROTECTED]> wrote:
> I have a situation where a CGI script has to start an independent perl
> script and exit without capturing the output or waiting for the exit code.
> It doesnt make any practicle sense to me as this perl script takes good 6
> hours to run and my CGI script obviously shouldnt keep the user waiting.
> 
> exec command doesnt seem to work, nor system command combined with
> ampersand(&) in command.
> 
> I tried
> 
> exec("command");
> and also
> system("command &");
> 
> Niether seemed to work, for the reason which I assume is, since it is a CGI
> script and webserver waits until this script exits and then displays the
> results to the browser. What was thought to be a simple thing is becoming a
> huge problem.

Let's try this again :) You were most of the way there the first time,
and the shell script thing I suggested is unnecessary.

system("command >/dev/null &"); # works for me

Specifically:

sleep.pl:
#!/usr/bin/perl
$|++;
print STDERR time." start of sleep\n";
sleep(5);
print STDERR time." end of sleep\n";

sleep.cgi:
#!/usr/bin/perl
system('/path/to/sleep.pl >/dev/null &');
print "Content-type: text/html\n\n";
print "done printing".time;

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




How to set uid ?

2005-08-03 Thread Prasad J Pandit

  Hello friends !
Does any one know how to set user-id in perl script? I
mean counter-part of setuid() in perl ??


Regards
-Prasad
PS: Please don't send me html/attachment/Fwd mails




Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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




Re: Backup of a subroutine

2005-08-03 Thread John W. Krahn
marcos rebelo wrote:
> I need to redefine localy one subroutine and have it correctlly after.
> Who do I do it?
> 
> sub myPrint () {
> print "Teste 1\n";
> }
> 
> sub test {
> no strict "refs";
> no warnings;
> 
> my $str = "::myPrint";
> 
> #my $backup = $main::{myPrint};
> my $backup = *$str;
> 
> *$str = sub() {
> print "Teste 2\n";
> };
> 
> myPrint;
> 
> *$str = $backup;
> }
> 
> myPrint;
> test;
> myPrint;
> exit;
> 
> Note: This is not beautyfull but I'm doing some test-cases and I don't
> want to change the code to be tested.

$ perl -e'
my $myPrint = sub { print "Teste 1\n" };

sub test { $myPrint = sub { print "Teste 2\n" } }

$myPrint->();
test;
$myPrint->();
exit;
'
Teste 1
Teste 2



John
-- 
use Perl;
program
fulfillment

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




Segmentation Fault - Perl5.8.5

2005-08-03 Thread Kaushik.Saiprasad
Hi Monks,

I'm currently involved in migrating a huge chunk of code (>45,000 LOC)
from 'perl/5.6.0a' to 'perl/5.8.5'. A significant part of this code is
made up of calls to 'Tk' widgets / GUIs. 

The issue is the following:

This code, which used to work without any problems with 'perl/5.6.0a',
has all of a sudden started giving 'Segmentation Faults'. This happens
ONLY during the GUI invocation stage and that too, only the FIRST time
the GUI is invoked from a particular shell! During the successive calls
from the SAME SHELL, the GUI works fine!

as any of you faced similar problems? Any idea what could be causing
these 'First-Time' failures? Thanks!

Cheers,
Kaushik

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




Re: Backup of a subroutine

2005-08-03 Thread marcos rebelo
sub myPrint () {
print "Teste 1\n";
}

sub test() {
no strict "refs";
no warnings;

my $subName = "::myPrint";

my $backup = \&myPrint;

*$subName = sub() {
print "Teste 2\n";
};

myPrint;

*$subName = $backup;
}

myPrint;
test;

myPrint;

On 8/3/05, marcos rebelo <[EMAIL PROTECTED]> wrote:
> I need to redefine localy one subroutine and have it correctlly after.
> Who do I do it?
> 
> sub myPrint () {
>print "Teste 1\n";
> }
> 
> sub test {
>no strict "refs";
>no warnings;
> 
>my $str = "::myPrint";
> 
> #my $backup = $main::{myPrint};
>my $backup = *$str;
> 
>*$str = sub() {
>print "Teste 2\n";
>};
> 
>myPrint;
> 
>*$str = $backup;
> }
> 
> myPrint;
> test;
> myPrint;
> exit;
> 
> Note: This is not beautyfull but I'm doing some test-cases and I don't
> want to change the code to be tested.
>

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




Re: I finally blew my TAINT

2005-08-03 Thread Tom Allison



How many of the following do I have to do:

untaint the $key after it's pulled from the Apache Cookie.
untaint the $username/$password from the login form (DONE).
untaint the $username/$password from the Cache::FileCache object.

Because these variables are passed through a number of objects and 
methods where is the best point to untaint the variables?




All of them.

But I have to plug Test::More.
If you don't use it, you should.
It's a great aide at times like this.

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




Backup of a subroutine

2005-08-03 Thread marcos rebelo
I need to redefine localy one subroutine and have it correctlly after.
Who do I do it?

sub myPrint () {
print "Teste 1\n";
}

sub test {
no strict "refs";
no warnings;

my $str = "::myPrint";

#my $backup = $main::{myPrint};
my $backup = *$str;

*$str = sub() {
print "Teste 2\n";
};

myPrint;

*$str = $backup;
}

myPrint;
test;
myPrint;
exit;

Note: This is not beautyfull but I'm doing some test-cases and I don't
want to change the code to be tested.

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




Re: weird return

2005-08-03 Thread John Doe
Brent Clark am Mittwoch, 3. August 2005 10.43:
> Hi list

Hi

> I have my code as so:
>
> for my $roomCode ( keys %{ $ref_hash->{$fileName} } ){
>   my $roomName =  $ref_hash->{$fileName}{$roomCode};
>   if( $pCode eq 'p110'){
>   if ($p110rm01 eq $roomName ){
>   $finalHash{$fileName}[0] = $roomName;

Please post all relevant code, and data in $ref_hash.
Best to post a runnable example.

$pCode is not defined.
$p110rm01 is not defined.
$finalHash is not defined.

>
>   my Data::Dumper return as so:
>
>   'Grac01' => [
>   ${\$VAR1->{'Mabu01'}[0]},   #This 
> is not correct

Could be a circular reference withing the data structure.

>  'Suite',
>  'Penthouse'
>   ],
>
> Would anyone know why I get this back
>
> I tried print just after I have
>   my $roomName =  $ref_hash->{$fileName}{$roomCode};
>
> and the print is fine.
>
> its just when I add the name to the hash or arrays.
>
> If anyone could point out where im going wrong, I  would greatfully
> appreciate your help.
>
> Kind Regards
> Brent Clark


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




Re: weird return

2005-08-03 Thread Brent Clark

Brent Clark wrote:

Hi list

I have my code as so:

for my $roomCode ( keys %{ $ref_hash->{$fileName} } ){
my $roomName =  $ref_hash->{$fileName}{$roomCode};

if( $pCode eq 'p110'){
if ($p110rm01 eq $roomName ){
$finalHash{$fileName}[0] = $roomName;


my Data::Dumper return as so:   


Hi list

This is soo weird because I have it more then once:

$VAR1 = {
  'Alph02' => [
'Chalet'
  ],
  'Grac01' => [
${\$VAR1->{'Mabu01'}[0]},
'Suite',
'Penthouse'
  ],
  'Elle01' => [
'Standard Room (no-seaview) (Rm6)',
${\$VAR1->{'Mabu01'}[0]},
${\$VAR1->{'Mabu01'}[0]},
'Ellerman Suite (Suite 7)',
'East Wing Suite (Suite 11)'
  ],
  'Vine01' => [
${\$VAR1->{'Mabu01'}[0]},
${\$VAR1->{'Mabu01'}[0]},
'Mountain Facing Room',
'River Deluxe Suite',
'Courtyard Facing Suite',
'Mountain Facing Suite'
  ],

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




weird return

2005-08-03 Thread Brent Clark

Hi list

I have my code as so:

for my $roomCode ( keys %{ $ref_hash->{$fileName} } ){
my $roomName =  $ref_hash->{$fileName}{$roomCode};

if( $pCode eq 'p110'){
if ($p110rm01 eq $roomName ){
$finalHash{$fileName}[0] = $roomName;


my Data::Dumper return as so:   

'Grac01' => [
${\$VAR1->{'Mabu01'}[0]},#This is 
not correct
'Suite',
'Penthouse'
],

Would anyone know why I get this back

I tried print just after I have
my $roomName =  $ref_hash->{$fileName}{$roomCode};

and the print is fine.

its just when I add the name to the hash or arrays.

If anyone could point out where im going wrong, I  would greatfully 
appreciate your help.


Kind Regards
Brent Clark


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