Search Results

Search found 78 results on 4 pages for 'renato silva'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Chrome Apps Office Hours - the WebView Control

    Chrome Apps Office Hours - the WebView Control Join Renato Mangini and Pete LePage as we discuss the WebView, a HTML tag that provides Chrome packaged app developers a way to insert a safe and controlled "browser in an element" DOM node. Learn the differences between the WebView and the Sandboxed pages, the WebView's automation API and some suggested use cases. From: GoogleDevelopers Views: 0 1 ratings Time: 01:00:00 More in Science & Technology

    Read the article

  • IEnumerable.Cast<>

    - by Renato Person
    If I can implicitly cast an integer value to a double (and vice versa), like: int a = 4; double b = a; // now b holds 4.0 Why can I not do this: int[] intNumbers = {10, 6, 1, 9}; double[] doubleNumbers2 = intNumbers.Cast<double>().ToArray<double>(); I get an "Specified cast is not valid" error message. Doing the opposite (casting from double to int) results in the same error. What am I doing wrong?

    Read the article

  • Zend Framework cleaning default routes when adding other

    - by Renato Aquino
    I have the following problem with Zend Framework. My project has several controllers like Video,Category and Post. The VideoController has an Action called categorylist, so the default URL/Route becomes /video/categorylist Since the action requires 3 parameters I whant to add one simple route: $router->addRoute( 'categorylist', new Zend_Controller_Router_Route('categorylist/:category/:page/:per_page', array('controller' => 'video', 'action' => 'categorylist','page'=>1,'per_page'=>6,'category'=>1)) ); With this I got my URL like www.siteurl.com/categorylist/42/1/6 but, the View Helper URL got crazy, and every url for the other controllers I try to echo it´s redirected to the categorylist route. So when I try this: <?= $this->url(array("controller"=> "video", "action" =>"view",'category'=>1),null,true)?> The expected result its /video/view/category/1, but I got /categorylit only. I tryied to debug the default routes but I got an empty array. print_r($ctrl->getRouter()->getRoutes()); Does anyone have some clue about this wierd behavior? I´m using Zend Framework Version 1.9.7

    Read the article

  • Which .NET class does represent the main CONTROLLER class for WebForms ?

    - by Renato Gama
    Hey guys, lately I was studying a bit of Java, when I was taught about a way to implement a controller class, whose resposibility is to redirect the request to an Action, which perfoms a specified work. That was the way I learnt; @Override protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try { String clazz = req.getRequestURI().replaceAll(req.getContextPath() + "/", "").replaceAll(".java", ""); ((Action)Class.forName("com.myProject.actions." + clazz).newInstance()).execute(req, res); } catch (Exception e) { e.printStackTrace(); } } I know that WebForms also works with HANDLERS, which are kind of actions. For example, each .aspx page inherits from a Page object which is a handler for that specified page. What I couldn't figure out is, which class does get request first and translate it to the specified action (page handler)? Is it a WebForms feature(implementation) or its a IIS resposibility? So, which class represent the main controller for WebForms? Thank you very much.

    Read the article

  • How do I solve an unresolved external when using C++ Builder packages (with TForm based classes)?

    - by José Renato
    Hi, i'm working with Bulder C++ 6 and 2010, and i'm having this problem: http://stackoverflow.com/questions/2727001/how-do-i-solve-an-unresolved-external-when-using-c-builder-packages But, the difference here is that i'm using a FORM compiled inside the package, so, take the example above, but in addition i'm including a form classe, like TForm2: class TForm2 : public TForm { __published: // IDE-managed Components TButton *Button1; void __fastcall Button1Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm2(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TForm2 *Form2; //--------------------------------------------------------------------------- So, when i'm trying to use this class in any project the linker stops and give me the unresolved external error. When i got that error i tried to include the word PACKAGE, like this: class PACKAGE TForm2 But, when i tried to compile the PACKAGE, the compiler stops with the unresolved external error: [ILINK32 Error] Error: Unresolved external '__fastcall Forms::TCustomForm::~TCustomForm()' referenced from c:\projects\UNIT2.OBJ How can i solve this problem? PS.: Sorry about the bad English.

    Read the article

  • Problem with displaying image from DB using asp.net MVC 2

    - by Renato
    Hello! I'm having trouble with displaying image from db. I think that method for saving image is working, because I see in DB that varbinary fields have some value, and that image type is correct. Also the size of image. But when I want to display image for product i don't get anything. Just blank space.. here is my code... public byte[] GetImage(int productID) { Product product = products.GetByID(productID); byte[] imageData = product.ImageData.ToArray(); return imageData; } That code is in my controller. Second is code from view : <% if (product.ImageData != null) { %> <img src='/product/getimage/<%= Html.Encode(product.ID) %>' alt=""/> <% } %> I tried some solutions found here on stack overflow, and everyone do it like this, but it's working for them. I dont have any idea why images aren't displayed. When i look at source code of page at debugging i have : <img src='/product/getimage/18' alt=""/> I'm using .net 4.0, MVC 2, VS 2010... Thanks in advance

    Read the article

  • AutoIt simulate new script line

    - by Renato Böhler
    I need some way to loop in a single line. Is there a way to simulate new lines in AutoIt? Because if I try While 1 MsgBox (0,1,2) Wend It will not work. So I was wondering if there is a way to simulate a new line, something like While 1 - MsgBox (0,1,2) - Wend Or some function to do this. I also already tried to make this: Func repeat($func, $limit) $i = 0 While $i <= $limit Execute($func) $i = $i + 1 WEnd EndFunc But it only executes Execute($func) once, even if I change While $i <= $limit for While 1. I have tried Execute("While $i <= 5" & @LF & "MsgBox(0, 1, 24)" & @LF & "$i = $i + 1" & @LF & "WEnd") too, it doesn't work even if I change @LF for @CRLF, @CR, Chr(13), \n, \r... Any ideas?

    Read the article

  • Pass dynamic value in URL with CakePHP

    - by Renato Dinhani Conceição
    I have the following method that performs an Ajax request passing some dynamic value obtained from a select input. It works fine, but the dynamic value is passed as parameter in the URL, something like states/listCities/?big_string_of_serialized_parameter . $this->Js->event( 'change', $this->Js->request( array( #url 'controller' => 'states', 'action' => 'listCities'), array( # ajax options that generates the serialized parameter 'update' => '#DealerCityId', 'data' => '$("#DealerStateId").serialize()', 'dataExpression' => true ) ) ); I'm trying to do this in a more friendly URL way, something like states/listCities/2. It's possible in CakePHP to generate a friendly URL like this with dynamic value from a input or is only possible passing the dynamic values as parameters?

    Read the article

  • XNA Notes 010

    - by George Clingerman
    With GDC 2011 wrapping up there were a LOT of great interviews and posts with and about XNA and XBLIG and some of our more notorious developers. Definitely worth spending many, many hours watching, listening and reading all those. Very inspiring! Also, don’t forget to get signed up for Dream Build Play! And just as an early warning reminder do NOT, I repeat do NOT wait to submit your game the last day. There are major issues submitting the last day every year and you do not want all your hard work to be hanging on whether your entry actually went through in that last day. Plan on submitting a few days if not a week before. I’m serious, you’ll thank yourself later! Now on to what’s happening in the XNA community! Time Critical XNA News: PAX East Meet Up (really wish I was going!) http://forums.create.msdn.com/forums/p/71921/439262.aspx Want to stay panicked about the countdown to Dream Build Play? Mike McLaughlin shares his DBP countdown clock http://twitter.com/#!/mikebmcl/status/44454458960252928 XNA Team: Nick Gravelyn Only needs less than 600 new users in his unique marketing plan for Pixel Man 2 http://nickgravelyn.com/pixelman2/ And hares his ad revenue numbers with his XNA WP7 games http://theoneswiththelight.com/2011/my-results-with-ad-revenue-for-wp7-games/ XNA MVPs: Andy “The ZMan” Dunn posts his 15,000th App Hub forum post and shares a few thoughts on the MVP summit http://forums.create.msdn.com/forums/t/77625.aspx Chris Williams shares his thoughts on the MVP summit http://geekswithblogs.net/cwilliams/archive/2011/03/07/144229.aspx XNA Developers: Nathan Fouts of Mommy’s Best games Wraps up GDC http://mommysbest.blogspot.com/2011/03/gdc-2011-wrapped.html And shares the wonderful screenshots from Serious Sam. (I’m so jealous people at PAX East willl be playing a demo of this game!) http://mommysbest.blogspot.com/2011/03/serious-sam-double-d.html James Silva of Ska Studios announces http://www.ska-studios.com/2011/03/09/vampire-smile-at-hotel-sierra/ http://www.ska-studios.com/2011/03/08/vengeance-begins-april-6th/ http://www.ska-studios.com/2011/03/04/good-morning-gato-52/ Michael McLaughlin writes an extremely useful set of tips for XNA WP7 developers http://geekswithblogs.net/mikebmcl/archive/2011/03/10/tips-for-xna-wp7-developers.aspx Robert Boyd “the one man XBLIG improving machine” posts his 9 tips for marketing an Xbox LIVE Indie Gam http://www.gamasutra.com/blogs/RobertBoyd/20110309/7183/9_Tips_for_XBLIG_Marketing.php http://forums.create.msdn.com/forums/p/77534/470586.aspx#470586 And shares his day by day experience at GDC this year http://www.gamasutra.com/blogs/RobertBoyd/20110301/7118/GDC_Saves_the_World__Impressions_Day_1.php http://www.gamasutra.com/blogs/RobertBoyd/20110301/7123/GDC_Saves_the_World__Impressions_Day_2.php http://www.gamasutra.com/blogs/RobertBoyd/20110303/7129/GDC_Saves_the_World__Impressions_Day_3.php http://www.gamasutra.com/blogs/RobertBoyd/20110307/7133/GDC_Saves_the_World__Impressions_Day_4.php http://www.gamasutra.com/blogs/RobertBoyd/20110307/7160/GDC_Saves_the_World__Impressions_Day_5.php Phillipe Da Silva releases new IGF Pong Sample preview http://www.vimeo.com/20904070 Xbox LIVE Indie Games (XBLIG): Gamergeddon posts XBox Indie Game Roundup for March 6th http://www.gamergeddon.com/2011/03/06/xbox-indie-game-round-up-march-6th/ Dealspwn interviews FortressCraft developer Projector Games http://www.dealspwn.com/fortresscraft-developer-interview-minecraft-clones-venting-haters-part-1/ http://www.dealspwn.com/fortresscraft-developer-interview-part-2-trials-tribulations-indie-development/ Writings of Mass Destruction continues the Xbox LIVE Indie Game a day campaign, here’s his take on FishCraft (be sure to check out his other posts!) http://writingsofmassdeduction.com/2011/03/05/day-116-fishcraft/ Tom Ogburn shares his GDC notes on the XBLIG panel jotted quickly while attending the panel http://twitter.com/#!/TOgburn/status/44454191028125696 http://www.starlitskygames.com/blogs/site_news/archive/2011/03/06/802.aspx Dave Voyles of Armless Octopus has crazy good coverage on XNA and Xbox LIVE Indie Game developers at GDC 2011. Interviews and articles all extremely well done! http://www.armlessoctopus.com/2011/03/06/gdc-2011-successful-indie-developers-share-insight-on-microsofts-self-publishing-service/ There’s honestly so many posts and interviews you should just hit his front page and scroll down through all of the latest ones. http://www.armlessoctopus.com/ GameMarx Episode 12 http://www.gamemarx.com/video/the-show/27/ep-12-march-4-2011.aspx B.U.T.T.O.N now on Steam! http://www.gamesetwatch.com/2011/03/button_party_game_now_on_steam.php German Xbox Dashboard gets review program from GamePro http://www.armlessoctopus.com/2011/03/07/gamepo-indie-review-show-debuts-on-german-xbox-dashboard/ XboxIndies.com (one of the best XNA sites out there at this point!) continues to add review sites to it’s main review feed. (And don’t forget to play with that awesome XBLIG pivot control!) http://xboxindies.com/ Kris Steele of FunInfused Games shares early footage of his game World of Chalk http://twitter.com/#!/kriswd40/status/45007114371989504 Raymond Matthews of Darkstarmatryx reviews FunInfused Games Abduction Action http://www.darkstarmatryx.com/?p=264 TheVideoGamerRob reviews Zombie Football Carnage http://videogamerrob.wordpress.com/2011/03/08/xblig-review-zombie-football-carnage/ XBLIG Square Off Making the Jump to WP7 http://www.wp7connect.com/2011/03/08/xblig-square-off-will-make-the-jump-to-windows-phone/ Mommy’s Best Games making the news round with their Serious Sam announcement http://www.joystiq.com/2011/03/09/serious-sam-gets-serious-indie-cred-with-new-indie-series/ Most quoted and linked XBLIG article of the week with the least amount of actual facts and reporting. Shared only because it makes me sad that this is the best coverage we get. (Hey reporters, there’s LOT and LOTS of XBLIG and XNA experts you can contact if you need to check up on facts or wonder why on questions like, Why can’t XBLIGs have Nazis? There’s actually a real answer for that..) http://www.joystiq.com/2011/03/06/xblig-facts-nazi-killing-a-no-no-revenue-a-yes-yes/ XNA Development: Mort8088 has been in an XNA tutorial writing frenzy releasing 4 XNA 4.0 entry level tutorials this week! http://mort8088.com/2011/03/06/xna-4-0-tutorial-0-intro/ http://mort8088.com/2011/03/06/xna-4-0-tutorial-1-fonts/ http://mort8088.com/2011/03/06/xna-4-0-tutorial-2-sprites/ http://mort8088.com/2011/03/06/xna-4-0-tutorial-3-input-from-keyboard/ Interesting discussion on what it means to be a community (you do have to sign up to be a member of the XNA UK forums to read it...) http://twitter.com/#!/XNAUK/status/44705269254594560 Slyprid continues his incredible pace on Transmute and shares screens of his new Animation Builder http://twitter.com/#!/slyprid/status/45169271847911424 http://forgottenstarstudios.com/blog/ Philippe Da Silva wants to know who is using IGF for their games. If it’s you, drop him a note letting him know! http://twitter.com/#!/philippedasilva/status/44325893719588864 New Sunburn Video Tutorials released http://www.synapsegaming.com/blogs/fivesidedbarrel/archive/2011/03/07/new-documentation-video-tutorials.aspx Loading and rendering animated collada models using XNA 4.0 http://bunkernetz.wordpress.com/2011/03/09/loading-and-rendering-animated-collada-models-using-xna-4-0/ XNA for Silverlight Developers Part 6 Accelerometer Input http://buzzgamesnews.blogspot.com/2011/03/xna-for-silverlight-developers-part-6.html

    Read the article

  • ASP.NET 4.0 Features

    ASP.NET v4 is released with Visual studio 2010. Web developers are presented with a bewildering range of new features and so Ludmal De Silva has described what he considers to be the most important new features in ASP.NET V4

    Read the article

  • Supplementary Developer Laptop

    - by David Silva Smith
    I'm looking to buy a laptop with the following specs for a developer. The goal will be to have a development machine supplementing the devs desktop. During work hours the dev will be on a beefy desktop. For working while on the go: trains, client sites, code camps, it would be nice to have a machine which can run Visual Studio 2008 without needing to remote desktop into their primary machine. What do you think is the lowest cost laptop meeting this need? Here are the specs I have in mind: SSD drive 64GB-doesn't need to be huge, most data is stored on servers. Will need to fit Windows 7, IIS, SQL Server, and Visual Studio 2010. RAM-3GB processor =Pentium Core 2 duo Screen size = 14 inches. OS doesn't matter. It will be paved with Windows 7 Ultimate optical drive omitted would be a plus. weight and battery life aren't so important because the machine will be plugged in almost all the time.

    Read the article

  • After minimizing app, on restore, windows pursues mouse pointer

    - by Nuno Silva
    Hi! I have an application in WPF C# where other than the purpose of what it's done, I customized the close and minimize buttons. The problem is that when I minimize, all is good, I cycle around all other apps, but, when I want to go back to the application, I click in the window in the taskbar, and the window pops up... But when it pops up, the window pursues the mouse pointer throughout the screen... The code i've implemented the the simplest it can be... private void Minimize_LeftMouseDown(object sender, MouseButtonEventArgs e) { this.WindowState = WindowState.Minimized; } Can you point me some directions? Thanks

    Read the article

  • how to create wizard forms in ruby on rails

    - by Branden Silva
    I'm trying to understand the best options for pulling off a wizard form in ruby on rails. Ideally I'd like to have it so the application signup has a back and next button that allows the user to submit data in steps. So in step 1 they could fill out contact info. Once they are done they could click next and be on step 2 to fill out payment info, etc. If they make a mistake, they can click back and correct it. Some steps will be required, while others will not, but you do have to make it to the last step to submit the data to the database to sign up. They then need the ability to go back and fill out the past steps in the same fashion after completion. (example: perhaps if they clicked on a profile link they could recomplete the steps in the same fashion because they didn't want to complete all the steps right away. Maybe by being given a skip button before they completed the steps to sign up?). I also need validation to happen on what steps have been completed preventing them from moving onto the next step until corrected or completed. Option 1) I've noticed that ajax has been recommended as an option in other questions on stackoverflow. The only problem I have with it is that the user would not be able to sign up if javascript was disabled. Ideally I'd like to have it be native to ruby on rails but I'm willing to work with whatever is necessary to get it to work.

    Read the article

  • How do I get google guice to inject a custom logger, say a commons-logging or log4j logger

    - by Miguel Silva
    Google guice has a built-in logger binding (http://code.google.com/p/google-guice/wiki/BuiltInBindings). But what if I want to use a commons-logging or log4j logger? Can I get guice to inject a Log created by LogFactory.getLog(CLASS.class) But having the same behavior as in built-in binding: The binding automatically sets the logger's name to the name of the class into which the Logger is being injected.. Does it even makes sense? Or shout I simply use the built-in java Logger? Or just use commons-logging without injections?

    Read the article

  • refactor LINQ TO SQL custom properties that instantiate datacontext

    - by Thiago Silva
    I am working on an existing ASP.NET MVC app that started small and has grown with time to require a good re-architecture and refactoring. One thing that I am struggling with is that we've got partial classes of the L2S entities so we could add some extra properties, but these props create a new data context and query the DB for a subset of data. This would be the equivalent to doing the following in SQL, which is not a very good way to write this query as oppsed to joins: SELECT tbl1.stuff, (SELECT nestedValue FROM tbl2 WHERE tbl2.Foo = tbl1.Bar), tbl1.moreStuff FROM tbl1 so in short here's what we've got in some of our partial entity classes: public partial class Ticket { public StatusUpdate LastStatusUpdate { get { //this static method call returns a new DataContext but needs to be refactored var ctx = OurDataContext.GetContext(); var su = Compiled_Query_GetLastUpdate(ctx, this.TicketId); return su; } } } We've got some functions that create a compiled query, but the issue is that we also have some DataLoadOptions defined in the DataContext, and because we instantiate a new datacontext for getting these nested property, we get an exception "Compiled Queries across DataContexts with different LoadOptions not supported" . The first DataContext is coming from a DataContextFactory that we implemented with the refactorings, but this second one is just hanging off the entity property getter. We're implementing the Repository pattern in the refactoring process, so we must stop doing stuff like the above. Does anyone know of a good way to address this issue?

    Read the article

  • Learning XNA for Game Development. Is it worth It?

    - by Nipuna Silva
    It seems that most of the popular games in the world are developed using C++. But Microsoft's game platform, XNA Studio is based on programming in C# and I didn't find any popular game which was developed using XNA. Also there are fewer Ebooks you find on XNA and even the google search for a problem won't give you much help. Does people doesn't use XNA as a gaming platform? Is it worth learning XNA for game development or should I consider some other platform?

    Read the article

  • WCF Service error on IIS with metadata

    - by Bruno Silva
    Hi, I'm trying to publish a service to IIS, it builds and runs OK on the ASP.NET dev server. When running in IIS I can get to the metadata by navigating to the service or by adding service reference in Visual Studio. But when I call a method from my client app it crashes with a internal server error. So I went to the Event Log and found this: WebHost failed to process a request. Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/8810861 Exception: System.Web.HttpException (0x80004005): There was no channel actively listening at 'http://mysite.net/soundhubservice.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. ---> System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'http://mysite.net/soundhubservice.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) Process Name: w3wp Process ID: 1080 My Web.Config looks something like this: <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service name="SoundHub.Services.SoundHubService" behaviorConfiguration="StreamingServiceBehavior"> <host> <baseAddresses> <add baseAddress="http://localhost/SoundHubServive"/> </baseAddresses> </host> <endpoint address="service" binding="basicHttpBinding" bindingConfiguration="httpBuffering" contract="SoundHub.Services.ISoundHubService"/> <endpoint address="stream" binding="basicHttpBinding" bindingConfiguration="HttpStreaming" contract="SoundHub.Services.ISoundHubStreamService"/> <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />--> </service> </services> <bindings> <basicHttpBinding> <binding name="HttpStreaming" maxReceivedMessageSize="67108864" transferMode="Streamed"/> <binding name="httpBuffering" transferMode="Buffered" /> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="StreamingServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="False"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration> Tried several combinations of settings I found while searching online but nothing helped, always the same error. Thanks Bruno

    Read the article

  • How to "know" of iisreset on a webservice.

    - by Francisco Silva
    I have a webservice where I want to do something when a the application pool ends, so I thought I'd do: Application_End() { // Some logic here } What happens is if I stop the application pool, this logic is executed. On the other hand, if I just call iisreset, it is NOT. So my question is: where should I put my code so that it is executed in both cases?

    Read the article

  • How can I "git log" only code published to trunk?

    - by Russell Silva
    At my workplace we have a "master" trunk branch that represents published code. To make a change, I check out a working copy, create a topic branch, commit to the topic branch, merge the topic branch into master, and push. For small changes, I might commit directly to master, then push. My problem is that when I use "git log", I don't care about my topic branches in my local working copy. I only want to see the changes to the master branch on the remote, shared git server. What's more, if I use --stat or -p or one of their friends, I want to see the files and changes associated with the merge commit to master, not associated to their original branch commits (which, like I said, I don't want to see at all). How do I go about doing this?

    Read the article

  • getelementbyid issue with radio button

    - by Nelson Silva
    I'm trying to make an alert with the value of the selected radio button, but I allways get the first of them, regardless the one I choose...(Acompanhado); html: <form/> <input type="radio" class="simple_form" name="grupo_1" value="Acompanhado" id="saida"/> <span class="texto">Acompanhado</span> <input type="radio" class="simple_form" name="grupo_1" value="Individual" id="saida"/> <span class="texto">Individual</span> </form> js: function save() { var saida_js = document.getElementById('saida').value; alert("Tipo de saida: " + saida_js); } Any idea ?

    Read the article

  • In what circumstances are instance variables declared as '_var' in 'use fields' readonly?

    - by Pedro Silva
    I'm trying to understand the behavior of the fields pragma, which I find poorly documented, regarding fields prefixed with underscores. This is what the documentation has to say about it: Field names that start with an underscore character are made private to the class and are not visible to subclasses. Inherited fields can be overridden but will generate a warning if used together with the -w switch. This is not consistent with its actual behavior, according to my test, below. Not only are _-prefixed fields visible within a subclass, they are visible within foreign classes as well (unless I don't get what 'visible' means). Also, directly accessing the restricted hash works fine. Where can I find more about the behavior of the fields pragma, short of going at the source code? { package Foo; use strict; use warnings; use fields qw/a _b __c/; sub new { my ( $class ) = @_; my Foo $self = fields::new($class); $self->a = 1; $self->b = 2; $self->c = 3; return $self; } sub a : lvalue { shift->{a} } sub b : lvalue { shift->{_b} } sub c : lvalue { shift->{__c} } } { package Bar; use base 'Foo'; use strict; use warnings; use Data::Dumper; my $o = Bar->new; print Dumper $o; ##$VAR1 = bless({'_b' => 2, '__c' => 3, 'a' => 1}, 'Foo'); $o->a = 4; $o->b = 5; $o->c = 6; print Dumper $o; ##$VAR1 = bless({'_b' => 5, '__c' => 6, 'a' => 4}, 'Foo'); $o->{a} = 7; $o->{_b} = 8; $o->{__c} = 9; print Dumper $o; ##$VAR1 = bless({'_b' => 8, '__c' => 9, 'a' => 7}, 'Foo'); }

    Read the article

  • In what circumstances are instance variables declared as '_var' in 'use fields' private?

    - by Pedro Silva
    I'm trying to understand the behavior of the fields pragma, which I find poorly documented, regarding fields prefixed with underscores. This is what the documentation has to say about it: Field names that start with an underscore character are made private to the class and are not visible to subclasses. Inherited fields can be overridden but will generate a warning if used together with the -w switch. This is not consistent with its actual behavior, according to my test, below. Not only are _-prefixed fields visible within a subclass, they are visible within foreign classes as well (unless I don't get what 'visible' means). Also, directly accessing the restricted hash works fine. Where can I find more about the behavior of the fields pragma, short of going at the source code? { package Foo; use strict; use warnings; use fields qw/a _b __c/; sub new { my ( $class ) = @_; my Foo $self = fields::new($class); $self->a = 1; $self->b = 2; $self->c = 3; return $self; } sub a : lvalue { shift->{a} } sub b : lvalue { shift->{_b} } sub c : lvalue { shift->{__c} } } { package Bar; use base 'Foo'; use strict; use warnings; use Data::Dumper; my $o = Bar->new; print Dumper $o; ##$VAR1 = bless({'_b' => 2, '__c' => 3, 'a' => 1}, 'Foo'); $o->a = 4; $o->b = 5; $o->c = 6; print Dumper $o; ##$VAR1 = bless({'_b' => 5, '__c' => 6, 'a' => 4}, 'Foo'); $o->{a} = 7; $o->{_b} = 8; $o->{__c} = 9; print Dumper $o; ##$VAR1 = bless({'_b' => 8, '__c' => 9, 'a' => 7}, 'Foo'); }

    Read the article

< Previous Page | 1 2 3 4  | Next Page >