write smiley to file

2007-11-23 Thread Ken Perl
I use following piece of code to write smiley Unicode  string into a file,

use Encode;
my $smiley = \x{263a};
open my $out, :utf8, file or die $!;
print $out $smiley;

however, if we dump the output file in binary mode, the hex looks
wrong, it isn't 263a, any idea what's wrong with the code?

000: e298 ba  ...


-- 
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




extracting NAME and DESCRIPTION sections from pod text file

2006-08-13 Thread Ken Perl

what's correct regular expression on extracting only NAME and
DESCRIPTION section from pod text file?
I have tried this, but failed!

perl -e '$c=`pod2text /data/WebGUI/lib/WebGUI/User.pm`;$c =~
s/(NAME.*)SYNOPSIS/$1/;print $c'

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




Re: non fixed number of properties in constructor

2006-07-20 Thread Ken Perl

I almost got the ideas with all your replies, thanks.

On 7/20/06, D. Bolliger [EMAIL PROTECTED] wrote:

Hi Ken

Ken Perl am Mittwoch, 19. Juli 2006 12:04:
 ok, let me explain what I mean.

Better done by inline/bottom posting, if you already got a bottom answer :-)

 $account = new Account;
 then I can get the currency of the two countries,
 $account-currency_us;
 $account-currency_fr;

 after I freeze the code, a new country jumps out, suppose i need
 support Iraq, but now I can't use this,
 $account-currency_iraq;
 If I want to support this method, I have to modify the constructor
 again to add the new country, but what I am looking for is the
 solution that doesn't need to modify the constructor again.

If I don't misunderstand you, you are looking for a lookup class to find out
the currency of countries, and the (country, currency) pairs are defined in a
database.

You have two variables here:
1) the number of (country, currency) pairs
2) the information needed to access the underlying database table

sub new {
  my $class=shift;
  my $dbh=shift; # of DBI class
  my ($tablename, @fieldnames)[EMAIL PROTECTED] # if this flexibility needed

  my %pairs;
  # initialize %pairs (country, currency) from database

  return bless \%pairs, $class;
}

sub currency {
  my ($self, $country)[EMAIL PROTECTED];
  return exists $self-{$country}
? $self-{$country}
: undef;
}

The usage of this class is not easy because of the many arguments to new().
But it's enough flexible as to not need changes.

For easier usage, you could derive a class that encapsulates most or all
arguments to new() of the base class (by hardcoding it, by using a
configfile).

But I'm a bit in doubt as to whether there is not a simpler solution...

Maybe this gives you an idea?
And sorry for my bad english :-)


Dani

[history]
 On 7/19/06, Rob Dixon [EMAIL PROTECTED] wrote:
  Ken Perl wrote:
   I find a difficulty when writing the constructor which may has dynamic
   and non fixed number of properties, say we want to construct a new
   class Account,
  
   package Account;
  
   sub new {
my $class = shift;
my $self = { currency_us=undef,
   currency_fr =undef,
};
bless $self, $class;
return $self;
   }
  
   If we want to create new object with more other contries' currency and
   don't want to modify the code, for example, get more other contries'
   name from database, how to write my constructor method and it can live
   with the dynamic database?
 
  I'm unclear what you want. I don't see how you an do anything without
  modifying the code. Do you mean you want to subclass Account?
 
  Suppose you have a list of currencies in @currencies (I can't explain how
  to get it there as I don't know where it's coming from) you can add these
  to your object with:
 
 my @currencies = qw/ currency_uk currency_gr currency_sp /;
 
 @[EMAIL PROTECTED] = ();
 
  Does this help at all?
 
  Rob
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  http://learn.perl.org/ http://learn.perl.org/first-response

 --
 perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
 )'

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






--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




xml::simple declartion missed

2006-07-20 Thread Ken Perl

hi,
The code's output doesn't include the xml declaration ?xml
version=1.0?, how to fix the issue in the program?

use XML::Simple;

my $cust_xml = XMLin('./customers.xml', forcearray=1,KeepRoot=1);

for my $customer (@{$cust_xml-{customer}}) {
 # Capitalize the contents of the 'first-name' and 'surname' elements
 # by running Perl's built-in uc( ) function on them
 foreach (qw(first-name surname)) {
   $customer-{$_}-[0] = uc($customer-{$_}-[0]);
 }
}

