Re: naive LWP::Get question (perhaps JavaScript related?)
Hello, If you can use Firefox, there is a handy extension - HttpFox, which displays all requests which are sent to the server (including AJAX). This way you can forge the same request in your perl script and call it just like client side browser script does. Pozdrawiam, rocku rock...@gmail.com W dniu 08.06.2012 21:22, Greg Aiken pisze: > hello perl users, today i am struggling to better understand what the > underlying issue is here. > > my employer uses a web based CMS system called 'salesforce.com > <http://salesforce.com>'. > > using a web browser, i log into this site, i then use its web interface > and eventually display a 'customer record' web page in my browser. > some of the elements i see on the page include 'products they own', > 'contacts', 'recent activities', etc... > > if i; > > a. using the web browser, 'view page source' i can actually see/read the > ascii html code fragments that clearly list the customers contact names, > email addresses, etc... in other words, what i see on the screen of my > rendered web page (in the browser), im able to read the full underlying > html code fragments and data fragments when 'viewing page source'. > > b. save as the currently viewed web page to my local hard drive, and i > open the resulting *.htm file with a text editor, i am once again able > to see all elements, to include the customers contact names and their > emails. > > now i had the thought, using LWP::Get i should be able to simply get > this same URL thats presented in my web browser. > > my first test. > > 1. i copied this URL and opened a new tab in my web browser that already > had a login session going with salesforce.com <http://salesforce.com>, > in the address field of the new tab, i pasted the URL, then hit the > 'enter' key. viola, the exact same page (as was currently displayed on > a different tab in my browser) also displayed equally well with all data > being displayed. > > 2. i then wrote an LWP::Get script where i pasted the exact same URL and > ran my script. my one liner... > > my $HTTP_response_code = LWP::Simple::mirror $url, 'test000.htm'; > print $HTTP_response_code; > > shows a status code of 200 (page retrieved), and resulted in a file > 'test000.htm' being written into the cwd. however, when i view the > contents of the file saved, its nothing close to 'browsers - view page > source' or to the contents of a web page saved locally from within the > web browser. > > my only guess here is that perhaps some elements of the page are > dynamically created via javascript, or other client browser technology - > which would be lacking from LWP::Get. > > if that is the reason, does anyone know if there is a notion of > 'simulating a browser' via a Perl script so i could do more than use > HTTP get, but instead simulate the full function of what a 'normal > browser' would do to essentially create the full contents of a page > using JavaScript, so that when i then save the contents of the page to a > file to evaluate, its got all dynamic content in place, and nothign is > missing. > > perhaps there are other reasons why i am getting this behavior. didnt > know if any others have tried hacking at web pages in this manner before > and might have had a similar experience. > > greg > > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Bidirectional non-blocking IPC
Hi, I'm working on a Perl daemon which will run PowerShell scripts. The essential part is to start a powershell.exe child process, feed it data on STDIN and read it's response from STDOUT. Apparently IPC::Open2 is limited to UNIX systems. What is the best way to do bidirectional, non-blocking IPC on Win32? Please provide a short example if possible. -- Regards, rocku ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Resolve hostname by specified nameserver
No, it's not pure Perl. It uses some XS code. I can't use it since in my project I am limited to standard ActivePerl modules. I could, of course, copy it if it wasn't for this C code. Chris Wagner pisze: > Why can't u use Net::DNS? It's pure Perl so there shouldn't be any trouble > using it anywhere on Windows. It doesn't have to be installed globally to > use it. U can copy it into ur own directory and do a use lib in ur script > to load it. Even in the worst case scenario u can copy all of the Net::DNS > code directly in ur own script. > > > At 04:34 PM 10/20/2009 +0200, rocku wrote: >> Hello, >> I need to resolve a hostname by a specified nameserver. Currently I am >> using nslookup throught backticks, but it's output differs slightly >> between Windows versions and is hard to parse. I wanted to use Socket >> and something like inet_ntoa(inet_aton('hostname')) but this way I have >> no option to specify the nameserver to query. I am aware about Net::DNS, >> but unfortunately I cannot use it because it's not standard in >> ActivePerl 5.10. An ideal solution would be some WMI function, but I >> cannot find any for the task. Maybe using Win32::API? >> >> So my question is - how to query a specific nameserver about a DNS 'A' >> record? > > > -- > REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- > "...ne cede malis" > > 0100 > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Resolve hostname by specified nameserver
Yes, the reason is that I am limited to standard ActivePerl modules. Serguei Trouchelle pisze: > rocku wrote: > >> I am aware about Net::DNS, >> but unfortunately I cannot use it because it's not standard in >> ActivePerl 5.10. > > Is there any reason not to run "ppm install Net::DNS" to install it? > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Resolve hostname by specified nameserver
Hello, I need to resolve a hostname by a specified nameserver. Currently I am using nslookup throught backticks, but it's output differs slightly between Windows versions and is hard to parse. I wanted to use Socket and something like inet_ntoa(inet_aton('hostname')) but this way I have no option to specify the nameserver to query. I am aware about Net::DNS, but unfortunately I cannot use it because it's not standard in ActivePerl 5.10. An ideal solution would be some WMI function, but I cannot find any for the task. Maybe using Win32::API? So my question is - how to query a specific nameserver about a DNS 'A' record? -- rocku ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win32::MsgBox highlight text?
As Rob May responded, it is possible to copy from MsgBox, the user just has to press CTRL+C and window's content gets copied to clipboard. That will do for me. Thank you for all the other suggestions. rocku pisze: > Hi, > I need to make a popup window with text that is highlightable, so the > user can select it and copy. Is it possible with Win32::MsgBox or any > other module that is delivered out of the box in ActiveState Perl > (Win32::GUI is not)? > > -- > greets, > rocku > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32::MsgBox highlight text?
Hi, I need to make a popup window with text that is highlightable, so the user can select it and copy. Is it possible with Win32::MsgBox or any other module that is delivered out of the box in ActiveState Perl (Win32::GUI is not)? -- greets, rocku ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Win2008 / Vista UAC - elevage privileges
Thanks for your reply, but that's not what I'm looking for. I should have described my problem more precisely. I'm working on a Perl program that will be run on different Windows Server machines (actually, it has a cmd wrapper that launches the actual Perl program embedded inside it). On Windows Server 2008 it requires the user to confirm the elevated privilege dialog, which I can't get to show up. I found a solution described here: http://stackoverflow.com/questions/150782/windows-vista-how-to-execute-a-exe-program-in-the-cmd-as-an-administrator/150911#150911 It is based on a weird fact, that Windows with UAC launches the elevated privilege box when there is 'runas' string at the end of arguments. However, it required using two separate scripts, one of which is a VBS script and the other is cmd. I've managed to cut it down just to the VBS script, but that's still not what I'm looking for, since my wrapper is cmd. The bottom line is that I'm looking for a solution to show the elevated privileges dialog box. Greg Aiken pisze: > you can interactively control it by invoking an elevated cmd window, then > running your perl program in that elevated window. > > either, > > a. browse to c:\windows\system32, then put cursor on 'cmd', right-click, > 'run as administrator', or > b. taskbar, windows logo, search field, type 'cmd' in search field, then if > 'cmd' is shown at the top of that window as a possible option, right-click > 'cmd' at top of that window > > the only other way to do this is to use a 'manifest' file. if you have a > properly configured manifest file, you would copy the manifest file to the > perl\bin directory. you would name it perl.exe.manifest. > > or, a Microsoft utility, I think called 'mc.exe' allows one to embed the > manifest into the exe. in which case, you would embed this manifest, > instructing to elevate privilege, directly into perl.exe > > the problem with manifest is that its not 'switchable' on or off. if you > use the manifest, all perl programs will be elevated. > > the interactive method allows you to control privilege elevation at runtime. > > -Original Message- > From: perl-win32-users-boun...@listserv.activestate.com > [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of > rocku > Sent: Wednesday, August 26, 2009 4:41 AM > To: perl-win32-users@listserv.ActiveState.com > Subject: Win2008 / Vista UAC - elevage privileges > > Hi, > is there a way to request administrator token from within a Perl script under Win2008 or Vista? > > -- > rocku > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > > > > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win2008 / Vista UAC - elevage privileges
Hi, is there a way to request administrator token from within a Perl script under Win2008 or Vista? -- rocku ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: WMI Win32_PhysicalMemory on Virtual PC
For a WinXP guest VM I don't get anything when querying for Win32_PhysicalMemory. But on the other hand you can get memory information from Win32_OperatingSystem -- rocku BRZEZINSKI, PAUL pisze: > I written a WMI query that attempts to obtain physical memory capacity via > WMI call. Works as expected on live PCs but returns strange results on a > guest OS hosted by Virtual PC 2007. Anyone else run into this? > > Ideas how to solve? > > Sample code: > -- > use strict; > use warnings; > use Win32::OLE qw(in); > > my( $objWMI ) = Win32::OLE->GetObject('winmgmts:.\\root\\cimv2'); > my( $colItems ) = $objWMI->ExecQuery( 'Select * from Win32_PhysicalMemory' ); > > foreach my $objItem (in $colItems) { > $totalMem += $objItem->{Capacity} / ( 1024 * 1024 ); > } > > print $totalMem, "\n"; > -- > Produces output of 64 (MB), when the memory allocated to the guest on the > settings dialog is 1.5G. On the guest, when I right-click on the Computer > icon on the desktop then select properties shows the correct/expected amount > of memory allocated. > > Suggestions? Is there a different branch to query instead of \root\cimv2? > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Increase pipe buffer size
Hi all, I'm using ActiveState Perl 5.10. Is there any way to increase pipe's buffer size? By running the included sample script, I found that (at least at Windows Server 2003) it is limited to 512 bytes. I am aware that Win32::Pipe has a method which allows to alter the buffer size, but it uses some C code to do it. Is it possible from Perl? - BEGIN SCRIPT - use strict; use warnings; use IPC::Open3; my $chars = 1; do { my $script = <
Re: Perl and memory...
To answer your first question, take a look at Perl's FAQ: http://perldoc.perl.org/perlfaq3.html#How-can-I-free-an-array-or-hash-so-my-program-shrinks? Amine pisze: > Hi all, > > Look at the following script: > --- > > use Thread qw(:DEFAULT async yield); > > sub func > { > my @b; > for ($i=0;$i<100;$i++) > { $b[$i] = 'Perl';} > ; > undef @b; > print '@b memory returned..'; > ; > } > > @param = (); > my $t = Thread->new(\&func, @param); > $result = $t->join; > > print "End of thread...\n"; > ; > > -- > > On Windows click on Ctrl-Alt-del and click on Performance to > look at the available memory. > > When you will run this script and the line > print "End of thread...\n"; > is executed all the memory used will be returned by > Perl. > > But when the line 'undef @b' is executed , all the used memory > is not returned. (please look on the Task manager)... > So my question is: > How can i 'force' Perl to return the used memory ? > > > My second question is this: > > Look at the following script: > > --- > > sub func > { > my @b; > for ($i=0;$i<100;$i++) > { $b[$i] = 'Perl';} > ; > undef @b; > print '@b memory returned..'; > ; > } > > func; > func; > > print "end ...\n"; > ; > > > > > When you will run this script , you will see that the > second call to func() does take a lot of time(much more > than the first call) , why ? > > > > Regards, > Amine. > > > > > > > > > > > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
DMI BIOS information
Hi, I'm working on a script which will be responsible for gathering various hardware information. Most of it I would like to get from BIOS's DMI. However, I cannot find a way to access this kind of data from withtin Perl, nor do I have a suitable CLI tool to report this kind of information. Under Linux I would use dmidecode. So my question is - how to get DMI BIOS information from within Perl in Win32 environment? -- rocku ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs