RE: multiples http wget in parrallel
LWP::Parallel is a good starting place. ok I will have a look at that that module thank you mr Schwartz ! yannick serra SchlumbergerSema -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Installing my own modules
I want to use Image::Size on my site but my Server doesn't have it installed. I've been waiting for them to install it. ## But the reply I recieved from them was : Could you please explain in detail regarding the module Image::Size, I am little bit confused about the problem. oneononeinternet.com ### I only asked them to install it. It would be nicer if I knew how to put Image::Size or any other module I want in my own cgi-bin. How do I make perl find the modules I upload? Thanks Tricia
Send attachment (but no MIME)?is it possible
Hi, is it possible to have a perl script sending e-mail with attachment without using MIME::Lite since most host don't have MIME::Lite.? Regards Anthony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Installing modules on website
I was reading and came across this code: I put the contents of Image-Size-2.98 under the Image directory. use lib qw(/home/yrkylady/www/cgi-bin/perl/Image); eval("use Image::Size 2.98;"); (print("Error: $@"), exit(-1)) if $@; And when I try to open my file I get this error: Error: Can't locate Image/Size.pm in @INC (@INC contains: /home/yrkylady/www/cgi-bin/perl/Image /usr/lib/perl5/5.6.0/i686-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i686-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at (eval 5) line 1. BEGIN failed--compilation aborted at (eval 5) line 1. Did I use the right syntax? Any suggestions? Thanks Tricia
RE:Installing my own modules
Hi >>I want to use Image::Size on my site but my Server doesn't have it installed. Place the module wherever you like (and have permission) eg, /home/your/cgi-bin/modules You can then tell perl to look for modules in that localtion with the following: #!/usr/bin/perl use lib "/home/your/cgi-bin/modules"; use Image::Size; .. . . page 120 of 'CGI Programming with perl' 2nd Edition explains this much better than I can (being a relative newbie an all!) I don't know what sort of Installation Image:Size requires. I don't have a lot of experience with that but it may be as simple as unpacking the files to that directory or you may need to use a Makefile and the make program... or worse... I think if it's that much of a hassle, the admin people will have to do it anyway. Good luck James =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= James Campbell Research Bioinformatician Proteome Sciences Institute of Psychiatry South Wing Lab PO BOX PO45 16 De Crespigny Park London SE5 8AF Tel:+44-(0)207-848-5111 Fax:+44-(0)207-848-5114 Email: [EMAIL PROTECTED] Web 1: www.proteome.co.uk (Corporate site) Web 2: www.proteinworks.com (Satellite site - Proteomics facility) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Installing my own modules
From: [EMAIL PROTECTED] > I want to use Image::Size on my site but my Server doesn't have it > installed. > I've been waiting for them to install it. > ## > But the reply I recieved from them was : > Could you please explain in detail regarding the module Image::Size, I > am little bit confused about the problem. oneononeinternet.com > ### > > I only asked them to install it. > > It would be nicer if I knew how to put Image::Size or any other module > I want in my own cgi-bin. How do I make perl find the modules I > upload? Do not put it in cgi-bin, put it in a directory that is not accessible via web. And add use lib '/home/Motherofperls/perl-lib'; on top of your scripts. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IMAP
> Hi, > > Does anyone know any what to connect to an Microsoft Exchange server via > perl ? > I have tried some modules "Net::IMAP::Simple" and "Mail::IMAPClient" > but they doesn´t work for me. > > Regards > Mikael Larsson >
Re: Installing modules on website
From: [EMAIL PROTECTED] > I was reading and came across this code: > I put the contents of Image-Size-2.98 under the Image directory. > > use lib qw(/home/yrkylady/www/cgi-bin/perl/Image); > eval("use Image::Size 2.98;"); > (print("Error: $@"), exit(-1)) if $@; > > And when I try to open my file I get this error: > > Error: Can't locate Image/Size.pm in @INC (@INC contains: If the Size.pm is in /home/yrkylady/www/cgi-bin/perl/Image/ directory then the use lib statement should look like this: use lib qw(/home/yrkylady/www/cgi-bin/perl); Notice that the "Image" is NOT included in the path. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Send attachment (but no MIME)?is it possible
On Wed, 20 Mar 2002 13:07:56 +0100, [EMAIL PROTECTED] (Anthony) wrote: >is it possible to have a perl script sending e-mail with attachment without >using MIME::Lite since most host don't have MIME::Lite.? > You could try this script # #!/usr/bin/perl use warnings; use strict; use MIME::Base64; my $SENDFILE = 'myfile'; my $FROMUSER = 'username'; my $FROMEMAIL = '[EMAIL PROTECTED]'; my $TOUSER = 'myrecipient'; my $TOEMAIL = '[EMAIL PROTECTED]'; open(F_MAIL,"|/usr/sbin/sendmail -t"); my $boundary = "--90125"; print F_MAIL < To: $TOUSER <$TOEMAIL> MIME-Version: 1.0 Subject: File attachment test Content-Type: multipart/mixed; boundary=\"$boundary\" This is a multi-part message in MIME format. --$boundary Content-Type: text/plain; charset=\"iso-8859-1\" Here is the body of the message. A file attachment is also provided below. --$boundary Content-Type: application/octet-stream; name=\"z\" Content-Transfer-Encoding: Base64 Content-Disposition: attachment; filename=\"z\" END_OF_MAIL #open(F_SEND,$SENDFILE) || &Error("Cannot open sendfile for MIME encoding"); open(F_SEND,$SENDFILE) || die ("Cannot open sendfile for MIME encoding"); while (read(F_SEND,my $buf, 60 * 57 ) ) { print F_MAIL encode_base64($buf); } close(F_SEND); print F_MAIL <
Re: Send attachment (but no MIME)?is it possible
On Wed, 20 Mar 2002 08:55:11 -0500, zentara <[EMAIL PROTECTED]> wrote: >On Wed, 20 Mar 2002 13:07:56 +0100, [EMAIL PROTECTED] (Anthony) wrote: > >>is it possible to have a perl script sending e-mail with attachment without >>using MIME::Lite since most host don't have MIME::Lite.? >> > >You could try this script ># > Oops, the script runs , but I messed up the sendfile name. You can probably see the mistake, or just change my $SENDFILE = 'myfile' to my $SENDFILE = 'z' Sorry, it's a sleepy rainy day here. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bit reversal of MAC Address bytes...
At 09:50 AM 3/19/2002 -0500, Tim Musson wrote: >Thanks to all who sent pointers! > >Here is my code before I put it up as a web page tool (and clean it up >and comment it ). > >comments/suggestions anyone? > >#!perl -w >use strict; >use diagnostics; > >my $debug = "yes"; >my (@mac); >my $mac = "0123 6789 cdef"; >$mac =~ s/\s//g; >my $i = 0; >while($mac =~ /(.{2})/g){ > $mac[$i++] = $1; > my $str = unpack("B8", pack("H2", $1)); > print $1 . " - " . "$str\n" if $debug; > my $revstring = reverse($str); > my $hex2 = unpack("H2", pack("B8", $revstring)); > print " $revstring - $hex2\n\n" if $debug; >} I found a slightly more concise phrase. The first transformation swaps the two hex digits within each byte, keeping the bytes in original order. The second transformation is a lookup table for the function that reverses any one hex digit. my $Debug = 1; my $InputStr = '7BB57DF7'; (my $NibbleSwapped = $InputStr . ' ') =~ s/(.)(.)/$2$1/g; (my $Reverse = $NibbleSwapped) =~ tr/0-9A-F/084C2A6E195D3B7F/; print $InputStr . "- " . $NibbleSwapped . "-" . $Reverse . "\n" if $Debug; Obviously, this doesn't strips spaces etc - that's easy enough. I just started the camel book a few days ago, so I hope the cognoscenti can point out improvements. -- tvc -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
perl DBI to Mysql , what happens when field I query is blank ?
Hello I have redhat 7.1 and mysql , I am trying to query DB of People if there is no record for this person , I want to add them . My problem seams to be what is in query results with it comes back blank here is the code $dbh1 =DBI ->connect($data_source, $username, $password) or die "cant connect to $data_source : my $dbh-> errstr\n"; my $sth1 = $dbh1 -> prepare("select owner from users where owner = '$user_n'"); $sth1 -> execute or die " unable to execute query "; # $sth1 -> finish; # $dbh1->disconnect; my $array_ref = $sth1 -> fetchall_arrayref(); foreach $row(@$array_ref){ my($owner) = @$row; if($owner eq NULL){ $dbh4 =DBI ->connect($data_source, $username, $password) or die "cant connect to $data_source : my $dbh-> errstr\n"; my $sth2 = $dbh4 -> prepare("insert into users(owner)values('$user_n')"); $sth2 -> execute or die " unable to execute query "; } } $sth -> finish; # look up results ?? thanks in advance Jim
Re: DBI really quick question
Hanson, Robert wrote: >"How do I CREATE a database from within perl with MySQL?" > >I don't think you can... but you can run the mysql interface from the >script. Actually I think that you can pipe a list of commands to mysql. > >Rob > If you can get a connection with proper permissions, all you need to do is use: $dbh->do("CREATE DATABASE foo"); I noticed that you don't have to issue a new connect to switch to the new database. $dbh->do("use foo"); I also discovered that you don't need to specify a database when connecting. my $dbh = DBI->connect('dbh:mysql:','root','xxx'); Here's a quick example: #!/usr/bin/perl use strict; use DBI; my $dbh = DBI->connect('dbi:mysql:','root','xx'); $dbh->do("CREATE DATABASE foo"); $dbh->do("use foo"); $dbh->do(" CREATE TABLE bar( id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, value VARCHAR(23) NOT NULL DEFAULT 'Kallisti' ) "); $dbh->do(" INSERT INTO bar VALUES() "); my $sth = $dbh->prepare("SELECT value FROM bar"); $sth->execute(); while( my($val) = $sth->fetchrow_array() ){ print "$val\n"; } $dbh->do("DROP DATABASE foo"); $dbh->disconnect(); Happy hacking, - Johnathan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: perl DBI to Mysql , what happens when field I query is blank ?
I may be off on this, but this sounds like a sql issue. The record count being returned is 0 so check on the record count, not if client eq null. -Original Message- From: FLAHERTY, JIM-CONT [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 10:55 AM To: Beginners (E-mail) Subject: perl DBI to Mysql , what happens when field I query is blank ? Hello I have redhat 7.1 and mysql , I am trying to query DB of People if there is no record for this person , I want to add them . My problem seams to be what is in query results with it comes back blank here is the code $dbh1 =DBI ->connect($data_source, $username, $password) or die "cant connect to $data_source : my $dbh-> errstr\n"; my $sth1 = $dbh1 -> prepare("select owner from users where owner = '$user_n'"); $sth1 -> execute or die " unable to execute query "; # $sth1 -> finish; # $dbh1->disconnect; my $array_ref = $sth1 -> fetchall_arrayref(); foreach $row(@$array_ref){ my($owner) = @$row; if($owner eq L){ $dbh4 =DBI ->connect($data_source, $username, $password) or die "cant connect to $data_source : my $dbh-> errstr\n"; my $sth2 = $dbh4 -> prepare("insert into users(owner)values('$user_n')"); $sth2 -> execute or die " unable to execute query "; } } $sth -> finish; # look up results ?? thanks in advance Jim -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Votrax text-to-speech synthesizer
I have an old Votrax "Type N Talk" text-to-speech synthesizer, circa 1982. It connects to a serial port and will accept text strings changing them to speech. I want to experiment with the unit by connecting it to a serial port on my Linux server and send text strings to it via a web page fronting for a Perl-CGI program. Before I go out and re-invent the wheel, has anyone had fun doing this already, and would they share their experience and any pointers? Code samples would be great! TIA John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
sockets
Gents, Can perl check if a port is up, and if that port immediately exists if you try to connect to it? For example: I have a program running on port 8000. If you telnet to the port (8000), you'll see 'connected to'.and telnet will exist immediately... if that happens then perl should say : 'ok'... Do somewhone know how I need to implement this? rgrds, Bart smime.p7s Description: S/MIME Cryptographic Signature
MIME::Lite Query
Hello there, I'm using MIME::Lite to send E-mails out that are generated from a Perl script. I seem to be having problems with the date field. When I hard code a date into the message e.g. $msg = new MIME::Lite From=> $from, To => $to, Date=> 'Wednesday 20th March 2002 17:30', etc it works fine & the resulting E-mail includes the time the mail was sent. If I try to pass $date from Perl using localtime it does not work. e.g. $date = strftime "%a %d/%m/20%y %H:%M", localtime; (I know I get a valid date here) $msg = new MIME::Lite From=> $from, To => $to, Date=> $date, etc Does anybody know the rules regarding the date field and what it expects. I cannot find the key info I require on CPAN. Any info greatly received Richard. Richard Mace Fradley Telephone Unit Lorien PLC -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MIME::Lite Query
perhaps you need to single quote the $msg value to prevent interpolation? there are slashes in there, for instance. you might test without the slashes in $msg. On Wednesday, March 20, 2002, at 09:26 AM, Mace, Richard wrote: > Hello there, > I'm using MIME::Lite to send E-mails out that are generated from a Perl > script. > I seem to be having problems with the date field. When I hard code a > date into > the message e.g. > > $msg = new MIME::Lite > From=> $from, > To => $to, > Date=> 'Wednesday 20th March 2002 17:30', > etc > > it works fine & the resulting E-mail includes the time the mail was > sent. > > > If I try to pass $date from Perl using localtime it does not work. > e.g. > > $date = strftime "%a %d/%m/20%y %H:%M", localtime; (I know I get a valid > date here) > > $msg = new MIME::Lite > From=> $from, > To => $to, > Date=> $date, > etc > > Does anybody know the rules regarding the date field and what it > expects. > I cannot find the key info I require on CPAN. > > Any info greatly received > > Richard. > > Richard Mace > Fradley Telephone Unit > Lorien PLC > > > -- > 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]
Since when is $_ a read-only variable?
I'm trying to process a list like so: foreach ("photoshare", "mmc", "popline", "popline/www", "popline/db", "netlinks") { $aoutpath = "/usr/local/httpd/htdocs/webstats/$_/$$MM"; mkdir("$aoutpath") unless (-e "$aoutpath"); print "Can't write $aoutpath.\n" unless (-w $aoutpath); print "\$_ is <" . $_ . ">\n"; #for troubleshooting only s#/#.#g; #Substitute "." for "/" in the magic variable, to match analog.cfg filenam es system("$apath/analog -m +g${acfgpath}/${_}.analog.cfg +F$YY${MM}01 +T$YY${MM}31 +O${aout path}/index.html"); } #end for each subject area In the fourth iteration, the directory to be generated should be "/usr/local/httpd/htdocs/webstats/popline/www/200203", but the +g option to the command "analog" should be "popline.www.analog.cfg". In other words, I want to substitute "." for "/" in the magic variable $_ in each foreach loop. When I try to run this, I get "Modification of a read-only value attempted at ./2001.analogall.pl line 81." The print statement in line 80, just above the substitution statement, shows the contents of $_ to be "photoshare" like I expected. I'm really puzzled, why it seems to be indicating that $_ is a read-only variable. Can anyone enlighten me? Thanks for your help. -Kevin Zembower -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Installing modules on website
That did the trick thankyou!
Making my own error.logs
My new web hosting service at oneononeinternet.com doesn't have error logs for each site. What do I do? Is there a way for me to create my own logs for my perl files?
Re: Making my own error.logs
On 3/20/02 11:05 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > My new web hosting service at oneononeinternet.com doesn't have error logs > for each site. What do I do? > > Is there a way for me to create my own logs for my perl files? You could redirect STDERR like this... open(STDERR,">>err.txt"); Then all your error messages would go to err.txt, I think. Of course, you'd have to put that in all your scripts, and it wouldn't help you with compile-time errors. There certainly might be a better way I'm not familiar with, though. -- Michael -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Making my own error.logs
From: Michael Kelly <[EMAIL PROTECTED]> > On 3/20/02 11:05 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > > My new web hosting service at oneononeinternet.com doesn't have > > error logs for each site. What do I do? > > > > Is there a way for me to create my own logs for my perl files? > > You could redirect STDERR like this... > > open(STDERR,">>err.txt"); > > Then all your error messages would go to err.txt, I think. Of course, > you'd have to put that in all your scripts, and it wouldn't help you > with compile-time errors. Put a BEGIN{} block around it and you will ... to some extent. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Since when is $_ a read-only variable?
From: "KEVIN ZEMBOWER" <[EMAIL PROTECTED]> > I'm trying to process a list like so: > foreach ("photoshare", "mmc", "popline", "popline/www", "popline/db", > "netlinks") { The loop control variable (the variable through whichyou access the values in the array you loop over) is actualy an ALIAS to the list/array value, not a copy. This means that if you change the content of the variable you are changing the contents of the array. But of course this time the items of the array (well, actually list. It's better to distinguish the two ) are constants. Thus you cannot change them. Thus you canot assign to $_. you have to copy the value to a different variable first. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Since when is $_ a read-only variable?
> I'm trying to process a list like so: > foreach ("photoshare", "mmc", "popline", "popline/www", "popline/db", > "netlinks") { > ... > s#/#.#g; > system("$apath/analog -m +g${acfgpath}/${_}.analog.cfg > +F$YY${MM}01 +T$YY${MM}31 +O${aout > path}/index.html"); > } #end for each subject area > > In other words, I want to > substitute "." for "/" in the magic variable $_ in each foreach loop. > > When I try to run this, I get "Modification of a read-only > value attempted at ./2001.analogall.pl line 81." The print > statement in line 80, just above the substitution statement, > shows the contents of $_ to be "photoshare" like I expected. It's because you're looping over a temporary anonymous list. I would guess it's stored as constant to make it more efficient. You're gonna have to save a copy to play with, like: foreach('photoshare','mmc') { ... # stuff my $tmp = $_; $tmp =~ s#/#.#g; system("...${tmp}.analog.cfg..."); } Hope that makes some sense, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MIME::Lite Query
From: "Mace, Richard" <[EMAIL PROTECTED]> > I'm using MIME::Lite to send E-mails out that are generated from a > Perl script. I seem to be having problems with the date field. When I > hard code a date into the message e.g. > > $msg = new MIME::Lite > From => $from, > To => $to, > Date => 'Wednesday 20th March 2002 17:30', > etc > > it works fine & the resulting E-mail includes the time the mail was > sent. > > > If I try to pass $date from Perl using localtime it does not work. > e.g. > > $date = strftime "%a %d/%m/20%y %H:%M", localtime; > #(I know I get a valid date here) Arr. Ever heard about the Y2K bu? DO NOT USE "20%y". EVER !!! (Yes it'll be more than 97 years before this code will go wrong, but suppose you were printing some dates in the future.) Use "%Y" instead !!! Besides you have the format of the date wrong. Try $date = strftime "%a, %d %b %Y %H:%M", localtime; plus you should include your difference against GMT. (Which happens to be "-" in your case.) Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Installing my own modules
[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth: *> *>It would be nicer if I knew how to put Image::Size or any other module I want *>in my own cgi-bin. *>How do I make perl find the modules I upload? http://www.cpan.org/misc/cpan-faq.html#How_install_private e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
GD getBounds problem
I have a problem. The code below creates the error below. I can't see what is wrong with it. I could of swore this code used to work. Any ideas? use GD; use LWP::Simple; use strict; ### GET IMAGE ATTRIBS <.. bunch of code that gets an image off the web and writes it to disk successfully ..> open(OUT, ">image.jpg") or die $!; binmode(OUT); print OUT $content; close(OUT); my $image=GD::Image->newFromJpeg("image.jpg"); my ($width,$height)=$image->getBounds(); Error: Can't call method "getBounds" on an undefined value at ./sendanf.pl line 32. Thanks, Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Since when is $_ a read-only variable?
Thank you, David, Jenda and Kate for explaining this so clearly. I would have had trouble understanding this on my own. Your explanations were very easy to grasp. I think I found what you're talking about on page 118-119 of Programming Perl 3, although this point seems very subtle. Is there another explanation on another page or anywhere in other documents that I could read more on this? If you can think of one off the top of your head, thanks. If not, don't spend time looking one up. Thanks so much, again. -Kevin >>> "David Gray" <[EMAIL PROTECTED]> 03/20/02 02:40PM >>> > I'm trying to process a list like so: > foreach ("photoshare", "mmc", "popline", "popline/www", "popline/db", > "netlinks") { > ... > s#/#.#g; > system("$apath/analog -m +g${acfgpath}/${_}.analog.cfg > +F$YY${MM}01 +T$YY${MM}31 +O${aout > path}/index.html"); > } #end for each subject area > > In other words, I want to > substitute "." for "/" in the magic variable $_ in each foreach loop. > > When I try to run this, I get "Modification of a read-only > value attempted at ./2001.analogall.pl line 81." The print > statement in line 80, just above the substitution statement, > shows the contents of $_ to be "photoshare" like I expected. It's because you're looping over a temporary anonymous list. I would guess it's stored as constant to make it more efficient. You're gonna have to save a copy to play with, like: foreach('photoshare','mmc') { ... # stuff my $tmp = $_; $tmp =~ s#/#.#g; system("...${tmp}.analog.cfg..."); } Hope that makes some sense, -dave -- 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]
checking username
i have a cgi page that allows users to signup for my webmail service, but submitin info to a form that writes to a textfile. I need to get the username after it is submitted, and check it against existing system usernames (/etc/passwd) and sendmail virtual usernames. is this possible? if so, how? also, how can i make a cron job that parses the textfile and creates a new user from the results? the textfile is in the format of: username:password:gid:homedir:shell the syntax for my adduser program is: adduser -g 'gid' -d 'homedir' -s 'shell' -p 'password' 'username' -- Matthew Harrison Internet/Network Services Administrator Peanut-Butter Cheesecake Hosting Services Genstate www.peanutbuttercheesecake.co.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
open(FILE, " ") question
Hi, I am very new to perl. I am writing a script that is supposed to open an html file and do some various tasks then later on it should print out the html file. I am having problems with one portion of it. I distilled it down to this code snippet == # test use strict; my $file; my $HTML; sub testOpen { local (*FILE); # filehandle $file = $_[0] || die ("No file specified\n"); open(FILE, "$file") || die("File could not be opened - $file\n"); while () { $HTML .= $_; } close(FILE); $HTML =~ s/\$(\w+)/${$1}/g; return $HTML; } print "Content-type: text/html\n\n"; print &testOpen("test.htm");# Prints the contents of this file My problem is this works great from the command prompt. But will not open the file if hit the script from a browser. I am not sure why it behaves differently in a browser - I suspect permissions but I have the directory set to write, execute. I am using a win2k IIS box with the lastest version of ActivePerl. Thanks in advance, Eric
Re: open(FILE, " ") question
It's probably because the of the file path. Try specifying the whole path to see if it works. Regards, Agustin Rivera Webmaster, Pollstar.com http://www.pollstar.com - Original Message - From: "Eric Preece" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 20, 2002 1:52 PM Subject: open(FILE, " ") question Hi, I am very new to perl. I am writing a script that is supposed to open an html file and do some various tasks then later on it should print out the html file. I am having problems with one portion of it. I distilled it down to this code snippet == # test use strict; my $file; my $HTML; sub testOpen { local (*FILE); # filehandle $file = $_[0] || die ("No file specified\n"); open(FILE, "$file") || die("File could not be opened - $file\n"); while () { $HTML .= $_; } close(FILE); $HTML =~ s/\$(\w+)/${$1}/g; return $HTML; } print "Content-type: text/html\n\n"; print &testOpen("test.htm"); # Prints the contents of this file My problem is this works great from the command prompt. But will not open the file if hit the script from a browser. I am not sure why it behaves differently in a browser - I suspect permissions but I have the directory set to write, execute. I am using a win2k IIS box with the lastest version of ActivePerl. Thanks in advance, Eric -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: open(FILE, " ") question
From: "Eric Preece" <[EMAIL PROTECTED]> > I am very new to perl. I am writing a script that is supposed to open > an html file and do some various tasks then later on it should print > out the html file. I am having problems with one portion of it. I > distilled it down to this code snippet > > == > # test > use strict; > > my $file; > my $HTML; > > sub testOpen { > local (*FILE); # filehandle > $file = $_[0] || die ("No file specified\n"); The "my $file " should be INSIDE the subroutine, not outside, change the line above to my $file = $_[0] || die ("No file specified\n"); or my $file = $_[0] or die ("No file specified\n"); > open(FILE, "$file") || die("File could not be opened - $file\n"); No NEVER enclose variables in doublequotes by themselves. If you need to insert the contents of a variable inside some text, the you have to, but "$variable" is nonsense. (Yes, it seems to do the right thing. Now.) > while () { >$HTML .= $_; > } > close(FILE); > $HTML =~ s/\$(\w+)/${$1}/g; > return $HTML; > } > > print "Content-type: text/html\n\n"; > print &testOpen("test.htm"); # Prints the contents of this file The & in front of subroutine calls is deprecated (should not be used). > > > My problem is this works great from the command prompt. But will not > open the file if hit the script from a browser. I am not sure why it > behaves differently in a browser - I suspect permissions but I have > the directory set to write, execute. > > I am using a win2k IIS box with the lastest version of ActivePerl. Use full path. The current working directory is most probably NOT what you might think it is. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Making my own error.logs
[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth: *>My new web hosting service at oneononeinternet.com doesn't have error logs *>for each site. What do I do? *> *>Is there a way for me to create my own logs for my perl files? You probably would benefit from buying http://www.amazon.com/exec/obidos/ASIN/1565926471/ e. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: directory creation help
Finally worked this one out. There was a version problem. We were tasked to use the version of PERL in NTReskit (5.0.0.1). It does not work with any variation that we came up with or with the ones that this group suggested (thanks!) We have decided to install the stable release and then run the scripts. Thanks -Original Message- From: John Marion [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 8:50 PM To: [EMAIL PROTECTED] Subject: directory creation help Well I changed the make up of lines 137 and 138. This is where the problem lies. I cannot make a drecotry that is part of the list that I use (ie: ...\apps\dll ) and then copy all the associated dll files into it. Anything would be greatly appreciated. John #!C:\NTRESKIT\perl #use File::Copy; #does C:\ntapps\common\C exist? #add user notification using Win32::Console $startdir = "\\ntapps\\common\\c"; @filespec = ('exe', 'dll'); #@filedelete = glob ("\\junk\\save\\*.*"); @filedelete = system ("del "."$savedir"."*.* /Q"); #@cmd = ('dir'); $savedir = 'C:\junk\save'; #sub searchDirectory; #sub builddirectory; if (-e "\\ntapps\\common\\c"){ #Find all EXE's and DLL's open (OUTFILE, '>\ntapps\log\mv_common_c.lst'); searchDirectory($startdir,"",@filespec); #removing files from junk\save #unlink @filedelete; #rename files using the system system ("rename" ,'C:\junk\save\*.*', '*.old'); close (OUTFILE); movefiles(); }else print "missing \n"; } # use THIS TO FIND EXE'S AND DLL's sub searchDirectory { # $startdir is a path name, @filespec is a list of file extensions only(ie: exe, dll, ...) local($basedir,$startdir,@filespec) = @_; local(@lines); local($subdir); local($lvl_counter); local($list_length); #print "got to search directory\n"; if(opendir (DIR,$basedir.$startdir)) { @lines = readdir (DIR); closedir (DIR); $lvl_counter = 2; $list_length = ( scalar @lines ); while ($lvl_counter < $list_length) { $subdir = $startdir."\\".$lines[$lvl_counter]; if(!searchDirectory($basedir,$subdir,@filespec)) { processnames($startdir.'|'.$lines[$lvl_counter],@filespec); } $lvl_counter++; } }else { return 0; } return 1; } sub processnames { # Give the value passed to this sub a sensible name. my ($filename,@filespec) = @_; $match = join '|', @filespec; if ($filename =~ /($match)$/i) { print (OUTFILE "$filename\n"); } } sub movefiles { local ($name, $path, $filename, $topath); #This is moving the files on the list we created to junk\save #open input file print "inputlist\n"; open (INPUTLIST, '<\ntapps\log\mv_common_c.lst'); foreach $file () { ($path,$name) = split (/\|/, $file); if (!-e $savedir.$path."\\" && !$path == "" ) { $topath = $savedir.$path; print "path:$path\n"; print "making directory: $topath\n"; #mkdir ($topath, 0777) || die "cannot mkdir $topath: $!"; #`C:\\john\\ldapps\\perl\\buildir.pl $savedir, $path`; ##closedir dumb; } if (!-d $basedir ) {print "ouch\n" } $command = 'copy '.$startdir.$path."\\".$name.' C:\junk\save'.$path; print "$command\n"; print "path:$topath, name:$filename\n"; system ($command); last; } close (INPUTLIST); } #this assumes that basedir exists sub builddirectory { local ($basedir, @path) = @_; local ($directory); @sublist = ($path <1) ? (split(/\\/, $path[0])) : (@path) ; print "$#path, $#sublist, @path, @sublist\n"; foreach $directory (@sublist) { if ($directory =~ /\s/) { next; } if (!-e $basedir.'\\' .$directory) {system (start, md 'C:\junk\save'. '\\' .$directory);} $basedir .= '\\'.$directory; #if (!-e $basedir.'\\' .$directory) { mkdir($basedir. '\\' .$directory, 0777); } #$basedir .= '\\'.$directory; print "$basedir\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]
perl infant stage..
Hi! Im a New User to Perl. Ive got Equipped with me a book called Begining Perl by Simon Cozens, its honeslty an Quite an Good Buy! However, after installing Perl from ActiveState, (for Windows) and creating myFirst Hello World Program, im COMPLETELY unable to run it! However, when tried on UNIX i was able to get Hello World.. its quite queer.. Im not a UNIX user i just explored the system as i found a dead end with Windows. However, if you could revies the Attachment fir my Windows ERROR and tell me where i went wrong i would deeply appreciate it! ThankQ! MaLs.. __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: perl infant stage..
I don't see an attachment. Howefver I can give you a few tips to make sure your ActiveState is installed correctly and to launch your script. 1) The #!/usr/bin/perl(or something) line won't do anything in Windows. Make sure that your scripts have a .pl extension, otherwise Windows won't know what to do with it. 2) When you open Explorer, do your .pl files have a yellow pearl icon? If not, hold down SHIFT, right-click, and select Open With... from the context menu. In the dialog that opens, make sure "Always use this program for this type of file" is checked. Click on Browse... and find perl.exe (c:\perl\bin\perl.exe by default). Hope that helps. -Original Message- From: Perl CosmicVoid [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 7:52 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: perl infant stage.. Hi! Im a New User to Perl. Ive got Equipped with me a book called Begining Perl by Simon Cozens, its honeslty an Quite an Good Buy! However, after installing Perl from ActiveState, (for Windows) and creating myFirst Hello World Program, im COMPLETELY unable to run it! However, when tried on UNIX i was able to get Hello World.. its quite queer.. Im not a UNIX user i just explored the system as i found a dead end with Windows. However, if you could revies the Attachment fir my Windows ERROR and tell me where i went wrong i would deeply appreciate it! ThankQ! MaLs.. __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards. http://movies.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Finding the date of last sunday
Can anyone think of a good way for me to find out what the date of last sunday is with perl? I'm writing a script that will need to do some basic reporting starting from the previous sunday. I'm usign the date format -MM-DD Any help appreciated! Thanks, rory -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: perl infant stage..
Hi Tim! ThankQ for the Quick reply! i was unable to send the Attachment due to its Size However, i would like to Confirm yes it has that i)YES it has a Yellow Perl icon! my file is called hello1.plx is that ok.. even if i have placed the default..?! or should i go to explorer and View>>FolderOptions>>FileTypes and change teh extension to pl instead of PLX.. ?! thanks Once Again! MaLs.. --- Timothy Johnson <[EMAIL PROTECTED]> wrote: > > I don't see an attachment. Howefver I can give you > a few tips to make sure > your ActiveState is installed correctly and to > launch your script. > > 1) The #!/usr/bin/perl(or something) line won't do > anything in Windows. > Make sure that your scripts have a .pl > extension, otherwise Windows > won't know what to do with it. > > 2) When you open Explorer, do your .pl files have a > yellow pearl icon? > If not, hold down SHIFT, right-click, and select > Open With... from the > context menu. > In the dialog that opens, make sure "Always use > this program for this > type of file" is checked. > Click on Browse... and find perl.exe > (c:\perl\bin\perl.exe by default). > > Hope that helps. > > -Original Message- > From: Perl CosmicVoid [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, March 20, 2002 7:52 PM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: perl infant stage.. > > > Hi! > > Im a New User to Perl. > Ive got Equipped with me a book called Begining Perl > by Simon Cozens, its honeslty an Quite an Good Buy! > > However, after installing Perl from ActiveState, > (for Windows) and creating myFirst Hello World > Program, im COMPLETELY unable to run it! > However, when tried on UNIX i was able to get Hello > World.. its quite queer.. > > Im not a UNIX user i just explored the system as i > found a dead end with Windows. > However, if you could revies the Attachment fir my > Windows ERROR and tell me where i went wrong i would > deeply appreciate it! > > ThankQ! > MaLs.. > > > > __ > Do You Yahoo!? > Yahoo! Movies - coverage of the 74th Academy Awards. > http://movies.yahoo.com/ > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > This email may contain confidential and privileged > material for the sole use of the intended recipient. > > If you are not the intended recipient, please > contact > the sender and delete all copies. __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Finding the date of last sunday
On Mar 20, rory oconnor said: >Can anyone think of a good way for me to find out what the date of last >sunday is with perl? I'm writing a script that will need to do some >basic reporting starting from the previous sunday. > >I'm usign the date format -MM-DD I suggest the standard Time::Local module. It's timelocal() function, along with the builtin localtime() function, allow you do to virtually anything. use Time::Local; use constant SECONDS_PER_DAY => 86400; my ($year, $mon, $day) = (2002, 3, 20); # today's date my $today_at_noon = timelocal(0,0,12, $day, $mon-1, $year-1900); my $days_since_sunday = (localtime $today_at_noon)[6] || 7; my $sunday = $today_at_noon - $days_since_sunday * 86400; Now we have $sunday, the number of seconds that represents last Sunday; in the event that this program is run ON a Sunday, we reach back to last week's Sunday. With this value, you can then do: my ($d, $m, $y) = (localtime $sunday)[3,4,5]; and concoct a date in the form of -MM-DD like so: sprintf "%4d-%02d-%02d", $y+1900, $m+1, $d; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: perl infant stage..
Hi! Ive got two different Perl icons now. One Big Perl and another a small perl against a paper backdrop.. the MSDOS program does run, However its a split second thing its zips in front of the eye and disappears.. Please Advise. MaLs.. --- Michael Gargiullo <[EMAIL PROTECTED]> wrote: > I believe they need to just be .pl... I'm a Linux > user... I don't have a > windows box to even check with, but The Perl > Interpreter I think needs the > files to end with .pl > > Hope this helps > > -Original Message- > From: Perl CosmicVoid [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, March 20, 2002 11:20 PM > To: Timothy Johnson > Cc: [EMAIL PROTECTED] > Subject: RE: perl infant stage.. > > > Hi Tim! > > ThankQ for the Quick reply! > i was unable to send the Attachment due to its Size > > However, i would like to Confirm yes it has that > i)YES it has a Yellow Perl icon! > > my file is called hello1.plx is that ok.. even if i > have placed the default..?! > > or should i go to explorer and > View>>FolderOptions>>FileTypes and change teh > extension to pl instead of PLX.. ?! > > thanks Once Again! > MaLs.. > --- Timothy Johnson <[EMAIL PROTECTED]> wrote: > > > > I don't see an attachment. Howefver I can give > you > > a few tips to make sure > > your ActiveState is installed correctly and to > > launch your script. > > > > 1) The #!/usr/bin/perl(or something) line won't > do > > anything in Windows. > > Make sure that your scripts have a .pl > > extension, otherwise Windows > > won't know what to do with it. > > > > 2) When you open Explorer, do your .pl files have > a > > yellow pearl icon? > > If not, hold down SHIFT, right-click, and > select > > Open With... from the > > context menu. > > In the dialog that opens, make sure "Always > use > > this program for this > > type of file" is checked. > > Click on Browse... and find perl.exe > > (c:\perl\bin\perl.exe by default). > > > > Hope that helps. > > > > -Original Message- > > From: Perl CosmicVoid > [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, March 20, 2002 7:52 PM > > To: [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subject: perl infant stage.. > > > > > > Hi! > > > > Im a New User to Perl. > > Ive got Equipped with me a book called Begining > Perl > > by Simon Cozens, its honeslty an Quite an Good > Buy! > > > > However, after installing Perl from ActiveState, > > (for Windows) and creating myFirst Hello World > > Program, im COMPLETELY unable to run it! > > However, when tried on UNIX i was able to get > Hello > > World.. its quite queer.. > > > > Im not a UNIX user i just explored the system as i > > found a dead end with Windows. > > However, if you could revies the Attachment fir my > > Windows ERROR and tell me where i went wrong i > would > > deeply appreciate it! > > > > ThankQ! > > MaLs.. > > > > > > > > __ > > Do You Yahoo!? > > Yahoo! Movies - coverage of the 74th Academy > Awards. > > http://movies.yahoo.com/ > > > > -- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > This email may contain confidential and privileged > > material for the sole use of the intended > recipient. > > > > If you are not the intended recipient, please > > contact > > the sender and delete all copies. > > > __ > Do You Yahoo!? > Yahoo! Movies - coverage of the 74th Academy Awards® > http://movies.yahoo.com/ > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Finding the date of last sunday
The Date::Manip module can do almost anything you can think of with dates: http://search.cpan.org/doc/SBECK/DateManip-5.40/Manip.pod Have fun, Matt --- rory oconnor <[EMAIL PROTECTED]> wrote: > Can anyone think of a good way for me to find out what the date of last > sunday is with perl? I'm writing a script that will need to do some > basic reporting starting from the previous sunday. > > I'm usign the date format -MM-DD > > Any help appreciated! > > Thanks, > > rory > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: perl infant stage..
If you want to see the output, then you should run your script from a command prompt window. If you double-click on it, it will probably go by too quick to read. And yes, I would recommend sticking to .pl extension. I can't remember exactly what .plx is for. -Original Message- From: Perl CosmicVoid To: Michael Gargiullo Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 3/20/02 8:52 PM Subject: RE: perl infant stage.. Hi! Ive got two different Perl icons now. One Big Perl and another a small perl against a paper backdrop.. the MSDOS program does run, However its a split second thing its zips in front of the eye and disappears.. Please Advise. MaLs.. --- Michael Gargiullo <[EMAIL PROTECTED]> wrote: > I believe they need to just be .pl... I'm a Linux > user... I don't have a > windows box to even check with, but The Perl > Interpreter I think needs the > files to end with .pl > > Hope this helps > > -Original Message- > From: Perl CosmicVoid [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, March 20, 2002 11:20 PM > To: Timothy Johnson > Cc: [EMAIL PROTECTED] > Subject: RE: perl infant stage.. > > > Hi Tim! > > ThankQ for the Quick reply! > i was unable to send the Attachment due to its Size > > However, i would like to Confirm yes it has that > i)YES it has a Yellow Perl icon! > > my file is called hello1.plx is that ok.. even if i > have placed the default..?! > > or should i go to explorer and > View>>FolderOptions>>FileTypes and change teh > extension to pl instead of PLX.. ?! > > thanks Once Again! > MaLs.. > --- Timothy Johnson <[EMAIL PROTECTED]> wrote: > > > > I don't see an attachment. Howefver I can give > you > > a few tips to make sure > > your ActiveState is installed correctly and to > > launch your script. > > > > 1) The #!/usr/bin/perl(or something) line won't > do > > anything in Windows. > > Make sure that your scripts have a .pl > > extension, otherwise Windows > > won't know what to do with it. > > > > 2) When you open Explorer, do your .pl files have > a > > yellow pearl icon? > > If not, hold down SHIFT, right-click, and > select > > Open With... from the > > context menu. > > In the dialog that opens, make sure "Always > use > > this program for this > > type of file" is checked. > > Click on Browse... and find perl.exe > > (c:\perl\bin\perl.exe by default). > > > > Hope that helps. > > > > -Original Message- > > From: Perl CosmicVoid > [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, March 20, 2002 7:52 PM > > To: [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subject: perl infant stage.. > > > > > > Hi! > > > > Im a New User to Perl. > > Ive got Equipped with me a book called Begining > Perl > > by Simon Cozens, its honeslty an Quite an Good > Buy! > > > > However, after installing Perl from ActiveState, > > (for Windows) and creating myFirst Hello World > > Program, im COMPLETELY unable to run it! > > However, when tried on UNIX i was able to get > Hello > > World.. its quite queer.. > > > > Im not a UNIX user i just explored the system as i > > found a dead end with Windows. > > However, if you could revies the Attachment fir my > > Windows ERROR and tell me where i went wrong i > would > > deeply appreciate it! > > > > ThankQ! > > MaLs.. > > > > > > > > __ > > Do You Yahoo!? > > Yahoo! Movies - coverage of the 74th Academy > Awards. > > http://movies.yahoo.com/ > > > > -- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > > > > This email may contain confidential and privileged > > material for the sole use of the intended > recipient. > > > > If you are not the intended recipient, please > > contact > > the sender and delete all copies. > > > __ > Do You Yahoo!? > Yahoo! Movies - coverage of the 74th Academy Awards. > http://movies.yahoo.com/ > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards. http://movies.yahoo.com/ This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: perl infant stage..
Do you try your script at Browser or at DOS prompt ? If you are dealing with browser, check if the #!C:/Perl/bin/perl.exe ( or other) parameter is set correctly, and if print "Content-type:text/html \n\n" applied. Of cause, your server setting should also account to your config If you are dealing with dosprmpt, try to type the full parameter to run your file with warn. eg. C:\Perl\bin\perl -w C:\yourPath\yourFile.plx Have a nice day =) Connie - Original Message - From: "Perl CosmicVoid" <[EMAIL PROTECTED]> To: "Timothy Johnson" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, March 21, 2002 12:19 PM Subject: RE: perl infant stage.. > Hi Tim! > > ThankQ for the Quick reply! > i was unable to send the Attachment due to its Size > > However, i would like to Confirm yes it has that > i)YES it has a Yellow Perl icon! > > my file is called hello1.plx is that ok.. even if i > have placed the default..?! > > or should i go to explorer and > View>>FolderOptions>>FileTypes and change teh > extension to pl instead of PLX.. ?! > > thanks Once Again! > MaLs.. > --- Timothy Johnson <[EMAIL PROTECTED]> wrote: > > > > I don't see an attachment. Howefver I can give you > > a few tips to make sure > > your ActiveState is installed correctly and to > > launch your script. > > > > 1) The #!/usr/bin/perl(or something) line won't do > > anything in Windows. > > Make sure that your scripts have a .pl > > extension, otherwise Windows > > won't know what to do with it. > > > > 2) When you open Explorer, do your .pl files have a > > yellow pearl icon? > > If not, hold down SHIFT, right-click, and select > > Open With... from the > > context menu. > > In the dialog that opens, make sure "Always use > > this program for this > > type of file" is checked. > > Click on Browse... and find perl.exe > > (c:\perl\bin\perl.exe by default). > > > > Hope that helps. > > > > -Original Message- > > From: Perl CosmicVoid [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, March 20, 2002 7:52 PM > > To: [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subject: perl infant stage.. > > > > > > Hi! > > > > Im a New User to Perl. > > Ive got Equipped with me a book called Begining Perl > > by Simon Cozens, its honeslty an Quite an Good Buy! > > > > However, after installing Perl from ActiveState, > > (for Windows) and creating myFirst Hello World > > Program, im COMPLETELY unable to run it! > > However, when tried on UNIX i was able to get Hello > > World.. its quite queer.. > > > > Im not a UNIX user i just explored the system as i > > found a dead end with Windows. > > However, if you could revies the Attachment fir my > > Windows ERROR and tell me where i went wrong i would > > deeply appreciate it! > > > > ThankQ! > > MaLs.. > > > > > > > > __ > > Do You Yahoo!? > > Yahoo! Movies - coverage of the 74th Academy Awards. > > http://movies.yahoo.com/ > > > > -- > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > > -- -- > > This email may contain confidential and privileged > > material for the sole use of the intended recipient. > > > > If you are not the intended recipient, please > > contact > > the sender and delete all copies. > > > __ > Do You Yahoo!? > Yahoo! Movies - coverage of the 74th Academy Awards® > http://movies.yahoo.com/ > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Finding the date of last sunday
Jeff, One quick question...since I want to run this every week, will that part here you hard-coded today's date need to be changed to be dynamic? thanks, rory On Wed, 2002-03-20 at 22:30, Jeff 'japhy' Pinyan wrote: > On Mar 20, rory oconnor said: > > >Can anyone think of a good way for me to find out what the date of last > >sunday is with perl? I'm writing a script that will need to do some > >basic reporting starting from the previous sunday. > > > >I'm usign the date format -MM-DD > > I suggest the standard Time::Local module. It's timelocal() function, > along with the builtin localtime() function, allow you do to virtually > anything. > > use Time::Local; > use constant SECONDS_PER_DAY => 86400; > > my ($year, $mon, $day) = (2002, 3, 20); # today's date > my $today_at_noon = timelocal(0,0,12, $day, $mon-1, $year-1900); > my $days_since_sunday = (localtime $today_at_noon)[6] || 7; > my $sunday = $today_at_noon - $days_since_sunday * 86400; > > Now we have $sunday, the number of seconds that represents last Sunday; in > the event that this program is run ON a Sunday, we reach back to last > week's Sunday. > > With this value, you can then do: > > my ($d, $m, $y) = (localtime $sunday)[3,4,5]; > > and concoct a date in the form of -MM-DD like so: > > sprintf "%4d-%02d-%02d", $y+1900, $m+1, $d; > > -- > Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ > RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ > ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** > what does y/// stand for? why, yansliterate of course. > [ I'm looking for programming work. If you like my work, let me know. ] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help Required - Search and Replace
All, I have a one big text file and also I have some set of strings to be replaced by another set of strings. Currently, I am reading each line of the file, and replacing one set of strings by another set of strings, one after another. Is there any efficient way of doing this? The data is so huge that this job takes around 7Hrs of total time on Sun Ultra 10. Is there any way of efficiently doing this? Thanks in advance. Thanks and Regards, D.Rajanikanth
Re: Finding the date of last sunday
On Mar 20, rory oconnor said: >On Wed, 2002-03-20 at 22:30, Jeff 'japhy' Pinyan wrote: >> On Mar 20, rory oconnor said: >> >> >Can anyone think of a good way for me to find out what the date of last >> >sunday is with perl? I'm writing a script that will need to do some >> >basic reporting starting from the previous sunday. >> > >> >I'm usign the date format -MM-DD >> >> I suggest the standard Time::Local module. It's timelocal() function, >> along with the builtin localtime() function, allow you do to virtually >> anything. >> >> use Time::Local; >> use constant SECONDS_PER_DAY => 86400; >> >> my ($year, $mon, $day) = (2002, 3, 20); # today's date >> my $today_at_noon = timelocal(0,0,12, $day, $mon-1, $year-1900); > >One quick question...since I want to run this every week, will that part >here you hard-coded today's date need to be changed to be dynamic? Of course. And you can bypass that step by make those TWO lines into ONE: my $today_at_noon = timelocal(0,0,12, (localtime)[3,4,5]); -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
creating file name from array
hi guys, I'm very new to perl. Ok, let's assume that I have a file named *user.txt* contained with my user name : donna maria karina .. .. .. etc I want to make a file for each of them. The file name and the content should contained with their names, eg. .qmail-donna, .qmail-maria and ..qmail-karina. so far, here's my code : (which isn't working) #!/usr/bin/perl $file="user.txt"; open FILE,$file; @user=; close FILE; foreach $lines (@user){ system "echo |/usr/local/blah ./$lines/maildir/filter > .qmail-$lines"; } please help me to make the right code. thank you. regards, Gregor WATCHOUT! 3RD INTERNATIONAL SEMINAR ON SUSTAINABLE ENVIRONTMENTAL ARCHITECTURE + DIGITAL ARCHITECTURE, 9-10 MARCH 2002, YOGYAKARTA http://senvar.virtue.nu or http://senvar.uajy.web.id NATIONAL DESIGN COMPETITION http://senvar.uajy.web.id/lombadesain -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: creating file name from array
Hey Gregor, I use something similar on my box (I use qmail too). This should do what you want it to. #!/usr/bin/perl -w use strict; my @users = qw/ donna maria karina /; foreach my $line (@user){ open OUT, ">/path/to/dir/.qmail-$line" or die "$!"; print OUT "|/usr/local/blah ./$line/maildir/filter"; close OUT or die "$!"; } Regards, Luke Davison - Original Message - From: "GREGOR" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 20, 2002 9:55 PM Subject: creating file name from array > hi guys, > > I'm very new to perl. > > Ok, let's assume that I have a file named *user.txt* contained with my user > name : > > donna > maria > karina > .. > .. > .. > etc > > I want to make a file for each of them. The file name and the content should > contained with their names, eg. .qmail-donna, .qmail-maria and > ..qmail-karina. > > so far, here's my code : (which isn't working) > > #!/usr/bin/perl > > $file="user.txt"; > open FILE,$file; > @user=; > close FILE; > > foreach $lines (@user){ > system "echo |/usr/local/blah ./$lines/maildir/filter > ..qmail-$lines"; > } > > please help me to make the right code. thank you. > > regards, > Gregor > > > WATCHOUT! 3RD INTERNATIONAL SEMINAR ON SUSTAINABLE ENVIRONTMENTAL > ARCHITECTURE + DIGITAL ARCHITECTURE, 9-10 MARCH 2002, YOGYAKARTA > http://senvar.virtue.nu or http://senvar.uajy.web.id > NATIONAL DESIGN COMPETITION > http://senvar.uajy.web.id/lombadesain > > -- > 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 the date of last sunday
You can use probably a number of different modules, but just some simple Perl processing can do the work for you: use Time::Local; # # Put date here, need to subtract one from Month for use in timelocal # Can leave year at 4 digits or take down to 3 digits(ie, 1900 from 4 digit) # my $DD = 20; my $MM = 2; # subtract 1 from month my $ = 2002; my @MyDay = qw(dum Sun Mon Tue Wed Thu Fri Sat); my $MyDate = timelocal(0,0,12,$DD,$MM,$); # gives you epoch seconds using noon my @TimeInfo = localtime($MyDate); my $MySunday = $MyDate - ($TimeInfo[6] * 86400); # [6] holds day of week(Sun:0 thru Sat:6) my $MyCurrDay = $MyDay[$TimeInfo[6]]; @TimeInfo = localtime($MySunday); $TimeInfo[4]++; printf "%-3s:%4d-%02d-%02d\n", $MyCurrDay, $, ($MM+1), $DD; printf "Sun:%4d-%02d-%02d\n", ($TimeInfo[5]+1900), $TimeInfo[4], $TimeInfo[3]; Output: Tue:2002-03-20 Sun:2002-03-17 Wags ;) -Original Message- From: rory oconnor [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 20:12 To: perl Subject: Finding the date of last sunday Can anyone think of a good way for me to find out what the date of last sunday is with perl? I'm writing a script that will need to do some basic reporting starting from the previous sunday. I'm usign the date format -MM-DD Any help appreciated! Thanks, rory -- 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 the date of last sunday
At 10:11 PM 3/20/02 -0600, rory oconnor wrote: >Can anyone think of a good way for me to find out what the date of last >sunday is with perl? I'm writing a script that will need to do some >basic reporting starting from the previous sunday. > >I'm usign the date format -MM-DD $ perl -MDate::Manip -le 'print UnixDate("last Sunday","%Y-%m-%d")' 2002-03-17 -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: creating file name from array
Thank you a lot Luke, it worked. Now there's something else, how do I tell perl to open a file where the /path/to/dir contained with $line? such as : open OUT, ">/path/to/$line/dir/.qmail-$line" or die "$!"; regards, gregor listperl writes: > Hey Gregor, > > I use something similar on my box (I use qmail too). This should do what you > want it to. > > #!/usr/bin/perl -w > use strict; > > my @users = qw/ donna maria karina /; > foreach my $line (@user){ > open OUT, ">/path/to/dir/.qmail-$line" or die "$!"; > print OUT "|/usr/local/blah ./$line/maildir/filter"; > close OUT or die "$!"; > } > > Regards, > Luke Davison > > > - Original Message - > From: "GREGOR" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, March 20, 2002 9:55 PM > Subject: creating file name from array > > >> hi guys, >> >> I'm very new to perl. >> >> Ok, let's assume that I have a file named *user.txt* contained with my > user >> name : >> >> donna >> maria >> karina >> .. >> .. >> .. >> etc >> >> I want to make a file for each of them. The file name and the content > should >> contained with their names, eg. .qmail-donna, .qmail-maria and >> ..qmail-karina. >> >> so far, here's my code : (which isn't working) >> >> #!/usr/bin/perl >> >> $file="user.txt"; >> open FILE,$file; >> @user=; >> close FILE; >> >> foreach $lines (@user){ >> system "echo |/usr/local/blah ./$lines/maildir/filter > > ..qmail-$lines"; >> } >> >> please help me to make the right code. thank you. >> >> regards, >> Gregor >> >> WATCHOUT! 3RD INTERNATIONAL SEMINAR ON SUSTAINABLE ENVIRONTMENTAL ARCHITECTURE + DIGITAL ARCHITECTURE, 9-10 MARCH 2002, YOGYAKARTA http://senvar.virtue.nu or http://senvar.uajy.web.id NATIONAL DESIGN COMPETITION http://senvar.uajy.web.id/lombadesain -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]