REG: How to add perl repository in PPM

2013-06-26 Thread Anitha Sreejith Victor
Hi All,

Please suggest with the steps to add number of available perl repositories
in PPM->edit->preferences->repository.

I also tried to add the same , but ended up with 401 Authorization required.

Thanks.


Test Mail

2012-08-03 Thread Anitha Sreejith Victor
I want to subscribe to this perl forum

thanks,
Anitha


Re: My confusion about if ( /grep $desc/ )

2009-03-11 Thread Victor Tsang
kevin, 

To answer your question, the 'greb' in your code is just part of a 
string, it won't produce any effect.


and if what you wish is to remove your own grep process, this command 
might do the trick.


ps -ef | grep hald-runner | grep -v grep

Tor.

kevin liu wrote:

Hello everyone:
When I am using a pattern match to find my wanted process, things like
this:

*
ps -ef | grep hald-runner
root  5006  5005  0 Mar04 ?00:00:00 hald-runner
kevin 8261  3896  0 16:53 pts/10   00:00:00 grep hald-runner

*
but I don't want the second process item, so I write this code to
filter:
@array = qx{ps -ef | grep hald-runner};
chomp @array;
foreach ( @array ) {
if (/grep hald-runner/) {
next;
}
}

Here my confusion comes: What the grep here will mean??
Here "grep" is just a plain text or a verb which can help to grep
contents??

Thank you in advance.

  


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Doubt in Spreadsheet::ParseExcel

2008-10-29 Thread anitha victor
Hi Team,

  I want a code snippet for retrieving the content in xcel sheet in a
variable.

Thanks in advance[?]

---
Anitha victor
<<328.png>>

Re: can i change file content without using a temp file

2007-07-23 Thread Victor Tsang
if you want to apply this regex to a single file, using the -i option
(in place editing) might be the quickest way for you.

ie.

perl -pe "tr/[a-e]/[1-5]/g" -i 

Tor.


cute wrote:
> Now i create a temp file to store changed content.
> is there a simple way to change file content without creating temp
> files?
>
> ie:
>
> while(<>)
> {
>   tr/[a-e]/[1-5]/g
>   print TEMP, $_
> }
>
>
>   

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




Re: about serialization

2006-11-07 Thread victor tsang

http://en.wikipedia.org/wiki/Serialization

Serialization here refer to the action of translating a complex data 
object into a simpler format.  For example, translating an array [1,2,3] 
into a text string "1,2,3". 


Tor.

Practical Perl wrote:

I saw a paper about DB_File,

  Three serialization wrappers are currently supported: Data::Dumper,
  Storable, and FreezeThaw.  Additional serializers can be 
supported by

  writing a wrapper that implements the interface required by
  MLDBM::Serializer.  See the supported wrappers and the 
MLDBM::Serial-

  izer source for details.

can you tell me what's serialization?Thanks.



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




setting a user passwd

2005-07-21 Thread Victor Pezo
Hi,  I am developing a program that sets passwd for any user but i dont want 
the operator sets the passwd. I want to give it as a result of a function

[EMAIL PROTECTED] victor]$ perl passwd.pl victor1

#!/usr/bin/perl
$usuario=$ARGV[0];
$passwd="PASSWDGENERATEBYOTHERFUNCTION"
`sudo /usr/sbin/useradd -c $usuario -s /sbin/nologin $usuario`;
`sudo /usr/bin/passwd $usuario`;

I could add the user, but in the set passwd line.
When I use this script always I have a prompt of password assigment that I dont 
want. Could you give me some light of what can I do?

Thanks in advance,

Victor



printing 2 Cache-Control header using CGI.pm

2004-11-10 Thread victor
I would like to print out these header using CGI.pm
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
doing
$cgi->header(-"Cache-Control"=>"no-store, no-cache, must-revalidate",
 -"Cache-Control"=>"post-check=0, pre-check=0");
result in lossing the first header.  I am wondering, beside printing the 
header myself without using CGI.pm, is there any way I can work  around 
this?

Many thanks.
Tor.
--

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



Re: Getting the most recent file

2003-12-15 Thread victor
That "-M" is a perl file test operator, it will take the string after it 
as name of a file automatically.

Tor.

Paul Harwood wrote:

One question I have:

With this statement: 

@files = sort { -M $a <=> -M $b } @files;

How does Perl understand that these are files and not just text entries?
Did using the readdir beforehand make this possible?
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED] 
Posted At: Saturday, December 13, 2003 6:27 AM
Posted To: Perl
Conversation: Getting the most recent file
Subject: Re: Getting the most recent file

<[EMAIL PROTECTED]> wrote:
 

I am trying to write some code to read the most recent log file in a
directory. I wrote some code below. This works but I was wondering if
there was a more efficient method to do this. Ideally I would like to
include hours, minutes and seconds but that's not necessary at this
point.
foreach $iislog (@files) {

 ($WRITETIME) = (stat("$iislogs\\$iislog"))[9];

 print scalar localtime ($WRITETIME);

 ($seconds, $minutes, $hours, $day, $month, $year, $wday, $yday,
   

$isdst) = localtime();
 

 ($seconds2, $minutes2, $hours2, $day2, $month2, $year2, $wday2,
   

$yday2, $isdst2) = localtime($WRITETIME);
 

 if ($day == $day2 && $month == $month2) {

   print "\n\n";
   print "The file was last modified on: ";
   print scalar localtime ($WRITETIME);
   print "\n\n";
 }
}
   

Hi Paul.

First of all,

 use strict;   # And declare all of your variables
 use warnings;
# And indent your code!