print XMLout($cust_xml, RootName='');
print \n;

?xml version=1.0?
spam-document version=3.5 timestamp=2002-05-13 15:33:45
!-- Autogenerated by WarbleSoft Spam Version 3.5 --
customer
 first-nameJoe/first-name
 surnameWrigley/surname
 address
   street17 Beable Ave./street
   cityMeatball/city
   stateMI/state
   zip82649/zip
 /address
 email[EMAIL PROTECTED]/email
 age42/age
/customer
customer
 first-nameHenrietta/first-name
 surnamePussycat/surname
  address
   streetR.F.D. 2/street
   cityFlangerville/city
   stateNY/state
   zip83642/zip
  /address
  email[EMAIL PROTECTED]/email
  age37/age
 /customer
/spam-document

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




non fixed number of properties in constructor

2006-07-19 Thread Ken Perl

hi there,

I find a difficulty when writing the constructor which may has dynamic
and non fixed number of properties, say we want to construct a new
class Account,

package Account;

sub new {
 my $class = shift;
 my $self = { currency_us=undef,
currency_fr =undef,
 };
 bless $self, $class;
 return $self;
}

If we want to create new object with more other contries' currency and
don't want to modify the code, for example, get more other contries'
name from database, how to write my constructor method and it can live
with the dynamic database?


--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




Re: non fixed number of properties in constructor

2006-07-19 Thread Ken Perl

ok, let me explain what I mean.
$account = new Account;
then I can get the currency of the two countries,
$account-currency_us;
$account-currency_fr;

after I freeze the code, a new country jumps out, suppose i need
support Iraq, but now I can't use this,
$account-currency_iraq;
If I want to support this method, I have to modify the constructor
again to add the new country, but what I am looking for is the
solution that doesn't need to modify the constructor again.


On 7/19/06, Rob Dixon [EMAIL PROTECTED] wrote:

Ken Perl wrote:

 I find a difficulty when writing the constructor which may has dynamic
 and non fixed number of properties, say we want to construct a new
 class Account,

 package Account;

 sub new {
  my $class = shift;
  my $self = { currency_us=undef,
 currency_fr =undef,
  };
  bless $self, $class;
  return $self;
 }

 If we want to create new object with more other contries' currency and
 don't want to modify the code, for example, get more other contries'
 name from database, how to write my constructor method and it can live
 with the dynamic database?

I'm unclear what you want. I don't see how you an do anything without modifying
the code. Do you mean you want to subclass Account?

Suppose you have a list of currencies in @currencies (I can't explain how to get
it there as I don't know where it's coming from) you can add these to your
object with:

   my @currencies = qw/ currency_uk currency_gr currency_sp /;

   @[EMAIL PROTECTED] = ();

Does this help at all?

Rob

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






--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




modules maillist

2006-07-03 Thread Ken Perl

hi,

Is there a maillist talking about or seeking a module to a specific
requirement? For example, I want to write a module or application to
store all the glossary in my head, first, I search it on cpan.org but
and don't find any userful module, but I still want to confirm that no
one hasn't done that before, is this kind of maillist to ask?

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




web 2.0 module

2006-06-23 Thread Ken Perl

hi,
does anybody know any mature web2.0 modules on CPAN?

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




print Greek small letter alpha in html

2006-06-14 Thread Ken Perl

hi,
To print Greek small letter alpha in a html page, I tried to print
this in perl but not work,
#03B1;

could someone give me some clue how to make this work?

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




hashref and hash

2006-05-18 Thread Ken Perl

I am writing the new method for class Empolyee which inherited from
the base Person, the Person's new emthod expects a hash as its
parameters, because it is a class using Class::DBI.
The Employee's new method use hashref as its parameters, so how should
I write the new method for class Employee?
is this correct?

sub new {
   my $class = shift;
   my $fields = shift;
   my $self = {};
   if (defined $fields)
   {
   $self = Person-retrieve(%$fields);
   }
   bless $self, $class;
   return $self;
}

the retrieve method expects a hash, so how could I transfer the
hashref to a hash so I could  pass on it?

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




rebless another object

2006-05-18 Thread Ken Perl

hi,
how to rebless another object in current package's constructor? could
somebody give me an example?

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




Re: rebless another object

2006-05-18 Thread Ken Perl

