PPM Install
Hi, sorry for posting this question to the wrong list. I am running Windows XP and perl 5.6.8, when I ppm install DBD, by typing this at my dos prompt: C:\Perl\modulesppm install DBD-ODBC I get this error: C:\Perl\moduleError: No valid repositories: Error: 500 Can't connect to ppm.ActiveState.com:80 (connect: Unknown error) Error: 500 Can't connect to ppm.ActiveState.com:80 (connect: Unknown error)sppm install DBD-ODBC I have downloaded DBD-ODBC from activestate, is there some setting that I am missing to allow my machine to connect through my proxy server and firewall.
perl.beginners.cgi Weekly list FAQ posting
NAME beginners-faq - FAQ for the beginners-cgi mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to [EMAIL PROTECTED] You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners-cgi%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a month, and will be available online in the archives, and at http://beginners.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who do I complain to? Complaints can be sent to [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl/CGI beginners. 1.11 - When was this FAQ last updated? Feb 04, 2004 2 - Questions about the 'beginners-cgi' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. The topic of the list is, of course, CGI with Perl. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Non Perl/CGI questions or issues * Lemurs 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl/CGI , then it is allowed. If your question has nothing at all to do with Perl/CGI, it will likely be ignored. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: perldoc perldoc At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 3 - Other Resources 3.1 - What other websites may be useful to a beginner ? * Perl.org - http://www.perl.org * Perl Home Page - http://www.perl.com * PerlMonks - http://www.perlmonks.org * Perldoc - http://www.perldoc.com * Perl Archives - http://www.perlarchives.com * NMS Archive - http://nms-cgi.sourceforge.net/ * Unofficial Perl Beginners' Site - http://perl-begin.berlios.de 3.2 - What resources may be harmful to a beginner? Beware of Perl4-like code-- You might find some script archives and unauthorized mirrors with old Perl4 versions of Selena Sol and Matt Wright scripts. Don't use those scripts. They are outdated and may even in some cases
RE: How do I document my perl code?
Is there any standard for documenting functions? For example, in Javadoc, there is a specific format that uses the @ for identifying and formating the function argruments. It looks like POD much more freeform and is not nearly so detailed. Is that true? Siegfried P.S. Sorry Charles, I accidently replied to you personally. __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: How do I document my perl code?
Is there any standard for documenting functions? For example, in Javadoc, there is a specific format that uses the @ for identifying and formating the function argruments. It looks like POD much more freeform and is not nearly so detailed. Is that true? Siegfried P.S. Sorry Charles, I accidently replied to you personally. Could be, I haven't used Javadoc. You might find Mark Overmeer's OODoc interesting, http://perl.overmeer.net/oodoc/ http://search.cpan.org/~markov/OODoc-0.10/lib/OODoc.pod Or take a look at the Docs category to see some of the things that can be done with Pod: http://search.cpan.org/modlist/Documentation This is sort of off topic for a CGI list, might be better posted to the [EMAIL PROTECTED] list instead. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: how to retreive data from internet.
also pls check Bioperl - donot again code - reuse the code. and ofcourse as asked earlier u need t have sound understanding of perl basics to use those modules. regards, krishna mohan - On Sun, Jun 06, 2004 at 09:51:22PM -0700, Tim Johnson wrote: How far have you gotten? Do you know any Perl yet, or are you just starting? Try checking out the documentation for Net::FTP. -Original Message- From: aditi gupta [mailto:[EMAIL PROTECTED] Sent: Sunday, June 06, 2004 9:42 PM To: [EMAIL PROTECTED] Subject: how to retreive data from internet. hi, i want to get a DNA sequence from internet for manipulations.i was told that it requires ftp .. but i don't have any idea about it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
DBI
hi, how to download DBI via PPM? regards, aditi Yahoo! India Matrimony: Find your partner online.
RE: DBI
Should be install DBI, as in: PPM - Programmer's Package Manager version 3.1. Copyright (c) 2001 ActiveState SRL. All Rights Reserved. Entering interactive shell. Using Term::ReadLine::Stub as readline library. Profile tracking is not enabled. If you save and restore profiles manually, your profile may be out of sync with your computer. See 'help profile' for more information. Type 'help' to get started. ppm install DBI -Original Message- From: aditi gupta [mailto:[EMAIL PROTECTED] Sent: Sunday, June 06, 2004 11:45 PM To: [EMAIL PROTECTED] Subject: DBI hi, how to download DBI via PPM? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: DBI
on windows... set HTTP_Proxy=your proxy with port ppm search DBI install DBI .try help aditi gupta wrote: hi, how to download DBI via PPM? regards, aditi Yahoo! India Matrimony: Find your partner online.
Re: Possible windows text editor Was: vi editor
You could also give PerlEdit a try. http://www.indigostar.com/perledit.html Brian Lunergan wrote: I use TextPad. It's shareware. Also has a number of good extensions that can be added for free to enhance its capabilities. Check it out at https://www.textpad.com/index.html. aditi gupta [EMAIL PROTECTED] wrote: hi, vi is used only in unix and linux.which editor can be used in windows and is better than notepad. thanx, aditi Yahoo! India Matrimony: Find your partner online. --- Brian Lunergan Nepean, Ontario Canada - Post your free ad now! Yahoo! Canada Personals -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: GD::Graph
Josimar Nunes De Oliveira wrote: Does GD::Graph module exist for windows platform? Yes Where can I find it? ppm install GD-Graph -Tarun -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: DBI
-Original Message- From: lohit [mailto:[EMAIL PROTECTED] Sent: Monday, June 07, 2004 8:58 AM To: aditi gupta Cc: [EMAIL PROTECTED] Subject: Re: DBI on windows... set HTTP_Proxy=your proxy with port ppm search DBI install DBI Just to complete, in addition to HTTP_proxy SET HTTP_proxy_user=your user name (if required) SET HTTP_proxy_pass=your password (if required) Have a look to: http://aspn.activestate.com/ASPN/docs/ActivePerl/faq/ActivePerl-faq2.html#ppm_and_proxies 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] http://learn.perl.org/ http://learn.perl.org/first-response
RE: different versions of same Perl module in different Apache vh osts
Andrew Gaffney wrote: I didn't really know where to post this since it isn't specifically Apache or Perl, so I'm posting herejust because :) I run 2 vhosts under Apache 1.3.29 (needed for mod_perl-1.x which is needed by HTML::Mason) on my Gentoo server. One vhost is the current production site and the other vhost is the development version of the site. I use a custom Perl module for authentication and other common functions for all my Perl CGI/mod_perl scripts. I want to be able to make changes to the module, but I only want it to affect the second vhost. Basically, I need to have 2 copies of my custom module, one for each vhost. Is there an easy way to do this? If you have only one instance of Apache, I think the answer is no. The multiple virtual hosts still share the single perl interpreter. Why not just run two instances of Apache and put your development version on the second (listen on port 8080 or some such)? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
reading commandline parameters and
I am running a perl program that reads a file name from commandline substitutes one string with another displays the output #!/usr/bin/perl open(IN,$ARGV[0]) || die $!; while(IN){ s/$ARGV[1]/$ARGV[2]/; print; } exit 0; __END__ # I run this using command # perl myscript.pl THEFILE OLDSTR NEWSTR Can I use instead on open file and then IN here Thanks Ramprasad -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: reading commandline parameters and
On Jun 7, Ramprasad A Padmanabhan said: open(IN,$ARGV[0]) || die $!; while(IN){ s/$ARGV[1]/$ARGV[2]/; print; } exit 0; Do you come from C? It's hardly ever necessary to exit(0) at the end of a Perl program. Can I use instead on open file and then IN here Yes, if you first remove $ARGV[1] and $ARGV[2]; here are some ways: my ($from, $to) = splice @ARGV, 1, 2; my ($to, $from) = (pop @ARGV, pop @ARGV); # -- backwards! Then you can do: while () { s/$from/$to/; print } -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ CPAN ID: PINYAN[Need a programmer? If you like my work, let me know.] stu what does y/// stand for? tenderpuss why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: vi editor (U)
UNCLASSIFIED There's also gvim for windows http://www.vim.org -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Saturday, June 05, 2004 5:02 PM To: [EMAIL PROTECTED] Subject: Re: vi editor Aditi gupta wrote: hi, Hello, vi is used only in unix and linux. Not so! http://www.thomer.com/vi/vi.html#versions which editor can be used in windows and is better than notepad. http://www.ultraedit.com/ http://slickedit.com/ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: vi editor
On Sat, Jun 05, 2004 at 04:34:00PM +0100, aditi gupta wrote: hi, vi is used only in unix and linux.which editor can be used in windows and is better than notepad. thanx, aditi I'm extremely pleased with Textpad (http://www.textpad.com). Fast start time, easy to use, highly customizable, powerful macros and regex abilities, nicely organized menu structures. --Dks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
perl.beginners Weekly list FAQ posting
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to [EMAIL PROTECTED] You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address): [EMAIL PROTECTED]. 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] 1.3 - There is too much traffic on this list. Is there a digest? Yes. To subscribe to the digest version of this list send an email to: [EMAIL PROTECTED] To unsubscribe from the digest, send an email to: [EMAIL PROTECTED] This is a high traffic list (100+ messages per day), so please subscribe in the way which is best for you. 1.4 - Is there an archive on the web? Yes, there is. It is located at: http://archive.develooper.com/beginners%40perl.org/ 1.5 - How can I get this FAQ? This document will be emailed to the list once a week, and will be available online in the archives, and at http://learn.perl.org/ 1.6 - I don't see something in the FAQ, how can I make a suggestion? Send an email to [EMAIL PROTECTED] with your suggestion. 1.7 - Is there a supporting website for this list? Yes, there is. It is located at: http://beginners.perl.org/ 1.8 - Who do I complain to? You can send complaints to [EMAIL PROTECTED] 1.9 - Who currently maintains the FAQ? Kevin Meltzer, who can be reached at the email address (for FAQ suggestions only) in question 1.6 1.10 - Who will maintain peace and flow on the list? Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large, yet padded, clue-sticks to maintain peace and order on the list. If you are privately emailed by one of these folks for flaming, being off-topic, etc... please listen to what they say. If you see a message sent to the list by one of these people saying that a thread is closed, do not continue to post to the list on that thread! If you do, you will not only meet face to face with a XQJ-37 nuclear powered pansexual roto-plooker, but you may also be taken off of the list. These people simply want to make sure the list stays topical, and above-all, useful to Perl beginners. 1.11 - When was this FAQ last updated? Feb 04, 2004 2 - Questions about the 'beginners' list. 2.1 - What is the list for? A list for beginning Perl programmers to ask questions in a friendly atmosphere. 2.2 - What is this list _not_ for? * SPAM * Homework * Solicitation * Things that aren't Perl related * Monkeys * Monkeys solicitating homework on non-Perl related SPAM. 2.3 - Are there any rules? Yes. As with most communities, there are rules. Not many, and ones that shouldn't need to be mentioned, but they are. * Be nice * No flaming * Have fun 2.4 - What topics are allowed on this list? Basically, if it has to do with Perl, then it is allowed. You can ask CGI, networking, syntax, style, etc... types of questions. If your question has nothing at all to do with Perl, it will likely be ignored. If it has anything to do with Perl, it will likely be answered. 2.5 - I want to help, what should I do? Subscribe to the list! If you see a question which you can give an idiomatic and Good answer to, answer away! If you do not know the answer, wait for someone to answer, and learn a little. 2.6 - Is there anything I should keep in mind while answering? We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the beginner to the place in the FM they should R :) Please do not quote the documentation unless you have something to add to it. It is better to direct someone to the documentation so they hopefully will read documentation above and beyond that which answers their question. It also helps teach them how to use the documentation. 2.7 - I don't want to post a question if it is in an FAQ. Where should I look first? Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it. It can save everyone time if you look in the Perl FAQs first, instead of having a list of people refer you to the Perl FAQs :) You can learn about 'perldoc' by typing: perldoc perldoc At your command prompt. You can also view documentation online at: http://www.perldoc.com and http://www.perl.com 2.8 Is this a high traffic list? YES! You have been warned! If you don't want to get ~100 emails per day from this list, consider subscribing to the digest. 2.9 Other tips before posting to the list
Re: GD::Graph
Dear Tarun, I just can´t get it. What may be wrong? screen-copy Microsoft Windows 2000 [Versão 5.00.2195] (C) Copyright 1985-2000 Microsoft Corp. C:\Documents and Settings\Administradorppm install GD-Graph Error: Package 'GD-Graph' not found. Please 'search' for it first. C:\Documents and Settings\Administrador /screen-copy Thanks, Josimar - Original Message - From: Tarun Dua [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 07, 2004 3:35 AM Subject: Re: GD::Graph Josimar Nunes De Oliveira wrote: Does GD::Graph module exist for windows platform? Yes Where can I find it? ppm install GD-Graph -Tarun -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: different versions of same Perl module in different Apache vh osts
Bob Showalter wrote: Andrew Gaffney wrote: I didn't really know where to post this since it isn't specifically Apache or Perl, so I'm posting herejust because :) I run 2 vhosts under Apache 1.3.29 (needed for mod_perl-1.x which is needed by HTML::Mason) on my Gentoo server. One vhost is the current production site and the other vhost is the development version of the site. I use a custom Perl module for authentication and other common functions for all my Perl CGI/mod_perl scripts. I want to be able to make changes to the module, but I only want it to affect the second vhost. Basically, I need to have 2 copies of my custom module, one for each vhost. Is there an easy way to do this? If you have only one instance of Apache, I think the answer is no. The multiple virtual hosts still share the single perl interpreter. Why not just run two instances of Apache and put your development version on the second (listen on port 8080 or some such)? I will end up having more than 2 vhosts, most of which will need a custom version of this particular module. -- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: different versions of same Perl module in different Apache vh osts
Andrew Gaffney wrote: I will end up having more than 2 vhosts, most of which will need a custom version of this particular module. In that case, I think you'll need to give the modules different names. You could write your handler in such a way that it would recompile the module (switching flavors) with each request, but that would kind of defeat the purpose of mod_perl... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: reading commandline parameters and
I am sorry I did not give the real situation before, I want to execute this on command line like perl -pe 's/$ARGV[1]/$ARGV[2]/' filename OLDSTR NEWSTR Is this possible ? Thanks Ram Why not perl -pe 's/OLDSTR/NEWSTR/' filename -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Perl calling Profile
I have a perl script that I am setting up in crontab to run and when running the script under that user the script runs fun because the .profile runs and the environment variables are set up. I can I easily call the .profile within the script and keep the environment variables throughout the rest of the script? or do I need to manually call all items in the .profile. This is what is currently in the .profile # FAXCOMMANDER SETUP (BEGIN) # if test -f /usr2/faxmgr/cfg/scripts/profile; then . /usr2/faxmgr/cfg/scripts/profile fi # # FAXCOMMANDER SETUP ( END ) export ENV=$HOME/.kshrc Anthony J Segelhorst Enterprise Systems Management Team Phone: 937-495-1876 Email: [EMAIL PROTECTED] This email has been scanned for all viruses by the MessageLabs SkyScan service.___ This electronic message contains information from MeadWestvaco Corporation or subsidiary companies, which may be confidential, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify MeadWestvaco immediately at [EMAIL PROTECTED] ___
Re: different versions of same Perl module in different Apache vh osts
Bob Showalter wrote: Andrew Gaffney wrote: I will end up having more than 2 vhosts, most of which will need a custom version of this particular module. In that case, I think you'll need to give the modules different names. You could write your handler in such a way that it would recompile the module (switching flavors) with each request, but that would kind of defeat the purpose of mod_perl... Is there a way to auto-import a particular module in the vhost definition so that my scripts don't have to 'use' it? I think that would give me the results I'm looking for. -- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
if -s clause
was hoping for some add'l assistance. I deleted the bulk of the code out b/c I cannot get it to send me the results of the if clause. Any ideas? I did verify the file is being appended to and is greater that 0 bytes. The if -s on the array is running b/c my else clause is creating the run file with a current timestamp??? -rw-r--r-- 1 root eb 7577 Jun 7 17:53 foreign_tapes.log -rw-r--r-- 1 root other 0 Jun 7 17:53 ftapes_runfile use strict; use warnings; ## Set and edit variables my $foreigntapes=/usr/local/log/foreign_tapes.log; delete $ENV{'IFS'}; local $ENV{'PATH'} = /usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin; #print $ENV{'PATH'},\n; ## Traverse through array and play with data open (OUT, $foreigntapes) || die could not open file:$!; my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`; print OUT @ftapes; if ( -s @ftapes ) { print file is greater than 0 bytes \n; `ls -la /usr/local/log/foreign_tapes.log`; foreach (@ftapes) { print $_; #`evmlabel -l st_9840_acs_0 -t 9840S -b$_` } close (OUT); } else { my $foo=/tmp/ftapes_runfile; open (RUNFILE, $foo) || die could not open runfile: $!; } close (RUNFILE); thank you, Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams
how to check for dots in filename
hi all, can anyone tel me how to look for files which conatain dotsin it. i.e file1.txt file2.txt how to check for dots in filename using regular expression. is it correct my $ty=polica.op if($ty =m/ (.*)\.o/) print found; plz reply soon sid - There is nothing in a caterpillar that tells you it's going to be a butterfly. - Anonymous * Sidharth M Patil Engineer Kyocera-Wireless (India) Pvt Ltd 5th Floor, Phase I, Divyashree Towers, Guruppanapalya, Bannerghatta Road, Bangalore-560072 Tel : 51106988 extn 5171 *
Re: if -s clause
was hoping for some add'l assistance. I deleted the bulk of the code out b/c I cannot get it to send me the results of the if clause. Any ideas? I did verify the file is being appended to and is greater that 0 bytes. The if -s on the array is running b/c my else clause is creating the run file with a current timestamp??? It is running, yes, but it is probably attempting to test for a file that is named the same as the number of elements of the array. That is my best guess at what Perl is doing, however '-s' takes a filename/filehandle *NOT* a list. perldoc -f -s -rw-r--r-- 1 root eb 7577 Jun 7 17:53 foreign_tapes.log -rw-r--r-- 1 root other 0 Jun 7 17:53 ftapes_runfile use strict; use warnings; ## Set and edit variables my $foreigntapes=/usr/local/log/foreign_tapes.log; delete $ENV{'IFS'}; local $ENV{'PATH'} = /usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbin:/bin:/sbin; #print $ENV{'PATH'},\n; ## Traverse through array and play with data open (OUT, $foreigntapes) || die could not open file:$!; my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`; print OUT @ftapes; if ( -s @ftapes ) { print file is greater than 0 bytes \n; `ls -la /usr/local/log/foreign_tapes.log`; This is a backtick call in void context which is worthless, non-portable, error prone, slow, etc. If you want information about a file use the 'stat' built-in. perldoc -f stat foreach (@ftapes) { This foreach needs to be moved up outside of the file test. Then test each element of the array. print $_; #`evmlabel -l st_9840_acs_0 -t 9840S -b$_` } close (OUT); A little surprising Perl isn't complaining about the location of this close, but it truly is an amazing language/interpreter. Since you don't use OUT after the previous print close it there, which will make the code much more readable. } else { my $foo=/tmp/ftapes_runfile; open (RUNFILE, $foo) || die could not open runfile: $!; You open this file and then do nothing with it?? } close (RUNFILE); HTH, http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
how to generate array name dynamically
hi all, i hav a requirement wherein i hav to generate array name dynamically durin recursive function cal how can i do this . sid - There is nothing in a caterpillar that tells you it's going to be a butterfly. - Anonymous * Sidharth M Patil Engineer Kyocera-Wireless (India) Pvt Ltd 5th Floor, Phase I, Divyashree Towers, Guruppanapalya, Bannerghatta Road, Bangalore-560072 Tel : 51106988 extn 5171 *
Re: how to check for dots in filename
hi all, can anyone tel me how to look for files which conatain dotsin it. i.e file1.txt file2.txt how to check for dots in filename using regular expression. is it correct my $ty=polica.op if($ty =m/ (.*)\.o/) The regular expresion should be /(.*)\.o/. Otherwise you'll try to match a filename beginning with a space. print found; plz reply soon sid - There is nothing in a caterpillar that tells you it's going to be a butterfly. - Anonymous * Sidharth M Patil Engineer Kyocera-Wireless (India) Pvt Ltd 5th Floor, Phase I, Divyashree Towers, Guruppanapalya, Bannerghatta Road, Bangalore-560072 Tel : 51106988 extn 5171 * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: how to generate array name dynamically
hi all, i hav a requirement wherein i hav to generate array name dynamically durin recursive function cal how can i do this . Why do you need to generate an array name? Can't you make it work using references? Because this way is, by far, less error-prone. sid - There is nothing in a caterpillar that tells you it's going to be a butterfly. - Anonymous * Sidharth M Patil Engineer Kyocera-Wireless (India) Pvt Ltd 5th Floor, Phase I, Divyashree Towers, Guruppanapalya, Bannerghatta Road, Bangalore-560072 Tel : 51106988 extn 5171 * -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: how to generate array name dynamically
Sidharth == Sidharth [EMAIL PROTECTED] writes: Sidharth i hav a requirement wherein i hav to generate array name Sidharth dynamically durin recursive function cal how can i do this . That is almost always the sign of a bad design. Please explain more, but I bet you'll need to back up a bit and rethink where you are at. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: how to check for dots in filename
Roberto Etcheverry wrote: hi all, can anyone tel me how to look for files which conatain dotsin it. i.e file1.txt file2.txt how to check for dots in filename using regular expression. is it correct my $ty=polica.op if($ty =m/ (.*)\.o/) The regular expresion should be /(.*)\.o/. Otherwise you'll try to match a filename beginning with a space. Can probably dispense with the (.*) at the beginning, and you may want to anchor the '\.o' at the end, otherwise you will match filenames that have a '.o' embedded, like 'filename.ok.txt'... /\.o$/ If you want to make sure that there is something before the initial dot, then you need to switch the * to a +, and can probably avoid the grouping, unless you need it for something else, /.+\.o/ Of course, to answer the question precisely, if you just want to see if a filename contains a dot, without specifying where, then just /\./ Should work. perldoc perlretut perldoc perlre http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
XML::Simple
Hello all, I am trying to play with simple XML. I hace reated a file, and am trying to read it in using XML::Simple and write it out, but with no luck :O(. Can someone point me to the correct error. Thanks in Advance, Mark G CODE: #!PERl -w use XML::Simple; use Data::Dumper; $ref = XMLin('.\NMS.xml', ForceArray = [ 'itemList', 'root' ,'menu' ],KeepRoot = 1,KeyAttr =define ) or die $!\n; print XMLout($ref, XMLDecl = 1,AttrIndent = 1); exit; FILE: ?xml version=1.0 ? root xmlns=http://localhost.com; menu define nameSimple XML/name comment/comment startPagestart/startPage displayauto1/display sortbylabel/sortby pageList page idstart/id titleAIX/title itemList item ida_aix1/id keya/key labelaix1/label commandconnect 1/command /item /itemList /page /pageList /define /menu /root
XML::DOM::Parser question !
All, I am trying to parse a XML file and change an element value. Below is code of mine where I am doing this. However, setAttribute doesn't work and it doesn't give any error message too. I spent enough time and doesn't make sense to me. I get right value using getAttribute('value). XML file is also pasted at the end of this mail. Any help or pointer is greatly appreciated. Any suggestions in writing better code for this task is also appreciated. Thank you, Ravi. --- my $udtTaskFile = $depotLocation/updates/$udtBaseName/tasks/$udtBaseName._cs_udt.xml; print (udtTaskfile is : $udtTaskFile \n); --- XML file which is pasted at end of this mail. Util::safeCopy($udtTaskFile, $udtTaskFile.time()); -- I have Util.pm my $parser = new XML::DOM::Parser; my $doc = $parser-parsefile($udtTaskFile); my @taskList = $doc-getElementsByTagName('taskEntry'); foreach my $task (@taskList) { if ($task-getAttribute('uniqueName') eq MergeConfig){ my $javaTask = $task-getElementsByTagName('javaTask'); if (! $javaTask) { $log-write(ERROR: Couldn't find any Java tasks in $udtTaskFile ); return Problem configuring installLPI. Couldn't find any Java Tasks in $udtTaskFile. ; } my $innerTask = $javaTask-item(0)-getElementsByTagName('arg'); if (! $innerTask) { $log-write(ERROR: Couldn't find any languagepack tasks in $udtTaskFile ); return Problem configuring installLPI. Couldn't find any languagepack Tasks in $udtTaskFile. ; } my $value = $innerTask-item(0)-getAttribute('value'); print (value is $value \n); This prints right value $innerTask-item(0)-setAttribute('value', true); - This is not working. No error and it doesn't change value } } -- !DOCTYPE harnessTaskList SYSTEM harnessTaskList.dtd harnessTaskList extensionClassname = tools.update.TaskHarnessExtForUDT logCategory = update/info !-- Task UDT Runs the update delivery tool -- taskEntry uniqueName = DiskSpace description = Checks if the necessary space is available on disk to proceed with update logCategory = update/info canRerun = true javaTask className = tools.update.DiskSpace/ /taskEntry taskEntry uniqueName = UDT description = Runs the update delivery tool dependency = DiskSpace logCategory = update/info canRerun = true javaTask className = tools.update.UpdateDeliveryTool/ /taskEntry taskEntry uniqueName = EnableLanguages description = Install files for language pack. dependency = UDT canRerun = true logCategory = lpi/info javaTask className = tool.update.languagepack.EnableLanguage/ /taskEntry taskEntry uniqueName = MergeConfig description = Merges language related files to config. dependency = UDT, EnableLanguages logCategory = lpi/info canRerun = true javaTask className = tool.update.languagepack.MergeConfig arg name=sample value=false/ -- This is the value I am trying to change /javaTask /taskEntry /harnessTaskList
Re: XML::Simple
Mark Goland wrote: Hello all, I am trying to play with simple XML. I hace reated a file, and am trying to read it in using XML::Simple and write it out, but with no luck :O(. Can someone point me to the correct error. Thanks in Advance, Mark G CODE: #!PERl -w use XML::Simple; use Data::Dumper; $ref = XMLin('.\NMS.xml', ForceArray = [ 'itemList', 'root' ,'menu' ],KeepRoot = 1,KeyAttr =define ) or die $!\n; print XMLout($ref, XMLDecl = 1,AttrIndent = 1); exit; snip xml file What version of XML::Simple are you using? My version at 2.07 does not have the 'AttrIndent' option and throws the following exception: Unrecognised option: AttrIndent at ./test.pl line 13 Which does appear in the docs on CPAN for version 2.12. If I remove that option then your program with the provided file works fine as far as I can tell, aka it runs. You didn't specifically state what problem you are seeing. If this doesn't help give us the precise meaning of what isn't working, what the exact error is, etc. perl -MXML::Simple -e 'print $XML::Simple::VERSION' Should tell you your version number. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: if -s clause
Please bottom post. [EMAIL PROTECTED] wrote: I originally had if ( -s OUT ) { print file is greater than 0 bytes \n; } so is this what I want to use? Because I just ran it and it is still not printing this string. Well theoretically that might work since the def in the docs indicates a filehandle is possible. I am wondering if maybe it is because your output does not contain a new line and is buffered. One of the gurus with internals knowledge would be better suited to answer that. You might try turning on autoflush for the handle before printing it, or alternatively as I already suggested close the filehandle, which will force the flush to occur (and conveniently force you to test the file rather than the handle which is my next suggestion). This is probably the copout approach, but to me the easiest least worrisome approach. No guesses needed. Please excuse my indentation as I cut and pasted it. My goal is to send a mail message using MIME:Lite if the file is greater than 0 bytes else just touch a file. The reason for opening the RUNFILE is b/c I wanted to create a file to verify there the if -s clase produced no output. In other words, there is no data being appended to $foreigntapes variable. thank you! Here is my code use strict; use MIME::Lite; ## Set and edit variables my $foreigntapes=/usr/local/log/foreign_tapes.log; delete $ENV{'IFS'}; local $ENV{'PATH'} = /usr/epoch/bin:/usr/epoch/EB/bin:/usr/bin:/usr/sbi n:/bin:/sbin; #print $ENV{'PATH'},\n; ## Traverse through array and play with data open (OUT, $foreigntapes) || die could not open file:$!; my @ftapes = grep s/^barcode=//, `evmvol -w label_state=1`; print OUT @ftapes; close OUT or warn Can't close write handle: $!; if ( -s OUT ) { if (-s $foreigntapes) { print file is greater than 0 bytes \n; `ls -la /usr/local/log/foreign_tapes.log`; Like I said before, what are you trying to accomplish with the above? foreach (@ftapes) { print $_; #`evmlabel -l st_9840_acs_0 -t 9840S -b$_` } close (OUT); } else { my $foo=/tmp/ftapes_runfile; open (RUNFILE, $foo) || die could not open runfile: $!; } close (RUNFILE); snip old posts http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: reading commandline parameters and
- Original Message - From: Chris Charley [EMAIL PROTECTED] Newsgroups: perl.beginners To: [EMAIL PROTECTED] Sent: Monday, June 07, 2004 2:07 PM Subject: Re: reading commandline parameters and I am sorry I did not give the real situation before, I want to execute this on command line like perl -pe 's/$ARGV[1]/$ARGV[2]/' filename OLDSTR NEWSTR Is this possible ? Thanks Ram Why not perl -pe 's/OLDSTR/NEWSTR/' filename Sorry, To do it your way: perl -pe 'BEGIN{$y=pop;$x=pop} s/$x/$y/' filename OLDSTR NEWSTR -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: XML::Simple
Wiggings, I should of been more clear. It does work, but does not produce same output as input. My best guess, it doesn't read in all the tags properly. AttrIndent is just a spacing thing, if if removed still does not work properly. C:\xml_parseperl -MXML::Simple -e print $XML::Simple::VERSION 2.12 - Original Message - From: Wiggins d'Anconia [EMAIL PROTECTED] To: Mark Goland [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, June 07, 2004 10:25 PM Subject: Re: XML::Simple Mark Goland wrote: Hello all, I am trying to play with simple XML. I hace reated a file, and am trying to read it in using XML::Simple and write it out, but with no luck :O(. Can someone point me to the correct error. Thanks in Advance, Mark G CODE: #!PERl -w use XML::Simple; use Data::Dumper; $ref = XMLin('.\NMS.xml', ForceArray = [ 'itemList', 'root' ,'menu' ],KeepRoot = 1,KeyAttr =define ) or die $!\n; print XMLout($ref, XMLDecl = 1,AttrIndent = 1); exit; snip xml file What version of XML::Simple are you using? My version at 2.07 does not have the 'AttrIndent' option and throws the following exception: Unrecognised option: AttrIndent at ./test.pl line 13 Which does appear in the docs on CPAN for version 2.12. If I remove that option then your program with the provided file works fine as far as I can tell, aka it runs. You didn't specifically state what problem you are seeing. If this doesn't help give us the precise meaning of what isn't working, what the exact error is, etc. perl -MXML::Simple -e 'print $XML::Simple::VERSION' Should tell you your version number. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: XML::DOM::Parser question !
Ravinder Arepally wrote: All, I am trying to parse a XML file and change an element value. Below is code of mine where I am doing this. However, setAttribute doesn't work and it doesn't give any error message too. I spent enough time and doesn't make sense to me. I get right value using getAttribute('value). XML file is also pasted at the end of this mail. Any help or pointer is greatly appreciated. Any suggestions in writing better code for this task is also appreciated. Thank you, Ravi. --- my $udtTaskFile = $depotLocation/updates/$udtBaseName/tasks/$udtBaseName._cs_udt.xml; print (udtTaskfile is : $udtTaskFile \n); --- XML file which is pasted at end of this mail. Util::safeCopy($udtTaskFile, $udtTaskFile.time()); -- I have Util.pm my $parser = new XML::DOM::Parser; my $doc = $parser-parsefile($udtTaskFile); my @taskList = $doc-getElementsByTagName('taskEntry'); foreach my $task (@taskList) { if ($task-getAttribute('uniqueName') eq MergeConfig){ my $javaTask = $task-getElementsByTagName('javaTask'); if (! $javaTask) { $log-write(ERROR: Couldn't find any Java tasks in $udtTaskFile ); return Problem configuring installLPI. Couldn't find any Java Tasks in $udtTaskFile. ; } my $innerTask = $javaTask-item(0)-getElementsByTagName('arg'); if (! $innerTask) { $log-write(ERROR: Couldn't find any languagepack tasks in $udtTaskFile ); return Problem configuring installLPI. Couldn't find any languagepack Tasks in $udtTaskFile. ; } my $value = $innerTask-item(0)-getAttribute('value'); print (value is $value \n); This prints right value $innerTask-item(0)-setAttribute('value', true); - This is not working. No error and it doesn't change value } } Please don't cross post, try one list then the other if the first doesn't provide acceptable resolution. snip sample file Does it not change the value of the internally represented structure, or in the file itself? Have you tried dumping the structure (not sure if it works with XML::DOM) using Data::Dumper? I am assuming it isn't throwing an exception about missing methods, I tried to track down where setAttribute is inherited from but the XML::DOM tree is a pretty big tangle. Can you be more specific about precisely what isn't working? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
RE: XML::DOM::Parser question !
I need to change value in file itself. It is not doing that. I am thinking setAttribute should change value of element in file. But my below code is not doing that even though I am using same. My intention is to change value of javaTask className = tool.update.languagepack.MergeConfig arg name=sample value=false/ to javaTask className = tool.update.languagepack.MergeConfig arg name=sample value=true/ Thanks, Ravi -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] Sent: Monday, June 07, 2004 8:09 PM To: Ravinder Arepally Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: XML::DOM::Parser question ! Ravinder Arepally wrote: All, I am trying to parse a XML file and change an element value. Below is code of mine where I am doing this. However, setAttribute doesn't work and it doesn't give any error message too. I spent enough time and doesn't make sense to me. I get right value using getAttribute('value). XML file is also pasted at the end of this mail. Any help or pointer is greatly appreciated. Any suggestions in writing better code for this task is also appreciated. Thank you, Ravi. --- my $udtTaskFile = $depotLocation/updates/$udtBaseName/tasks/$udtBaseName._cs_udt.xml ; print (udtTaskfile is : $udtTaskFile \n); --- XML file which is pasted at end of this mail. Util::safeCopy($udtTaskFile, $udtTaskFile.time()); -- I have Util.pm my $parser = new XML::DOM::Parser; my $doc = $parser-parsefile($udtTaskFile); my @taskList = $doc-getElementsByTagName('taskEntry'); foreach my $task (@taskList) { if ($task-getAttribute('uniqueName') eq MergeConfig){ my $javaTask = $task-getElementsByTagName('javaTask'); if (! $javaTask) { $log-write(ERROR: Couldn't find any Java tasks in $udtTaskFile ); return Problem configuring installLPI. Couldn't find any Java Tasks in $udtTaskFile. ; } my $innerTask = $javaTask-item(0)-getElementsByTagName('arg'); if (! $innerTask) { $log-write(ERROR: Couldn't find any languagepack tasks in $udtTaskFile ); return Problem configuring installLPI. Couldn't find any languagepack Tasks in $udtTaskFile. ; } my $value = $innerTask-item(0)-getAttribute('value'); print (value is $value \n); This prints right value $innerTask-item(0)-setAttribute('value', true); - This is not working. No error and it doesn't change value } } Please don't cross post, try one list then the other if the first doesn't provide acceptable resolution. snip sample file Does it not change the value of the internally represented structure, or in the file itself? Have you tried dumping the structure (not sure if it works with XML::DOM) using Data::Dumper? I am assuming it isn't throwing an exception about missing methods, I tried to track down where setAttribute is inherited from but the XML::DOM tree is a pretty big tangle. Can you be more specific about precisely what isn't working? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: XML::Simple
Please bottom post Mark Goland wrote: Wiggings, I should of been more clear. It does work, but does not produce same output as input. My best guess, it doesn't read in all the tags properly. AttrIndent is just a spacing thing, if if removed still does not work properly. C:\xml_parseperl -MXML::Simple -e print $XML::Simple::VERSION 2.12 That helps. I am assuming you are talking about how it is folding the single tags into attributes. This seems kind of contrived but I believe the following produces the same structure (aka out of order but that isn't strict), #!/usr/local/bin/perl use strict; use warnings; use XML::Simple; use Data::Dumper; my $ref = XMLin('./NMS.xml', ForceArray = [ 'itemList','menu','startPage','display','sortby','define','item','a','page' ], KeyAttr = [], ) or die $!\n; #print Dumper($ref); print XMLout($ref, XMLDecl = 1, RootName = 'root', NoAttr = 1); exit; The main changes are the list I had to pass to ForceArray, turning off the KeyAttr default list, not keeping the root element, but then also setting what the root element string should be, and finally telling it that none of the tags should be folded into attributes on output. I haven't come up with a good way to figure all of this out yet, usually I just do a lot of guess and test until it produces exactly what I want. Generally messing with ForceArray and KeyAttr has gotten me where I needed to go. You might re-examine the docs on these particular attributes. Helps? http://danconia.org - Original Message - From: Wiggins d'Anconia [EMAIL PROTECTED] To: Mark Goland [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, June 07, 2004 10:25 PM Subject: Re: XML::Simple Mark Goland wrote: Hello all, I am trying to play with simple XML. I hace reated a file, and am trying to read it in using XML::Simple and write it out, but with no luck :O(. Can someone point me to the correct error. Thanks in Advance, Mark G CODE: #!PERl -w use XML::Simple; use Data::Dumper; $ref = XMLin('.\NMS.xml', ForceArray = [ 'itemList', 'root' ,'menu' ],KeepRoot = 1,KeyAttr =define ) or die $!\n; print XMLout($ref, XMLDecl = 1,AttrIndent = 1); exit; snip xml file What version of XML::Simple are you using? My version at 2.07 does not have the 'AttrIndent' option and throws the following exception: Unrecognised option: AttrIndent at ./test.pl line 13 Which does appear in the docs on CPAN for version 2.12. If I remove that option then your program with the provided file works fine as far as I can tell, aka it runs. You didn't specifically state what problem you are seeing. If this doesn't help give us the precise meaning of what isn't working, what the exact error is, etc. perl -MXML::Simple -e 'print $XML::Simple::VERSION' Should tell you your version number. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: XML::DOM::Parser question !
Please bottom post Ravinder Arepally wrote: I need to change value in file itself. It is not doing that. I am thinking setAttribute should change value of element in file. But my below code is not doing that even though I am using same. My intention is to change value of javaTask className = tool.update.languagepack.MergeConfig arg name=sample value=false/ to javaTask className = tool.update.languagepack.MergeConfig arg name=sample value=true/ Are you calling 'printToFile' or one of the other output methods, on an opened handle? I don't believe (though I suppose it is possible) that the parser is acting on the file directly. I suspect the in memory structure has been updated but you need to write it back out. http://danconia.org -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] Sent: Monday, June 07, 2004 8:09 PM To: Ravinder Arepally Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: XML::DOM::Parser question ! Ravinder Arepally wrote: All, I am trying to parse a XML file and change an element value. Below is code of mine where I am doing this. However, setAttribute doesn't work and it doesn't give any error message too. I spent enough time and doesn't make sense to me. I get right value using getAttribute('value). XML file is also pasted at the end of this mail. Any help or pointer is greatly appreciated. Any suggestions in writing better code for this task is also appreciated. Thank you, Ravi. --- my $udtTaskFile = $depotLocation/updates/$udtBaseName/tasks/$udtBaseName._cs_udt.xml ; print (udtTaskfile is : $udtTaskFile \n); --- XML file which is pasted at end of this mail. Util::safeCopy($udtTaskFile, $udtTaskFile.time()); -- I have Util.pm my $parser = new XML::DOM::Parser; my $doc = $parser-parsefile($udtTaskFile); my @taskList = $doc-getElementsByTagName('taskEntry'); foreach my $task (@taskList) { if ($task-getAttribute('uniqueName') eq MergeConfig){ my $javaTask = $task-getElementsByTagName('javaTask'); if (! $javaTask) { $log-write(ERROR: Couldn't find any Java tasks in $udtTaskFile ); return Problem configuring installLPI. Couldn't find any Java Tasks in $udtTaskFile. ; } my $innerTask = $javaTask-item(0)-getElementsByTagName('arg'); if (! $innerTask) { $log-write(ERROR: Couldn't find any languagepack tasks in $udtTaskFile ); return Problem configuring installLPI. Couldn't find any languagepack Tasks in $udtTaskFile. ; } my $value = $innerTask-item(0)-getAttribute('value'); print (value is $value \n); This prints right value $innerTask-item(0)-setAttribute('value', true); - This is not working. No error and it doesn't change value } } Please don't cross post, try one list then the other if the first doesn't provide acceptable resolution. snip sample file Does it not change the value of the internally represented structure, or in the file itself? Have you tried dumping the structure (not sure if it works with XML::DOM) using Data::Dumper? I am assuming it isn't throwing an exception about missing methods, I tried to track down where setAttribute is inherited from but the XML::DOM tree is a pretty big tangle. Can you be more specific about precisely what isn't working? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response