Then I'm not sure what you need. You say you want to read the most
recent log file,
but your code just prints out a list of modification times. Do you need
this
as well,or do you just want to find the latest file?
 (stat $file)[9]

gives you the modification date, while

 -M $file

gives you the age of the file. So you could just write

 @files = sort { -M $a <=> -M $b } @files;
 print $files[-1], "\n";
Or do you need anything more?

HTH,

Rob



 



--



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



RE: Visual Perl

2003-10-24 Thread Victor Medrano
I'm Really interesting in this software , let me know if you find
A visual perl .

Regards

-Original Message-
From: Ned Cunningham [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 24, 2003 12:00 PM
To: [EMAIL PROTECTED]
Subject: Visual Perl


Hi Gurus,

I just finished up with a Perl program using Win32::Console on a Windoze
NT system, Perl ver 5.6.1.

I was wondering why with all the power of Perl, and all the
functionality it has, why I cant make a pretty input window?

Also, Does anyone use Visual Perl?  What does it offer if any, in these
type of programs.

TIA


Ned Cunningham
POS Systems Development
Monro Muffler Brake
200 Holleder Parkway
Rochester, NY 14615
(585) 647-6400 ext. 310
[EMAIL PROTECTED]

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




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



What is faster?

2003-07-14 Thread Victor Peinado
Hi list,

I have a bilingual dictionary in a file with the following format:

word1:sense1 sense2 ... senseN
word2:sense1 sense2 ... senseN
...

I'm doing a simple script which looks for a word and returns all the
possible translations. What's the faster (or the more efficient) way to do
that when the dictionary gets bigger? A while loop reading line by line and
evaluating which is the current word, or loading the dictionary in a hash
of arrays before the search?

Thanks in advance.

--
Víctor.

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



Re: String removal

2003-03-27 Thread Victor Tsang

$TheOriginalString =~ s/$StringOrCharToRemove//g;


Tor.

Christian Calónico wrote:
> 
> Hello.
> I need to know how to remove a substring from a string and a how
> to remove a simple character occurrence from a string. Thanks in advance!
> Christian.
> 
> _
> Charla con tus amigos en línea mediante MSN Messenger:
> http://messenger.yupimsn.com/
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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



Re: arrays and subroutines

2003-03-16 Thread Victor Tsang
You need to pass the array to the function by reference, here's the fix.


&spin([EMAIL PROTECTED]);

sub spin
{
  $arr = shift;
  for (; $count > 0; $count--)
  {
 push(@$arr, $start++);
  }
}


but if all you want to do is to populate your array with value between
1025 to 1035, here's a cleaner way.

@ports = (1025 .. 1025+10);



Tor.

David Newman wrote:
> 
> Greetings. I have a newbie question about passing arrays into a subroutine
> (and getting return values as well).
> 
> My script uses arrays for various values -- one array each for TCP port
> numbers, UDP port numbers, and the different bytes of IP addresses.
> 
> Since I have to populate each of these arrays, I was hoping to be able to
> use one subroutine for all of them, just by feeding the subroutine the name
> of the array, the starting value, and the number of elements in the array.
> 
> Unfortunately, the following doesn't work. I'm not even sure whether a
> subroutine can return an array.
> 
> Thanks in advance for any pointers.
> 
> Regards,
> David Newman
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> my $count = 10;
> my @ports;
> my $start = 1025;
> &spin(@ports);
> 
> sub spin {
> for (; $count > 0; $count--) {
> push (@_, $start++);
> }
> }
> 
> foreach (@ports) {
> print "$_\n";
> }
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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



Re: Copying directory structure and its content.

2003-02-19 Thread Victor Tsang
In shell, you can use cp -r or rsync

I have never done such thing in perl, but this library might be what you
need.

http://theoryx5.uwinnipeg.ca/CPAN/data/File-DirSync/README.html


Tor.

Pankaj Kapare wrote:
> 
> Hi,
> 
> I want to copy whole directory structure and its containts(may be file and folders 
>under source directory) to destination directory .i dont know how to do this .Can 
>anybody  help me.
> Thanks in advance !
> Pankaj

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




Re: Sharing variables

2003-02-10 Thread Victor Tsang
This is what you need

http://theoryx5.uwinnipeg.ca/CPAN/data/IPC-Shareable/IPC/Shareable.html

Tor.

dan wrote:
> 
> Hi
> 
> Is it possible to share variables between 2 perl scripts running as 2
> separate processes? I've looked on CPAN but can't see any names that are
> obvious they do that kind of thing.
> 
> Thanks in advance.
> 
> Dan
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: Replacing a string in a bunch of files

2003-02-03 Thread Victor Tsang
Mu... I have a quicker way, try this.


cat FileContainFileNames | xargs -n1 perl -pe "s/oldstring/newstring/g"
-i


Tor.

Richard Fernandez wrote:
> 
> I just had a situation where I needed to replace one string with another
> string in 200 files.
> This is what I came up with, but I know there has to be a better way. Below
> is my code.
> 
> "myfiles" contains a list of the files I need to scrub, one per line.
> 
> ---8<-8<---
> #!/usr/local/bin/perl -w
> use strict;
> $|++;
> 
> my @files = `cat myfiles` or die;
> for (@files) {
> 
> chomp;
> push @ARGV, $_;
> }
> 
> $^I = ".bak";   # Got this from a previous message; thanks Peter!
> while (<>) {
> 
> s#/u01/app/webMethodsFCS#/u02/app/webMethodsFCSclone#g;
> print;
> 
> }
> -8<--8<---
> 
> Seems to me there should be a way to provide the filenames on the command
> line
> w/o having to read the list into an array first, but I tried using xargs
> (this is unix) and a couple
> of other things but couldn't figure it out.
> 
> Thanks for the help!
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




trapping errors in "use"

2003-01-20 Thread Victor Tsang
I have a piece of code which will be used in two different environment,
One of the difference of the 2 system is a special library that is
avaiable to only one of them.  Going into the cookbook I found example
12.2 very suitable for my need.  So I created the following code to test
the idea

#!/usr/bin/perl
BEGIN
  {
$mod = "CGI";
unless (eval "use $mod")
  {
warn "unable to install $mod $@\n";
  }
  }


I expected this to work ok, but to my surprise, when I execute it, I get
this :

[htsang@victor htsang]$ ./test.perl
unable to install CGI 


To verify CGI.pm is there, I did the following in the same machine.

[htsang@victor htsang]$ perl -MCGI -e "print \$CGI::VERSION"
2.56[htsang@victor htsang]$ 



Anyone has any idea what I did wrong?

Many thanks.


Tor.

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




Re: Finding IP address connected to your http server.

2003-01-17 Thread Victor Tsang
Maybe we should bring this discussion out to a more appropiate list, but
anyways,  have a look into this doc.

http://dev.zope.org/Wikis/DevSite/Proposals/RemoteAddrAndAccelerators

This is not perfertly reliable, but you might want to consider it.

Tor.


> 
> Please bear in mind that this IP address is in all probability NOT the IP
> adress of the browser, but that of some cache in between.  If you want this -
> as I did, to enable reverse connections to be made, then this will be no good
> (one of my machines on a dial-up with dynamic IP contacting my web server
> with a 'here-I-am' message, and then the web server making an outbount ssh
> connection).
> 
> There is no direct method of doing this other than getting the browser to pass
> it's IP address, probably as someone said, by using a javascript.
> 
> Although this is probably completely useless to you, I got round the problem
> by having my dial-up box use wget to call a CGI and from the ip-up script,
> passing the local IP as an argument.
> 
> --
> Gary Stainburn
> 
> This email does not contain private or confidential material as it
> may be snooped on by interested government parties for unknown
> and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: Finding IP address connected to your http server.

2003-01-16 Thread Victor Tsang
how about using mod_status? it shows all the IP connected to the server.

Tor.

simran wrote:
> 
> if (you are looking for connections that have come in over time) then
> look in the log file
> else if i you are looking for the ip that is current connecting to the cgi script
> you can usually find that info in the environment variable REMOTE_ADDR - 
>$ENV{'REMOTE_ADDR'}
> else
> there is probably a way to get the remote ip in javascript as well, if that 
>is what you want
> endif
> 
> On Fri, 2003-01-17 at 17:50, [EMAIL PROTECTED] wrote:
> > Hey,
> >
> > My friend is doing some web programming with perl, and wanted me to help
> > him do something. He wants to create a script that will show all the IPs
> > that are connected to the http server. I have looked on through several
> > sites, and even a couple fo books I own. Yet I have failed to find a
> > solution for this. If you can come up with some tips or help, please send
> > them to [EMAIL PROTECTED]
> >
> > Thank you for your time,
> >
> > Tyler Mace
> > Application Programmer
> > Sunergize, Inc.
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: The number of elements in an array

2003-01-16 Thread Victor Tsang
for ($x=0; $x < scalar(@amen); $x++)


Tor.

Robert Monical wrote:
> 
> Hello,
> 
> I'm away from my Perl book and hope one of you will help me.
> 
> Would somebody please remind me how to make this line work
> 
>  for ($x=0;$x<$#{@amen};$x++){
> 
> right now, the loop only executes once.
> 
> TIA
> 
> Robert Monical
> [EMAIL PROTECTED] (mailing list stuff)
> [EMAIL PROTECTED] (everything else)
> www.restek.com
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: Check if a hash is empty

2003-01-10 Thread Victor Tsang
if (%hash){
  $ do
}


Tor.

"NYIMI Jose (BMB)" wrote:
> 
> Hello,
> 
> If(keys %hash){
> #do ...
> }
> 
> Could you suggest an other way, please ?
> 
> Thanks in advance.
> 
> José.
> 
>  DISCLAIMER 
> 
> "This e-mail and any attachment thereto may contain information which is 
>confidential and/or protected by intellectual property rights and are intended for 
>the sole use of the recipient(s) named above.
> Any use of the information contained herein (including, but not limited to, total or 
>partial reproduction, communication or distribution in any form) by other persons 
>than the designated recipient(s) is prohibited.
> If you have received this e-mail in error, please notify the sender either by 
>telephone or by e-mail and delete the material from any computer".
> 
> Thank you for your cooperation.
> 
> For further information about Proximus mobile phone services please see our website 
>at http://www.proximus.be or refer to any Proximus agent.

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




Re: hash & arrays

2003-01-09 Thread Victor Tsang
you second @EXPORT_OK= statement reset the EXPORT_OK array, I believe
the correct syntex should be.

our @EXPORT_OK = qw(@T_AREA %T_IDS);

Tor.

Jerry Preston wrote:
> 
> Hi!,
> 
> I do not understand what I am doing wrong.  I can pass an hash this way and
> not an array using the following:
> 
>require Exporter;
> 
>our @ISA = qw(Exporter);
>our @EXPORT = qw();
>our @EXPORT_OK = qw( @T_AREA );
>our @EXPORT_OK = qw( %T_IDS );
> 
> where
> 
>   @T_AREA = ( "", "NORTH", "SOUTH" );
> 
>   %T_IDS = (
>  NORTH=> [ qw/KT201 KT202 KT203 KT210 KT211 KT212 KT215
> KT216 KT217 KT218 KT219 KT220 KT221/ ],
> 
>  SOUTH=> [ qw/PT211 PT212 PT213 PT214 PT215 PT216 PT217
> PT218/ ],
> 
>   );
> 
> Why can I not export the array T_AREA ?
> 
> Thanks,
> 
> Jerry

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




Re: bandwidth restricting

2003-01-09 Thread Victor Tsang
If you have a linux box, It might be a better idea to employ the traffic
shapper that comes with the linux kernel instead.

Tor.

mod_perl wrote:
> 
> hi all,
>In my Lan I have a linux proxy .How  can i restrict the bandwidth
> cosumed by each user using perl .Which module i can use .
>thanks in advance
> 
> shine
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: Reading config files

2002-11-01 Thread Victor Tsang
build a pm to store them.

Tor.



Brian Ling wrote:
> 
> Hi All
> 
> I have a main Perl program that needs to read in a config file that just
> sets some variable values, what is the best way to do this. The config
> file can be in any format I want such as:
> 
> #!/usr/bin/perl
> my $var = 3;
> my $var1 = 4 ;
> my $var2 = 234; etc
> 
> So how could I run this from within my main program so that the var can
> be used afterwards, or is there a better way of achieving the same
> result.
> 
> On a side topic, how do multiple source code files work in Perl. How can
> you do things such as include another file so that I can use it's
> subroutines.
> 
> Any pointer would be welcome.
> 
> Thanks
> 
> Brian
> 
> BBCi at http://www.bbc.co.uk/
> 
> This e-mail (and any attachments) is confidential and may contain
> personal views which are not the views of the BBC unless specifically
> stated.
> If you have received it in error, please delete it from your system, do
> not use, copy or disclose the information in any way nor act in
> reliance on it and notify the sender immediately. Please note that the
> BBC monitors e-mails sent or received. Further communication will
> signify your consent to this.

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




comment on CGI-SpeedyCGI

2002-10-01 Thread Victor Tsang

Just saw this package on the Oct-2 UsePerl newsletter, would anyone who
tried this share some comment on it?  how is the performance compare to
a mod_perl setup? 


Thanks.

Tor.

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




Re: hiding a URL

2002-09-09 Thread victor

use mod_rewrite.

Tor.

Jose Malacara wrote:
> 
> Is there an easy way to hide ,or spoof, a URL when outputting to html with
> perl? For example if I was running a script in my cgi-bin directory, but
> wanted the URL to appear differently so as to hide location of my
> cgi-directory.
> 
> For example, if a visitor is looking at a page located at:
> www.mywebsite.com/cgi-bin/forms/hello.cgi, but the URL would appear as
> www.mywebsite.com/hello.cgi  or just www.mywebsite.com. Can this be done
> perhaps by passing the browser a fake http location header or something?
> 
> Hope that's not too confusing. Thanks in advance.
> 
> Jose
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: sorting hash entries

2002-07-22 Thread victor


the command 'sort' allow you to put in your own routine to do sorting.


%usernum = ("server.one.com" => "15",
"server.two.com" => "5",
"server.three.com" => "14",
"server.four.com" => "9");

@arr = sort {$usernum{$a} <=> $usernum{$b}} (keys %usernum);

print join(" ", @arr);


Tor.

dan wrote:
> 
> (sorry if this message comes twice.. didn't appear to have sent the first
> time)
> 
> I have a small query regarding how to sort hash entries in numerical order.
> 
> %usernum { "server.one.com" "15",
> "server.two.com" "5",
> "server.three.com" "14",
> "server.four.com" "9" }
> 
> How can i get perl to return these 4 server names in the correct order,
> server.two.com
> server.four.com
> server.three.com
> server.one.com
> 
> Help much appreciated
> 
> Dan
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




libwww-perl and URI modules for 5.005_02

2002-07-10 Thread H. Victor Lim

Hello,

I am working on a Solaris platform using version 5.005_02.  Could
someone point me to libwww-perl and URI modules that would work with
5.005_02?  I searched through www.cpan.org and the earliest versions
that I found are:

   libwww-perl-5.10.tar.gz
   URI-1.18.tar.gz

After installing these modules, I tried to run my program and got the
error:

   Missing base argument at .../lib/site_perl/5.005/HTTP/Request.pm
line 102

I also searched the following sites which were listed under CPAN's FAQ
for "Where can I find older/obsolete versions of Perl or Perl
Modules?":
(http://www.cpan.org/misc/cpan-faq.html#Where_older_Perl)

http://www.etla.org/retroperl/
 - only has perl1 to perl4

http://mirrors.valueclick.com/perl/really-ancient-perls/
 - only has perl1 to perl5.003_08

http://history.perl.org/src/
 - only has perl1 to perl4

http://mirrors.valueclick.com/perl/backup.pause/ - for old versions of
modules
 - contains the following links:
   GAAS   -  
   libwww-perl-5.00.readme-  
   libwww-perl-5.00.tar.gz-  
   libwww-perl-5.01.readme-  
   libwww-perl-5.01.tar.gz-  
   libwww-perl-5.02.readme-  
   libwww-perl-5.02.tar.gz-  
   libwww-perl-5.03.readme-  
   libwww-perl-5.03.tar.gz-  
   libwww-perl-5b6.tar.gz -  

   but following these links all resulted in "HTTP 404 - File not
found"


It seems that upgrading from 5.005_02 to 5.6.1 is inevitable, but this
process would require additional time and resources to recertify all
of our existing programs on 5.6.1.

Thanks,
-Victor

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




Re: Date and Time

2002-07-09 Thread victor


are you trying to get the localtime in readable format?  if so try this 

print scalar(localtime);

Tor.

[EMAIL PROTECTED] wrote:
> 
> Hi
> 
> I'm trying to get my script to recognize the date and time.
> I thought I had it but I keep getting errors all over.
> 
> Please take a look and tell me whats wrong
> 
> Thanks
> 
> # Here we define the variables
> 
> use strict;
> 
> my $htpasswd = 'c:\apache\htdocs\members\.htpasswd';
> my $database = 'c:\apache\members.db';
> 
> print "Content-type: text/html\n\n";
> 
> print 'Please write this down as it will not be emaild ', "\n";
> print 'for your own security ', "\n";
> 
> # Here is the random gereration string.
> 
> my ($username, $password) = (random_string(), random_string());
> print "Username: $username\n";
> print "Password: $password\n";
> 
> sub random_string {
> 
>   my($string) = '';
>   my($length) = 8;
>   my(@chars) = ('A' .. 'Z', 'a' .. 'z', 0 .. 9);
>   while (length($string) != $length) {
> $string .= $chars[ rand @chars ];
>   }
>   return($string);
> }
> 
> # everything ok, let's write to database.
> 
> open (DATABASE, ">>$database");
> flock (DATABASE, 2);
> print DATABASE "$username|$password|$date\n";
> flock (DATABASE, 8);
> close (DATABASE);
> 
> # everything ok, now we write to the password file.
> 
> my $uselog = 1;
> 
> if ($uselog eq '1') {
>open (LOG, ">>$htpasswd");
>print LOG "$username:$password:$date\n";
>close (LOG);
> }
> 
> sub get_date {
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(time);
> @months =
> ("01","02","03","04","05","06","07","08","09","10","11","12");
> @digits = split(//,$sec);
> $size = @digits;
> if ($size == 1) {
> $sec = "0$sec";
> }
> @digits = split(//,$min);
> $size = @digits;
> if ($size == 1) {
> $min = "0$min";
> }
> $year=$year+1900;
> $date = "@months[$mon]/$mday/$year";
> }
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: How to make the PC Speaker ring a beep sound?

2002-07-09 Thread victor

print chr(7);


Tor.

Connie Chan wrote:
> 
> Hi all,
> 
> I am trying to write a script for sound alarm function.
> 
> I've tried use print "\a", but that goes too strange...
> the sound output goes out by my sound card. So
> would you tell if that's the normal result of print "\a" ?
> 
> Actually, I hope the sound output is by my PC speaker.
> and I would like to use the BEEP sound instead. Is that
> possible ? Besides, can I control the alarm length and
> the alarm tone ?
> 
> Thanks for any comment,
> Connie

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




Re: Script execution via email

2002-05-16 Thread victor

Depending on which mail system you use, I know for qmail, you can setup
a .qmail file to instruct qmail to trigger a script when there's any
incomming email.


Tor.

Dan Fish wrote:
> 
> I've got a perl script that reads a dozen or so various documents and data
> files and generates a custom report for me (Don't we all have a couple dozen
> of these? :-)
> 
> All of that is working fine...
> 
> What I'd *like* to do is be able to generate these reports "on-demand" from
> remote locations by setting up some sort of email trigger that will run the
> script when an email is sent to specially designated address and then return
> the results via email
> 
> Has anybody attempted doing something like this??  I would guess I'd need to
> use Mail::POP3Client, and a cron script that runs periodically.  Other
> ideas?
> 
> Thought I'd just ask around, get some ideas, and see if maybe somebody knows
> of an existing script to start from before I set off to re-invent the
> proverbial wheel.
> 
> Thanks,
> -Dan
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: Passing Arguments into a Program

2002-04-12 Thread victor

@ARGV

in your example

$ARGV[0] will be abc
$ARGV[1] will be def 
...etc

Tor.

Mike wrote:
> 
> If a program calls a perl script as follows:  /tmp/perltest.pl abc def ghi
> jkl mno
> 
> Is there a variable which would contain the arguments?
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: Splitting number into an array

2002-04-09 Thread victor


@array = split("", $card_no);

Tor.

Daniel Falkenberg wrote:
> 
> Hey all,
> 
> $card_no = "1234567901234567" # 16 digit number
> 
> How would I go about splitting that number into an array?
> 
> Regards,
> 
> Dan
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: Timeout a system command

2002-04-07 Thread victor


Try the alarm function.

Tor.

Darren Edgerton wrote:
> 
> Hi,
> 
> i want to set a timer around a system command, so that IF the command runs
> longer than x seconds
> send email to the sysadmin
> Note: i *DO NOT* want to kill the process - simply want to send a warning
> that it is taking longer
> than expected
> ie
> 
> $maxtime=60;# 60 seconds
> system("some_command_that_takes_longer_than_60secs");
> 
> # if running longer than $maxtime
> &call_sub_to_send_email;
> 
> i have had a look at 'perldoc -f alarm' but cant see how to adapt this to my
> requirement
> 
> all help appreciated
> 
> regards
>  Darren Edgerton
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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




Re: looking for book on object oriented perl

2002-03-18 Thread victor

In my opinion, the balanace between theory and technique in the book is good, you 
really can't expect a book about object oriented to be without any theory at all right?

I was very fresh on OO perl when I first read the book and I did found a lot of good 
tips and advice from it.  If you are too fresh to OO perl, I would say this is a good 
place to start.

Tor.


Paul Tremblay wrote:

> I finished *Learning Perl*(The O'Reilly book), and thought it one of the best books 
>relating to a linux subject I have yet read.
>
> (I know that many people on this mailing list probably use Windows. If you are a 
>linux user and have had to suffer through some of the awful documentation on various 
>aspects of linux, then you will think books like *Learning Perl* a masterpiece!)
>
> However, I now believe I should learn at least some of the concepts of object 
>oriented perl, especially since I want to use modules like XML::Parser.
>
> My search on amazon.com came up with a book called *Object Oriented Perl,* written 
>by Damian Conway and others. Amazon.com lets regular people review the book, and 
>almost every one of these reviewers raved about the book. It was the "best book" the 
>ever read, they "wished they had read it a long time ago."
>
> However, I believe I came upon a portion of this book on line. This is the url:
>
> 
>http://www.google.com/search?q=cache:NiHGVcWGmw8C:www.csse.monash.edu.au/~damian/papers/PDF/cyberdigest.pdf+object+oriented+perl&hl=en
>
> (1) Could someone tell me if this in fact is from the same book?
>
> >From what I read on this site, I was not too impressed with the book at all. It 
>seemed to go on forever explaining theory without giving any concrete examples with 
>perl code. My second question is:
>
> (2) Does this book get better in chapters 2 and 3? Do people on this mailing list 
>recomend it?
>
> Keep in mind that I am a beginner with no previous experience in any object oriented 
>langauge.
>
> Thanks!
>
> Paul
>
> --
>
> 
> *Paul Tremblay *
> *[EMAIL PROTECTED]*
> 
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



Re: Save image to disk

2002-03-13 Thread victor

You probably don't need a perl script for this, there's this command call wget
in linux which you can use to mirror a site, and using the -A option you can
make it download file with specified extention (gif, jpg..etc).

Tor.

Gary Hawkins wrote:

> Would like to save images to disk using their URL's.  Hoping someone can give
> me a jump start on it.
>
> Gary
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]




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




Re: regex question

2002-03-13 Thread victor

Try this regexp.

s/###.*?###//g;



[EMAIL PROTECTED] wrote:

> hi
>
> i have a long text file. in this text file several strings of the form:  ### 
>filename.jpg ### are embedded.
>
> how should a regex look that takes following:
>
>  ### filename.jpg ### 
>
> and returns
>
>  
>
> and the filename.jpg saved in a $
>
> :o)
>
> martin
> --
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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




Re: text editors

2002-03-07 Thread victor

emacs

michael wrote:

> Speaking of text editors, anyone know of a good one that has
> line #ing
> for W2K? Free, of course (I am a student).
>
> BTW - this is a list that is really worth reading. You guys
> (and you know who you are) are fantastic. Some of the
> explanations offered here are so clear that even I can
> understand them!
>
> Respectfully,
> -michael-
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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




Re: text file database question

2002-02-17 Thread victor

How about Berkely DB?

"Hughes, Andrew" wrote:

> I have been given the task to create a contest for which appox. 90,000
> people might be signing up(collected info: name, company, email, phone,
> address1, address2).  Due to various reasons, I am not able to use a true
> database like mySQL to store the information.  At this point I am going to
> have to use a text file, which I have used in the past, but not at this
> level of possible entries (we are really going to be promoting this heavily
> on and offline).  Please let me know if you think this is a possible
> dangerous level of entries for a text file.
>
> Also, in my experience with text files, I have not been able to stop people
> from hitting submit a few times before the form submits (i.e. I have
> multiple lines of the same entry).  How would I stop this -- still talking
> about text files?
>
> Thanks,
> Andrew
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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




Re: read source file of .html

2002-01-14 Thread victor

use LWP. it can be as simple as this :


use LWP::Simple;
print get("http://www.mit.edu";);

Tor.

yun yun wrote:

> if I want to read the real html file from web, such as
> http://www.mit.edu, should I use sock programming? and
> if then, how could I use,and where can I study this
> aspect? Thanks!
>
> _
> Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn
>
> ÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡¡ª¡ª
> ÑÅ»¢??ÐÂÁÄÌìÊÒ! http://cn.chat.yahoo.com/c/roomlist.html
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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




Re: Compile .cgi programs

2002-01-10 Thread victor

..  this might be what you are looking for.

http://www.indigostar.com/perl2exe.htm#download



kondreddy Rama koti Reddy wrote:

> Dear Friends,
> can u tell me, how can i create an executable
> file for the .cgi program on linux whihc
> is having perl and javascript statements.
>
> Thanking you
>
> K. Rama koti Reddy.
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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




Re: Password ---- cgi-perl-html

2002-01-07 Thread victor

actually, most likely you are looking not just password checking but also session
management.

The easiest way is to take advantage of mod_auth which come with apache by default 
(consult
this part of the apache faq for more detail
http://httpd.apache.org/docs/misc/FAQ.html#user-authentication)

or if you plan to build something of your own... try mod_perl and make use of handler,
consult "the Eagle book" (writing apache modules with perl and c from o'reilly) for 
more
detail and example.

Tor.

Luinrandir Hernson wrote:

> I am trying to password protect part of my website.
> I have the password  page done.
> But how to I make the pages protected so you have to go through the password page?
> Do i do it by passing hidden inputs from page to page?
> How do I force people coming in around the password page to go through the password 
>page?
>
> Any hints? Oh and I know nothing about perl moduals...
>
> cheers - thanks!
>
> Lou H.


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




help with program

2001-11-21 Thread Victor

I want to develop a script that refused the messages that comes to one account when 
the users quota is full. it will be very helpful to me the comment
if ( -e $dirpath && -d $dirpath ) { ...stuff...}
if ( -e $dirpath && -d _ ) { ...stuff...}
if ( -d $dirpath ) { ...stuff...}
if ( -s $dirpath ) { ...stuff...}

but i will like to know more information on the reception of the e-mail, or 
information of the function that process this process

Any assistance would be greatly appreciated.  Thanks

Victor Pezo



Re: greetings and salutations all

2001-11-13 Thread victor

Check out CGI.pm, and one more thing, make sure your html form has the ENCTYPE
set to multipart/form-data.

Tor.

patrick wrote:

> hello.
> i'm a perl beginner.
>
> you know that  bit in html ?
> well i need to make my website upload files
> and i only have cgi functionallity
>
> so i'll be doing it with perl.
> help.
>
> i suspect it's a module i'm looking for.
> but there are so many to choose from
>
> --
>
> p a t r i c k  d u n i g a ng r a p h i c  a r t i s tw e b  d e v e
> l o p e r
> email : [EMAIL PROTECTED]
> aol IM : theclutchbuster
> landline : 770.938.9653
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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




Re: how to use $1

2001-09-11 Thread victor

They are call backreferences, used in regular expression as buffer where
you can store pieces of the result collected in the regular expression.

eg. if you have this

"123 456" =~ /(\d*) (\d*)/;

$1 will equal to 123 while $2 will equal to 456

If you have the 'proramming perl' book from oreilly, refer to page 31,
it has a very detail description of what backreferences is.

Tor.

lyf wrote:

> hi, I am a perl beginner, and I am confused by $1.
> what does $1 ($2,and so on) mean?
> and how to use them?
>
> thanks
>
> yuefu li


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




Re: Command line vs. Application

2001-09-04 Thread victor

Have you checked the permission, could it be your Application being run as
somebody having no permission to write to the files you are trying to write to.

or if you happens to make use of shell command within your script, the PATH
variable could be missing from your application.

Hope this help
Tor.

Kim Green wrote:

> I have a script that creates outputfile based on the rows returned from a
> select statement. I run the script from the command line, and the outputfile
> gets created. But, no file is created when I run the script from an
> application.   Generally speaking, what kinds of things would cause this?
>
> Kim
>
> Kim Green
> Billing Systems Developer
> Madison River Communications
> 919.563.8385
> [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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




Re: creating a daemon

2001-09-03 Thread victor

There is a big section in the Perl Cookbook( O'Reilly) that show you step
by step detail of how to create a daemon.



peter grotz wrote:

> hi all,
> I need a program to run like a daemon. it should do:
> look in a directory for some flag-files, if  some exist the daemon
> should start other programs, then the daemon should sleep for let´s say
> 5 seconds and begin again...
> how must I create such a daemon and how can I stop him working with a
> small script.
> excuse me for this newbie-questions
> thanks
>
> --
> peter grotz
>
> rehberger architekten
> schertlinstr 23
> 86 159 augsburg
>
> tel 0821 25980-29
> fax 0821 25980-20
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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




Re: to delete a file

2001-06-21 Thread victor

try the unlink command.

Stéphane JEAN BAPTISTE wrote:

> How can I delete a file ?
>
> thanks




Re: file size

2001-06-21 Thread victor

use the stat command.

[EMAIL PROTECTED] wrote:

> Hi,
>
> I would like to know if with a perl script you can get the size of a file ?
> I need to get all the size of 250 files on 250 computers ...
>
> thanx




Re: Perl/Linnux/unix question

2001-06-19 Thread victor

put a nohup in front and a & at the end.

This will make your script immune to handup and run in background.

Tor.

[EMAIL PROTECTED] wrote:

> Which linux command i use to run a perl script that will stay running in my server 
>even when i logout via telnet?
> Thanks




Re: PERL DB Question

2001-06-19 Thread victor

> > > 1) unless you have previously populated the db file, it will start off
> > > as
> > > empty.
> > >
> > > I guess, this is my most basic and pressing question.  A file by the name
> > > mockalias exists which already has the usernames and e-mail addresses
> > > separated by :
> > > When I use the tie command, am I not pulling up all the existing information
> > > in that file, into a hash?
> > >
> >
> >   ... so you mean this mockalias is actually a text file contain records one
> > entry per line with the symbol ":" as the delimitor?
>
> Yes, it is. DB_file is not the best option, is it, in such a case?
>

  I'm sorry I've over looked your question, my apology.

  no, actually Berkely DB is an excellent choice, it gives you all the features
(delete, search, add, update) you wanted while consuming very little resources.

  But since your data is in a text file, you will have to first convert them into a
Berkely DB first before you can use it.  The following code should the job.

my ($key, $values);
open Fin, "mockalias";
while ()
{
  ($key, $value) = split(/:/, $_)
  $ALIAS{$key} = $value;
}
close Fin;


put this loop between the tie and untie statement and it will load the vlaues from
the mockalias file and convert it into a hash and at the same time storing the
change into the BerkelyDB file.

Remember to pick a different name for your berkely db file, .. mockalias.db should
be a good choice. (^_^)

Tor.




Re: PERL DB Question

2001-06-18 Thread victor

> 1) unless you have previously populated the db file, it will start off
> as
> empty.
>
> I guess, this is my most basic and pressing question.  A file by the name
> mockalias exists which already has the usernames and e-mail addresses
> separated by :
> When I use the tie command, am I not pulling up all the existing information
> in that file, into a hash?
>

  ... so you mean this mockalias is actually a text file contain records one
entry per line with the symbol ":" as the delimitor?

Tor.





Re: PERL DB Question

2001-06-18 Thread victor

1) unless you have previously populated the db file, it will start off as
empty.

2) $ALIAS is the reference to the hash, maybe you were trying to say print
%ALIAS?
  and may I suggest a little loop like this :

foreach (keys %hash)
{
  print "$_ :: $hash{$_}\n";
}

  which will print the content of the hash in a nice looking fashion.

Tor.

"Prabhu, Vrunda P (UMC-Student)" wrote:

>  Thanks for your help.  I did try the modification you suggested. Now the
> program does not die (it does not have that option), however when I ask it
> to list the contents of the file, it does not do anything either.  Here is
> my code again:
>
> #!/usr/bin/perl
>
> use CGI ':standard';
> use DB_File;
>
> $filename = "./mockalias";
>
> tie %ALIAS, "DB_File", "$filename", O_RDWR|O_CREAT, 0644, $DB_HASH;
> $key = "vrunda";
> if (exists $ALIAS{$key})
> {
> print "$key has value $ALIAS{$key}\n";
> }
> print "$ALIAS";
> untie %ALIAS;
>
> -Original Message-
> From: [EMAIL PROTECTED]
> To: Prabhu, Vrunda P (UMC-Student)
> Cc: '[EMAIL PROTECTED]'
> Sent: 6/18/01 1:29 PM
> Subject: Re: PERL DB Question
>
> Try this instead
>
> tie %ALIAS, "DB_File", "$filename", O_RDWR|O_CREAT, 0644, $DB_HASH;
>
> "Prabhu, Vrunda P (UMC-Student)" wrote:
>
> > I have an existing file, called mockalias that contains entries in the
> > following format:
> >
> > username : e-mail address
> > I want to use a hash %ALIAS to read the mockalias file into the hash,
> and
> > then be able to delete,
> > update, add entries to this hash.  When I run the following code, it
> tells
> > me that the file
> > mockalias exists, and dies.  How can I read the file into a hash and
> > manipulate the entries
> > of the hash?
> >
> >
> > #!/usr/bin/perl
> > use CGI ':standard';
> > use DB_File;
> > $filename = "mockalias";
> > tie (%ALIAS, "DB_File", $filename) or
> > die "cannot open file $filename:$!\n";
> > untie %ALIAS;
> >
> > Thanks in advance for your time.
> > Vrunda




Re: PERL DB Question

2001-06-18 Thread victor


Try this instead

tie %ALIAS, "DB_File", "$filename", O_RDWR|O_CREAT, 0644, $DB_HASH;

"Prabhu, Vrunda P (UMC-Student)" wrote:

> I have an existing file, called mockalias that contains entries in the
> following format:
>
> username : e-mail address
> I want to use a hash %ALIAS to read the mockalias file into the hash, and
> then be able to delete,
> update, add entries to this hash.  When I run the following code, it tells
> me that the file
> mockalias exists, and dies.  How can I read the file into a hash and
> manipulate the entries
> of the hash?
>
>
> #!/usr/bin/perl
> use CGI ':standard';
> use DB_File;
> $filename = "mockalias";
> tie (%ALIAS, "DB_File", $filename) or
> die "cannot open file $filename:$!\n";
> untie %ALIAS;
>
> Thanks in advance for your time.
> Vrunda




Re: Calling a Perl script with parameters

2001-06-13 Thread victor

The command line parameters are stored in the @ARGV array.

Tor.


Edd Dawson wrote:

> Hi,
>
> I wish to write a perl script that i can call from the command line
> and pass parameters to it in the call when running under unix, i.e
>
> perl perlscript parameter1 parameter2
>
> I don't seem to be able to find any info anywhere on how to do this
> so if anyone could point me in the right direction i would be most
> grateful.
>
> Thanks very much for your time
> Edd Dawson




Method interface vs Function Interface

2001-06-09 Thread victor

I have recently came across a mod_perl document that suggested Perl's
Method Interface is more 'memory friendly' compare to Perl's Function
Interface.

I'm not too sure I've got the meaning of this 'Method Interface' and
'Function Interface' correctly, is it referring to the procedural
function call and the Object Oriented Method invoking?  or is it trying
to suggest to use 'use' instead of 'require'?


Quote From : http://perl.apache.org/dist/mod_perl.html

Importing Functions
   When possible, avoid importing of a module functions into your
namespace. The aliases which are created can take up quite a
   bit of space. Try to use method interfaces and fully qualified
Package::function names instead. Here's a freshly started httpd
   who's served one request for a script using the CGI.pm method
interface:

TTY   PID USERNAME  PRI NI   SIZE   RES  STATE   TIME %WCPU
%CPU COMMAND
  p4  5016 dougm 154 20  3808K  2636K sleep   0:01  9.62
4.07 httpd

   Here's a freshly started httpd who's served one request for the
same script using the CGI.pm function interface:

TTY   PID USERNAME  PRI NI   SIZE   RES  STATE   TIME %WCPU
%CPU COMMAND
  p4  5036 dougm 154 20  3900K  2708K sleep   0:01  3.19
2.18 httpd

   Now do the math: take that difference, figure in how many other
scripts import the same functions and how many children you
   have running. It adds up!




Re: if then else

2001-06-09 Thread victor

shouldn't it be

if ($ENV{'HTTP_REFERER'} eq "")

?

Luinrandir Hernson wrote:

> ok, where did i go wrong now???
>
> ##
> ##set $previous site var.
> ##
> if ($ENV{'HTTP_REFERER'} = "")
>{$previous = "an unknown site"}
>else
>{$previous = "$ENV{'HTTP_REFERER'}};




Re: IS there a module / method for ?

2001-06-07 Thread victor

you can try rsync

"Vinay T.S." wrote:

> I wanted to know if there is any module or method in an existing module
> for
>
> a) transfer a directory tree from one machine to another
>
> I could use
>
> tar xvf -  | rsh target_machine " cd  ; tar
> cvf - )
>
> wanted to do this , using an existing method instead .
>
> Thanks
> Vinay