yes, this is helpful, so I won't re-bless any object now.

On 5/18/06, Tom Phoenix [EMAIL PROTECTED] wrote:

On 5/18/06, Ken Perl [EMAIL PROTECTED] wrote:

 how to rebless another object in current package's constructor? could
 somebody give me an example?

perlobj sez:

  Although a constructor can in theory re-bless a referenced
  object currently belonging to another class, this is almost
  certainly going to get you into trouble.  The new class is
  responsible for all cleanup later.  The previous blessing is
  forgotten, as an object may belong to only one class at a time.
  (Although of course it's free to inherit methods from many
  classes.)  If you find yourself having to do this, the parent
  class is probably misbehaving, though.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training




--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




Re: getter setter and database

2006-05-17 Thread Ken Perl

I don't have know any modules including Class::DBI, If I use
Class::DBI to generate accessors with name of columns, do I still need
the my own accessors above in my package? I think it is needed, but I
don't find a demo how to combine the two accessors together.

On 5/17/06, Peter Scott [EMAIL PROTECTED] wrote:

On Wed, 17 May 2006 08:23:11 +0800, Ken Perl wrote:
 suppose I have a table person with following columns, name, age,
 salary. If use OOP
[snip]
 My question is, should I query/update the table at the same time in
 above accessor method?

Some people do.  Some defer it in various ways.  Depends on your
application.

You are aware that there are several modules already addressing this
problem?  Try Class::DBI.

--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


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






--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




getter setter and database

2006-05-16 Thread Ken Perl

suppose I have a table person with following columns, name, age,
salary. If use OOP to write a class like this,
package Person;
sub new{
   $class=shift;
   my $self = {};
   $self-{_name} = undef;
   $self-{_age}  = undef;
   $self-{_salary}= undef;
   bless ($self,$class);
   return $self;
}

#accessor method for name
sub name {
   my $self = shift;
   my $name = shift;
   $self-{_name} = $name if defined($name);
   return $self-{_name};
}

My question is, should I query/update the table at the same time in
above accessor method? If not, what's the best practice?

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




match file name at end of a http url

2006-04-25 Thread Ken Perl
If I want to use regular expression to extract the charactors after
the last '/' in the url, but below regexpr doesn't work, what I do
wrong?

$url = 'http://website.com/path/file_name.img';
if (/\/.*$/)
{
print $url.is matched \n;
}
else
{
print failed;
}

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




Re: match file name at end of a http url

2006-04-25 Thread Ken Perl
I don't know how to use URI::URI to solve my problem after reading the pod doc.
since it is not easy to use regex, I am going to use split '/', $url
to extract the last field.

On 4/26/06, Tom Phoenix [EMAIL PROTECTED] wrote:
 On 4/25/06, nishanth ev [EMAIL PROTECTED] wrote:

  if( $url =~ /\/([\w.]*$)/ ){
  print $1;
  }

http://example.com/some-file.txt

   To process a URL requires more than a simple pattern
   match. Use a
   module from CPAN. Cheers!

 What I said.

 --Tom Phoenix
 Stonehenge Perl Training

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





--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




parenthesis after a method

2006-03-09 Thread Ken Perl
I want to put some methods in a POD file synopsis section, which one
is correct if a method without a passing in parameter.

=head2 generate

This function generates a global unique id.

or

=head2 generate()

This function generates a global unique id.

any rules?

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




Re: dual core cpu

2006-02-20 Thread Ken Perl
If I run modperl2 program, anything special I need to take care? I
don't know if the modperl program will benefit from the new cpu
technique?

On 2/20/06, Rob Coops [EMAIL PROTECTED] wrote:
 The awnser is a little more complicated than yes or no...
  - Does your compiler support dual core? (the awnser on most modren systems
 woudl be yes)
  - Does the code you are compiling utilize more than one core? (the usual
 awnser is who knows unless you start going over the code it will be a
 guessing game)
  - HT (Hyper Treading) is nothing more than a technique to execute some
 treads on one and other treads on the other core. So unless you are using
 treads in your perl code or very heavily relying on compiled code that uses
 treads this is of little real use.

 So Perl it self couldn't care less about if you are using a single core or a
 multi core machine. It is the code that you write and the modules that you
 use that are the possible issues. So if you are in need of more power try to
 make as much process as posible run in paralel using threads (or fork of
 course), then for that extra bit of mussle you could try and tackle the libs
 that perl you are using, rework and recompile, though that is not very
 advisable as this will force you to check and do this everytime these libs
 are updated.

 Regards,

 Rob


 On 2/20/06, Owen Cook [EMAIL PROTECTED] wrote:
 
 
  On Mon, 20 Feb 2006, Ken Perl wrote:
 
   Does perl support dual core cpu(HT) technology?
   --
   perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL 
   PROTECTED]
   )'
 
 
  As an observer, I would say yes.
 
  When you configure CPAN, I think it asks a question How many cores do you
  have...press enter if you don't understand this question The letter
  j appears
 
  Also when you build perl, the config script asks a similiar question IIRC.
 
 
 
  Owen
 
 
  --
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  http://learn.perl.org/ http://learn.perl.org/first-response
 
 
 




--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




dual core cpu

2006-02-19 Thread Ken Perl
Does perl support dual core cpu(HT) technology?
--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




Re: :: and -

2006-02-18 Thread Ken Perl
This is really very clear.

On 2/17/06, Hans Meier (John Doe) [EMAIL PROTECTED] wrote:
 Ken Perl am Freitag, 17. Februar 2006 02.34:
  what is the difference of :: and - in this statements?
 
  $authInstance =
  Operation::Auth::getInstance($session,$u-authMethod,$u-userId)
 
  $authInstance =
  Operation::Auth-getInstance($session,$u-authMethod,$u-userId)

 The first '::' is part of a package name, the package is

package Operation::Auth

 The last '::' (in the first example) denotes a sub in this package and is a
 procedure invocation, the sub getting only the passed arguments.

 The '-' is a method invocation, and the class name ('Operation::Auth' in this
 case) is implicitly passed to getInstance as first argument (as Chas already
 said).

 The two notations are not interchangeable if the sub definition is for example

 sub getInstance {
my ($class, $session, $meth, $uid)[EMAIL PROTECTED];
...
 }

 intended to be called as method.

 The first invocation would leed to an error since the first argument
 getInstance receives is $session, and not a class name.


 hth,
 joe

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





--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




print interactive debugging info into a file

2006-02-18 Thread Ken Perl
The DB::OUT filehandle is opened to /dev/tty, regardless of where
STDOUT may be redirected to, so it's impossible to print the
interactive debugging info into a file?
I tried 'x @session /tmp/data' in the debugger and didn't work.

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




:: and -

2006-02-16 Thread Ken Perl
what is the difference of :: and - in this statements?

$authInstance = Operation::Auth::getInstance($session,$u-authMethod,$u-userId)

$authInstance = Operation::Auth-getInstance($session,$u-authMethod,$u-userId)

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




get rid of IO::Handle::DESTROY

2006-02-14 Thread Ken Perl
I am using Apache::DB as interactive debugger to debug my modperl2 program.

No breakpoints are defined, I input many 'r' while requesting the home
page,  and the return is always like below, and the home page can't be
displayed in the debug mode.
However, if turning off the debug mode, the home page can be rendered normally.

 DB1 r
void context return from IO::Handle::DESTROY
IO::Handle::DESTROY(/usr/lib/perl/5.8/IO/Handle.pm:75):
75: sub DESTROY {}
 DB1 r
void context return from IO::Handle::DESTROY
Apache2::SizeLimit::handler(/usr/lib/perl5/Apache2/SizeLimit.pm:248):
248:my $r = shift;

Any comments about why I got so many  IO::Handle::DESTROY messages
again and again? How to remove them and let the debugging go smoothly?
--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




non-lvalue

2006-02-12 Thread Ken Perl
Root cause: Can't modify non-lvalue subroutine call at ...


what is the meaning of non-lvalue in the error?


--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




debug code in BEGIN{} block

2006-01-19 Thread Ken Perl
How to debug code in BEGIN{} block?

--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




encode base64 password

2005-12-22 Thread Ken Perl
Hi,

Is the MIME::Base64 support unicode?
I am trying to use the module to encode the  a password.

In the doc http://support.microsoft.com/default.aspx?scid=kb;en-us;263991
there is one line like this unicodePwd::IgBuAGUAdwBQAGEAcwBzAHcAbwByAGQAIgA=
the encoded string is what I want to produce using the module, I tried this,
#!/usr/bin/perl
use MIME::Base64;

$encoded = encode_base64('welcome');
print $encoded;

below is the output,
d2VsY29tZQ==

But the output encoded string looks a little shorter than in the
example, what I did something wrong?


--
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




Re: encrypt the password stored in a file

2005-08-30 Thread Ken Perl
In fact, I are just writing a demo program used in a presentation,
when I open its config file through screen sharing,  I don't want the
visiter see the plain text password.

On 8/30/05, Miguel Santinho [EMAIL PROTECTED] wrote:
 Em (On) Mon, Aug 29, 2005 at 12:36:32PM -0400, Bob Showalter escreveu (wrote):
  Ken Perl wrote:
   The password used to access a ftp server is stored in a text file, the
   perl program gets the password from the file, the pass it to the ftp
   server for logon, this is the background.
   The requirement is encrypt the password store in a more secure way,
   and the perl program could still use the encrypted password to logon
   the server. what algorithm should be used in this task?
 
 If someone can access your machine to get the password... then your problem
 is not the way you encrypt that file, but the way you protect your machine.
 ;-)
 
 --
 +-
 | Simplicidade.com
 | Consultoria em Tecnologias de Informação, Lda.
 +-
 | Rua António Onofre, 4D
 | 2870-220 Montijo - PORTUGAL
 | Tel./Fax: +351 21 231 01 51
 +-
 | [EMAIL PROTECTED] | http://www.simplicidade.com
 +-
 
 
 



-- 
perl -e 'print unpack(u,62V5N\FME;G\!EFQ`9VUA:6PN8V]M\[EMAIL PROTECTED]
)'

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




encrypt the password stored in a file

2005-08-28 Thread Ken Perl
The password used to access a ftp server is stored in a text file, the
perl program gets the password from the file, the pass it to the ftp
server for logon, this is the background.
The requirement is encrypt the password store in a more secure way,
and the perl program could still use the encrypted password to logon
the server. what algorithm should be used in this task?

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




Re: Perl Interview Questions

2005-08-24 Thread Ken Perl
What the name of the big company?

On 8/25/05, Chris Devers [EMAIL PROTECTED] wrote:
 On Thu, 25 Aug 2005, praba har wrote:
 
I am working as perl-cgi programmer in a small company.  I got a
  call from the big company for Perl developer post.  So I need perl
  related interview point of view questions. Kindly help me for this
  interview.
 
 Explain what a closure is and why you would use one.
 
 
 
 
 --
 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
 
 


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




copy and run a program on remote windows

2005-08-18 Thread Ken Perl
I want to implement a module in perl to do the same thing as the tool
PsExec (http://www.sysinternals.com/Utilities/PsExec.html) does, which
is used to copy and run a program on remote windows, a very cool tool!

So, I want to know if anyone has done this before. 
and If I do the implement from scratch, what modules should I use, or
any comments are welcome.

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




nmake error

2005-08-11 Thread Ken Perl
Anybody knows what the nmake error means? 

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

C:\activePerl\bin\perl.exe -MExtUtils::Command::MM -e test_harness(
0, 'inc', 'blib\lib', 'blib\arch') t\0-signature.t t\1-basic.t
t\0-signature'gpg' is not recognized as an internal or external command,
operable program or batch file.
Cannot use GnuPG or Crypt::OpenPGP, please install either one first!
Not in MANIFEST: blib/arch/auto/Parse/Binary/.exists
Not in MANIFEST: blib/lib/auto/Parse/Binary/.exists
Not in MANIFEST: blib/lib/Parse/.exists
Not in MANIFEST: blib/lib/Parse/Binary.pm
Not in MANIFEST: blib/lib/Parse/Binary/FixedFormat.pm
Not in MANIFEST: blib/lib/Parse/Binary/FixedFormat/Variants.pm
Not in MANIFEST: Makefile
Not in MANIFEST: pm_to_blib
== MISMATCHED content between MANIFEST and distribution files! ==
t\0-signatureFAILED test 1
Failed 1/1 tests, 0.00% okay
t\1-basicok
Failed Test Stat Wstat Total Fail  Failed  List of Failed
---
t\0-signature.t11 100.00%  1
Failed 1/2 test scripts, 50.00% okay. 1/2 subtests failed, 50.00% okay.
NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0xff'
Stop.

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